# anhad928/anhadpreet-portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/anhad928/anhadpreet-portfolio
- Repository: https://github.com/anhad928/anhadpreet-portfolio

## Overview

##### Project Type and Purpose
- Full‑stack web application built with Next.js.
- Purpose: A personal/portfolio website with pages (Home, About, Projects, Resume, Contact, Settings, GitHub) and a small backend that serves JSON data and handles contact form submissions.

##### Main Components
a. Client (Browser)
b. Next.js Server (Node.js runtime / Vercel serverless)
c. Frontend pages & React components
d. API routes (serverless functions)
e. Data sources:
– projects.json (bundled file)
– Potential external email service (if contact.js integrates one)
f. Static assets (PDF resumes, images)

##### Relationships & Data Flows
- HTTP(s) GET → Browser requests a page route (e.g. GET /projects)
→ Next.js renderer chooses between SSG or SSR → React components assemble HTML/CSS/JS → Response to Browser.
- API Calls from client (contact form, project listings)
→ HTTP POST/GET to /api/contact.js or /api/projects.js
→ Serverless function executes:
– /api/projects.js reads pages/api/projects.json → returns JSON array
– /api/contact.js may forward email to an external SMTP or API
→ JSON response to Browser.
- Static file requests
→ Browser requests files under /public (e.g. Resume.pdf) → served directly by host.

##### Architectural Patterns & Design Principles
- Folder‑based routing (pages/ directory drives both UI and API).
- Hybrid rendering: Static Generation (SSG) for static pages, Server‑Side Rendering (SSR) or API endpoints for dynamic data.
- Component‑based UI (components/ folder) with shared layout (Layout.jsx, Sidebar, Titlebar, Tabsbar).
- Separation of concerns: styles in CSS Modules per component, global themes in styles/themes.css.

##### Technologies & Frameworks to Annotate
- Next.js (framework)
- React (UI library)
- Node.js (runtime for serverless API)
- CSS Modules (styles/*.module.css)
- jsconfig.json (path aliases)
- next.config.js (Next.js configuration)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["Browser / Client"]:::frontend

    %% Next.js Server
    subgraph "Next.js Server (Node.js/Vercel)" 
        direction TB
        Configs["Configuration"]:::backend
        subgraph "Folder-based Routing"
            direction TB
            subgraph "UI Routes (pages/)"
                direction TB
                App["_app.js"]:::frontend
                Home["index.jsx"]:::frontend
                About["about.jsx"]:::frontend
                ProjectsPage["projects.jsx"]:::frontend
                ResumePage["resume.jsx"]:::frontend
                ContactPage["contact.jsx"]:::frontend
                Settings["settings.jsx"]:::frontend
                GitHub["github.jsx"]:::frontend
            end
            subgraph "API Routes (pages/api/)"
                direction TB
                ProjectsAPI["projects.js"]:::backend
                ContactAPI["contact.js"]:::backend
            end
        end
        subgraph "React Component Library (components/)"
            direction TB
            Layout["Layout.jsx"]:::frontend
            Sidebar["Sidebar.jsx"]:::frontend
            Titlebar["Titlebar.jsx"]:::frontend
            Tabsbar["Tabsbar.jsx"]:::frontend
            Bottombar["Bottombar.jsx"]:::frontend
            Explorer["Explorer.jsx"]:::frontend
            ProjectCard["ProjectCard.jsx"]:::frontend
            RepoCard["RepoCard.jsx"]:::frontend
            ContactCode["ContactCode.jsx"]:::frontend
            Illustration["Illustration.jsx"]:::frontend
            Tab["Tab.jsx"]:::frontend
            ThemeInfo["ThemeInfo.jsx"]:::frontend
            HeadComp["Head.jsx"]:::frontend
            Icons["icons/*"]:::frontend
        end
    end

    %% Data Sources & Assets
    subgraph "Data & Assets"
        direction TB
        ProjectsJSON["projects.json"]:::data
        StaticAssets["public/Resume.pdf\npublic/Resume‑updated (1).pdf"]:::data
        EmailService["External Email Service"]:::external
    end

    %% Config files
    NextConfig["next.config.js"]:::backend
    PathAliases["jsconfig.json"]:::backend

    %% Flows
    Browser -->|"GET / (Home)"| Home
    Browser -->|"GET /about"| About
    Browser -->|"GET /projects"| ProjectsPage
    Browser -->|"GET /resume"| ResumePage
    Browser -->|"GET /contact"| ContactPage
    Browser -->|"GET /settings"| Settings
    Browser -->|"GET /github"| GitHub

    Browser -->|"GET static asset"| StaticAssets
    Browser -->|"GET projects list"| ProjectsAPI
    Browser -->|"POST contact form"| ContactAPI

    ProjectsAPI -->|"reads JSON"| ProjectsJSON
    ProjectsAPI -->|"returns JSON response"| Browser

    ContactAPI -->|"forwards email"| EmailService
    ContactAPI -->|"returns status"| Browser

    %% Config usage
    Configs --> NextConfig
    Configs --> PathAliases

    %% Styling
    Styles["styles/globals.css\nstyles/themes.css\nstyles/*.module.css"]:::data
    Configs --> Styles

    %% Class usage
    Home -->|Uses| Layout
    About -->|Uses| Layout
    ProjectsPage -->|Uses| ProjectCard
    ProjectsPage -->|Uses| Layout
    ResumePage -->|Uses| Layout
    ContactPage -->|Uses| ContactCode
    ContactPage -->|Uses| Layout

    %% Click Events
    click NextConfig "https://github.com/anhad928/anhadpreet-portfolio/blob/main/next.config.js"
    click PathAliases "https://github.com/anhad928/anhadpreet-portfolio/blob/main/jsconfig.json"
    click App "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/_app.js"
    click Home "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/index.jsx"
    click About "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/about.jsx"
    click ProjectsPage "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/projects.jsx"
    click ResumePage "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/resume.jsx"
    click ContactPage "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/contact.jsx"
    click Settings "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/settings.jsx"
    click GitHub "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/github.jsx"
    click Layout "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Layout.jsx"
    click Sidebar "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Sidebar.jsx"
    click Titlebar "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Titlebar.jsx"
    click Tabsbar "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Tabsbar.jsx"
    click Bottombar "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Bottombar.jsx"
    click Explorer "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Explorer.jsx"
    click ProjectCard "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/ProjectCard.jsx"
    click RepoCard "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/RepoCard.jsx"
    click ContactCode "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/ContactCode.jsx"
    click Illustration "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Illustration.jsx"
    click Tab "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Tab.jsx"
    click ThemeInfo "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/ThemeInfo.jsx"
    click HeadComp "https://github.com/anhad928/anhadpreet-portfolio/blob/main/components/Head.jsx"
    click Icons "https://github.com/anhad928/anhadpreet-portfolio/tree/main/components/icons/"
    click ProjectsAPI "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/api/projects.js"
    click ContactAPI "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/api/contact.js"
    click ProjectsJSON "https://github.com/anhad928/anhadpreet-portfolio/blob/main/pages/api/projects.json"
    click StaticAssets "https://github.com/anhad928/anhadpreet-portfolio/blob/main/public/Resume.pdf"
    click Styles "https://github.com/anhad928/anhadpreet-portfolio/blob/main/styles/globals.css"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#D0FFD6,stroke:#22863a,stroke-width:1px
    classDef data fill:#FFF4C1,stroke:#bf8700,stroke-width:1px
    classDef external fill:#FFE0B2,stroke:#d15700,stroke-width:1px
```
