How aditya-0011/portfolio-website works
Main Components
• Frontend (Client-Side):
• App Pages: Under the “app” directory (e.g., page.tsx, contact/page.tsx, projects/page.tsx). This folder encapsulates the routing and main layout logic with files like app/layout.tsx.
• Global Styling: app/globals.css and Tailwind CSS configuration (tailwind.config.ts, postcss.config.mjs) that style the UI.
• UI Components: Everything inside the “components” directory (e.g., Navbar, Footer, ContactForm, AboutMe, ExperienceDisplay, TechnologyDisplay, ProjectCard, etc.), which are re-usable presentational elements.
• Server-Side / Backend:
• Server Actions & API Routes: The “actions” directory (e.g., actions/db.ts) manages server-side operations, such as handling database transactions.
• Utility Libraries: The “lib” directory includes helper files for database interactions (lib/db.ts) and mailing functionality (lib/mail.ts), which support business logic from both app pages and server actions.
• Configuration & Types:
• Environment & Linting: Files like .env.sample, .eslintrc.json, .prettierrc, and others indicate project configuration.
• Types: The “types” folder provides TypeScript type definitions (e.g., types/project.ts) essential for maintaining consistency across the codebase.
Relationships and Data Flow
• Pages in the “app” directory trigger both client-side rendering and server-side actions as per Next.js's hybrid routing strategy.
• UI Components in the “components” directory are used within pages to render specific sections, such as navigation, about, projects, or contact forms.
• When a user interacts with the UI (for example, submitting a contact form), the data flows from the component into a server-side action (possibly routed via an API endpoint or directly handled server-side by Next.js) using the logic contained in “actions,” “lib/db.ts,” and “lib/mail.ts.”
Architectural Patterns and Key Technologies
• Next.js Framework: The project is bootstrapped with Create-Next-App; it uses Next.js’s routing (app directory structure) and server components.
• Component-based UI Development: The UI is broken into re-usable components (like Navbar, Footer, and various cards).
• Separation of Client and Server Logic: Although not split into separate “frontend” and “backend” directories, Next.js allows for server-side actions that work alongside client components.
• Tailwind CSS & Next/font: Styling and font optimization are managed through Tailwind and Next.js’s font optimization, respectively.
• Application Layers: “Pages (app)”, “UI Components (components)”, “Server Actions (actions)”, “Utility Functions (lib)”, and “Type Definitions (types)”.
• Infrastructure/Configuration: “Environmental Configs”, “Linting/Formatting”, “Build & Deployment Configs” (package.json, next.config.mjs, etc.).
• Data Flow and Dependencies:
• Rendering flow from the “app” pages to the “components” composing the UI.