"use client"; import { useRef, useState, useEffect } from "react"; import { motion, useInView } from "framer-motion"; import { Layers, ShieldCheck, Zap, RefreshCcw, GitBranch, Box, } from "lucide-react"; import { useTheme } from "next-themes"; import SyntaxHighlighter from "react-syntax-highlighter"; import { atomOneDark, atomOneLight, } from "react-syntax-highlighter/dist/esm/styles/hljs"; const principles = [ { icon: Layers, title: "Clean Architecture Mindset", description: "I structure applications with clear separation of concerns so business logic stays maintainable and easy to evolve as the project grows.", tag: "Architecture", }, { icon: Box, title: "Modular Code Structure", description: "I organize features into well-defined modules to keep the codebase scalable and easier for teams to understand and maintain.", tag: "Scalability", }, { icon: GitBranch, title: "Abstraction & Reusability", description: "I prefer abstractions and reusable patterns to keep the codebase flexible and easier to extend in future iterations.", tag: "Code Design", }, { icon: ShieldCheck, title: "SOLID Principles", description: "I apply SOLID principles to write clean, understandable code where each component has a clear responsibility.", tag: "Code Quality", }, { icon: Zap, title: "Performance Awareness", description: "I consider performance early by applying efficient queries, pagination, and thoughtful data handling in web applications.", tag: "Performance", }, { icon: RefreshCcw, title: "Maintainable Development", description: "I focus on writing maintainable code, using version control effectively, and building systems that teams can work on confidently.", tag: "Workflow", }, ]; const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: 0.08, delayChildren: 0.1 }, }, }; const itemVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.5, ease: "easeOut" } }, }; export function PrincipleSection() { const ref = useRef(null); const isInView = useInView(ref, { once: true, margin: "-80px" }); const { resolvedTheme } = useTheme(); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); const isDark = resolvedTheme === "dark"; const codeSnippet = `// ✅ Application Layer — Pure Business Logic @Injectable() export class UserService { constructor( private readonly userRepository: IUserRepository, // Interface, not implementation private readonly eventEmitter: IEventEmitter, ) {} async createUser(dto: CreateUserDto): Promise { const exists = await this.userRepository.findByEmail(dto.email) if (exists) throw new ConflictException('Email already registered') const user = UserEntity.create(dto) // Domain entity handles business rules await this.userRepository.save(user) await this.eventEmitter.emit('user.created', user) return user } } // ✅ Infrastructure Layer — Implementation Detail @Injectable() export class PrismaUserRepository implements IUserRepository { constructor(private prisma: PrismaService) {} async findByEmail(email: string) { /* ... */ } async save(user: UserEntity) { /* ... */ } }`; return (
{/* Background */}
{/* Header */}
System Design Engineering Principles I aim to build systems that are clean, maintainable, and ready to grow as products evolve. These principles guide how I structure applications and approach technical decisions.
{/* Principles Grid */} {principles.map((p) => { const Icon = p.icon; return (
{p.tag}

{p.title}

{p.description}

); })}
{/* Code snippet preview */} {/* macOS-style title bar */}
user.service.ts Clean Architecture Example
{/* Syntax-highlighted code */} {mounted ? ( {codeSnippet} ) : ( )}
); }