# heypranjal/pranjalsportfolio architecture

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

- Interactive diagram: https://gitdiagram.com/heypranjal/pranjalsportfolio
- Repository: https://github.com/heypranjal/pranjalsportfolio

## Overview

##### Project type and purpose
- This is a full-stack, server-rendered portfolio website built on Next.js (App Router).
- It serves static/dynamic pages (about, projects, stats, contact, etc.), uses server actions and API routes for data operations, and integrates with external services (GitHub, e-mail).

##### File structure
- app/ – Next.js App Router: pages (server and client components), server actions (in app/actions), API routes (app/api).
- components/ & components/ui/ – shared React components and UI primitives (shadcn/ui + Tailwind).
- lib/ – reusable Node-side helpers (database connection, code highlighting, utils).
- model/ – database schemas/models (loveCount, views).
- hooks/, config/, constants/ – client-side hooks, site configuration, constants.
- public/ – static assets.
- next.config.ts, postcss.config.mjs, tsconfig.json, etc. – build & deploy configuration.

##### Key insights from README
- Tech stack: Next.js, shadcn/ui on Tailwind CSS, TypeScript; deployed on Vercel.
- Live site integrates real-time counters (love, views), GitHub stats, and a contact form.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser Layer
    subgraph "Browser (Client)"
        direction TB
        Pages["Pages"]:::frontend
        ComponentsLib["Shared Components"]:::frontend
    end

    subgraph "Pages"
        direction TB
        About["About Page"]:::frontend
        Contact["Contact Page"]:::frontend
        Education["Education Page"]:::frontend
        Experience["Experience Page"]:::frontend
        ProjectsList["Projects Listing Page"]:::frontend
        ProjectDetail["Project Detail Page"]:::frontend
        Skills["Skills & Tools Page"]:::frontend
        Stats["Stats Page"]:::frontend
        Testimonials["Testimonials Page"]:::frontend
    end

    subgraph "Components Library"
        direction TB
        ContactForm["Contact Form Component"]:::frontend
        GitHubGraphs["GitHub Graph Components"]:::frontend
        LoveButton["Love Button Component"]:::frontend
    end

    Pages -->|navigates| About
    Pages -->|navigates| Contact
    Pages -->|navigates| Education
    Pages -->|navigates| Experience
    Pages -->|navigates| ProjectsList
    Pages -->|navigates| ProjectDetail
    Pages -->|navigates| Skills
    Pages -->|navigates| Stats
    Pages -->|navigates| Testimonials

    Contact -->|uses| ContactForm
    Stats -->|uses| GitHubGraphs
    Stats -->|uses| LoveButton

    %% Next.js Server Layer
    subgraph "Next.js Server (Vercel)" 
        direction TB
        AppRouter["App Router (app/)"]:::server
        subgraph "Serverless Functions"
            direction TB
            LoveAction["getAndSetLoveCountServerAction"]:::server
            ViewsAction["getAndSetViewsServerAction"]:::server
            GitHubAction["getGitHubStatsServerAction"]:::server
            MailAction["sendMailServerAction"]:::server
            GitHubAPI["API Route: /api/github-stats"]:::server
        end
        AppRouter -->|renders SSR/SSG| Pages
    end

    Pages -->|initial request| AppRouter
    ContactForm -->|submit Form →| MailAction
    LoveButton -->|click →| LoveAction
    GitHubGraphs -->|onLoad →| GitHubAction
    Stats -->|fetch GET /api/github-stats| GitHubAPI
    ProjectDetail -->|fetch projects.ts| AppRouter

    %% Data & External Layer
    subgraph "Data & External Services"
        direction TB
        MongoDB["MongoDB"]:::database
        GitHubExt["GitHub REST API"]:::external
        EmailExt["Email Service"]:::external
    end

    LoveAction -->|CRUD| MongoDB
    ViewsAction -->|CRUD| MongoDB
    GitHubAction -->|fetch| GitHubExt
    MailAction -->|send email| EmailExt
    GitHubAPI -->|proxy GET| GitHubExt

    %% Utility Modules
    subgraph "Libraries & Config"
        direction TB
        DatabaseHelper["lib/database.ts"]:::utility
        HighlightUtil["lib/highlight-code.ts"]:::utility
        FontsLoader["lib/fonts.ts"]:::utility
        Utils["lib/utils.ts"]:::utility
        Models["model/*"]:::utility
        Hooks["hooks/use-meta-color.ts"]:::utility
        Config["config/*"]:::utility
        Constants["constants/index.ts"]:::utility
        UIPrimitives["components/ui/*"]:::utility
        SharedComponents["components/*"]:::utility
    end

    AppRouter -->|uses| DatabaseHelper
    AppRouter -->|uses| HighlightUtil
    AppRouter -->|uses| FontsLoader
    AppRouter -->|uses| Utils
    AppRouter -->|loads models| Models
    ComponentsLib -->|uses| UIPrimitives
    ComponentsLib -->|uses| SharedComponents
    AppRouter -->|uses| Hooks
    AppRouter -->|reads| Config
    AppRouter -->|reads| Constants

    %% Click Events
    click Pages "https://github.com/heypranjal/pranjalsportfolio/tree/main/app/"
    click About "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/about/page.tsx"
    click Contact "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/contact/page.tsx"
    click ContactForm "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/contact/ContactForm.tsx"
    click Education "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/education/page.tsx"
    click Experience "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/experience/page.tsx"
    click ProjectsList "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/projects/page.tsx"
    click ProjectDetail "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/projects/[id]/page.tsx"
    click GitHubGraphs "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/stats/GitHubGraphs.tsx"
    click LoveButton "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/stats/LoveButtonComponent.tsx"
    click Stats "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/stats/page.tsx"
    click Testimonials "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/testimonials/page.tsx"
    click LoveAction "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/actions/getAndSetLoveCountServerAction.ts"
    click ViewsAction "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/actions/getAndSetViewsServerAction.ts"
    click GitHubAction "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/actions/getGitHubStatsServerAction.ts"
    click MailAction "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/actions/sendMailServerAction.ts"
    click GitHubAPI "https://github.com/heypranjal/pranjalsportfolio/blob/main/app/api/github-stats/route.ts"
    click DatabaseHelper "https://github.com/heypranjal/pranjalsportfolio/blob/main/lib/database.ts"
    click HighlightUtil "https://github.com/heypranjal/pranjalsportfolio/blob/main/lib/highlight-code.ts"
    click FontsLoader "https://github.com/heypranjal/pranjalsportfolio/blob/main/lib/fonts.ts"
    click Utils "https://github.com/heypranjal/pranjalsportfolio/blob/main/lib/utils.ts"
    click Models "https://github.com/heypranjal/pranjalsportfolio/tree/main/model/"
    click Hooks "https://github.com/heypranjal/pranjalsportfolio/blob/main/hooks/use-meta-color.ts"
    click Config "https://github.com/heypranjal/pranjalsportfolio/tree/main/config/"
    click Constants "https://github.com/heypranjal/pranjalsportfolio/blob/main/constants/index.ts"
    click UIPrimitives "https://github.com/heypranjal/pranjalsportfolio/tree/main/components/ui/"
    click SharedComponents "https://github.com/heypranjal/pranjalsportfolio/tree/main/components/"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085;
    classDef server fill:#d4edda,stroke:#155724,color:#155724;
    classDef database fill:#fff3cd,stroke:#856404,color:#856404;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef utility fill:#f8d7da,stroke:#721c24,color:#721c24;
```
