# aditya-0011/portfolio-website architecture

> Architecture diagram of the GitHub repository aditya-0011/portfolio-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aditya-0011/portfolio-website
- Repository: https://github.com/aditya-0011/portfolio-website

## Overview

##### 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.

## Diagram (Mermaid)

```mermaid
flowchart TD
    MAIN["Next.js Application"]:::main

    %% Frontend (Client-side)
    subgraph "Frontend (Client-side)"
        direction TB
        subgraph "App Pages"
            direction TB
            A1["Page.tsx (Page)"]:::frontend
            A2["Contact Page.tsx"]:::frontend
            A3["Projects Page.tsx"]:::frontend
            A4["Layout.tsx (Layout)"]:::frontend
            A5["Globals.css (Globals)"]:::frontend
        end
        subgraph "UI Components"
            direction TB
            B1["Navbar"]:::frontend
            B2["Footer"]:::frontend
            B3["ContactForm"]:::frontend
            B4["AboutMe"]:::frontend
            B5["ExperienceDisplay"]:::frontend
            B6["TechnologyDisplay"]:::frontend
            B7["ProjectCard"]:::frontend
            B8["ProjectsDisplay"]:::frontend
            B9["ExperienceCard"]:::frontend
            B10["TechnologyCard"]:::frontend
        end
    end

    %% Server-side
    subgraph "Server-side"
        direction TB
        subgraph "Server Actions"
            direction TB
            C1["db.ts (Action)"]:::backend
        end
        subgraph "Utility Libraries"
            direction TB
            D1["db.ts (Utility)"]:::backend
            D2["mail.ts (Utility)"]:::backend
        end
    end

    %% Configuration & Types
    subgraph "Configuration & Types"
        direction TB
        subgraph "Configuration & Global Setup"
            direction TB
            F1[".env.sample"]:::config
            F2[".eslintrc.json"]:::config
            F3[".prettierrc"]:::config
            F4["next.config.mjs"]:::config
            F5["postcss.config.mjs"]:::config
            F6["tailwind.config.ts"]:::config
        end
        subgraph "Type Definitions"
            direction TB
            G1["project.ts"]:::config
        end
    end

    %% Connections between major components
    MAIN -->|"initializes"| A4
    MAIN -->|"triggers"| C1
    MAIN -->|"loads"| F1

    %% Frontend internal interactions
    A4 -->|"includes"| B1
    A4 -->|"includes"| B2
    A1 -->|"composes"| B4
    A1 -->|"composes"| B5

    %% Interaction from UI to Server
    B3 -->|"submitsData"| C1
    C1 -->|"invokes"| D1
    C1 -->|"invokes"| D2

    %% Click Events for App Pages
    click A1 "https://github.com/aditya-0011/portfolio-website/blob/main/app/page.tsx"
    click A2 "https://github.com/aditya-0011/portfolio-website/blob/main/app/contact/page.tsx"
    click A3 "https://github.com/aditya-0011/portfolio-website/blob/main/app/projects/page.tsx"
    click A4 "https://github.com/aditya-0011/portfolio-website/blob/main/app/layout.tsx"
    click A5 "https://github.com/aditya-0011/portfolio-website/blob/main/app/globals.css"

    %% Click Events for UI Components
    click B1 "https://github.com/aditya-0011/portfolio-website/blob/main/components/Navbar.tsx"
    click B2 "https://github.com/aditya-0011/portfolio-website/blob/main/components/Footer.tsx"
    click B3 "https://github.com/aditya-0011/portfolio-website/blob/main/components/contact/ContactForm.tsx"
    click B4 "https://github.com/aditya-0011/portfolio-website/blob/main/components/home/AboutMe.tsx"
    click B5 "https://github.com/aditya-0011/portfolio-website/blob/main/components/home/experiences/ExperienceDisplay.tsx"
    click B6 "https://github.com/aditya-0011/portfolio-website/blob/main/components/home/technologies/TechnologyDisplay.tsx"
    click B7 "https://github.com/aditya-0011/portfolio-website/blob/main/components/projects/ProjectCard.tsx"
    click B8 "https://github.com/aditya-0011/portfolio-website/blob/main/components/projects/ProjectsDisplay.tsx"
    click B9 "https://github.com/aditya-0011/portfolio-website/blob/main/components/home/experiences/ExperienceCard.tsx"
    click B10 "https://github.com/aditya-0011/portfolio-website/blob/main/components/home/technologies/TechnologyCard.tsx"

    %% Click Events for Server Actions and Utility Libraries
    click C1 "https://github.com/aditya-0011/portfolio-website/blob/main/actions/db.ts"
    click D1 "https://github.com/aditya-0011/portfolio-website/blob/main/lib/db.ts"
    click D2 "https://github.com/aditya-0011/portfolio-website/blob/main/lib/mail.ts"

    %% Click Events for Configuration & Types
    click F1 "https://github.com/aditya-0011/portfolio-website/blob/main/.env.sample"
    click F2 "https://github.com/aditya-0011/portfolio-website/blob/main/.eslintrc.json"
    click F3 "https://github.com/aditya-0011/portfolio-website/blob/main/.prettierrc"
    click F4 "https://github.com/aditya-0011/portfolio-website/blob/main/next.config.mjs"
    click F5 "https://github.com/aditya-0011/portfolio-website/blob/main/postcss.config.mjs"
    click F6 "https://github.com/aditya-0011/portfolio-website/blob/main/tailwind.config.ts"
    click G1 "https://github.com/aditya-0011/portfolio-website/blob/main/types/project.ts"

    %% Class definitions for styling
    classDef main fill:#F0E68C,stroke:#B8860B,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef config fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
```
