# greg-chang/personal-site architecture

> Architecture diagram of the GitHub repository greg-chang/personal-site, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/greg-chang/personal-site
- Repository: https://github.com/greg-chang/personal-site

## Overview

##### Project type and purpose
- This is a Next.js personal portfolio site (full-stack but frontend-heavy), built with the “app” directory (Next.js 13+) and deployed on Vercel.
- It serves static content (resume PDF, images, markdown-based experience posts) plus a minimal backend API for the contact form.

##### File structure
- Top-level configs: eslint.config.mjs, jsconfig.json, next.config.mjs, tailwind.config.js, postcss.config.mjs – define linting, TS path aliases, Next.js behavior, and CSS pipeline.
- public/ – static assets (Resume PDF, fonts, images for experiences & projects).
- src/app/ – “app router” pages and components:
- page.js & layout.js: root page and layout (SSR + streaming support).
- app/api/contact/route.js: serverless function handling contact form POSTs.
- Components under app/components/ – header, ExperiencePopup, experience, projects.
- app/content/experiences/*.md – markdown sources for experiences.

##### README for additional insights
- Standard Create-Next-App boilerplate.
- Deploys on Vercel, auto-optimizes fonts with next/font.
- No extra services documented, implying a purely Vercel-hosted solution with optional external email or form-processing integration.

a. Main components
- Client (Browser)
- Next.js Frontend (React + SSR)
- Static Assets/CDN (Vercel’s Edge CDN)
- Serverless API (contact route)
- (Optional) External Service – e.g. email provider or database for form submissions
b. Relationships & interactions
1. Browser requests page → hits Vercel Edge CDN → cached static HTML/CSS/JS or triggers SSR.
2. Browser fetches static assets (PDF, fonts, images) from public/ via CDN.
3. On “Contact” submit, Browser POSTs to /api/contact → invokes serverless function (route.js).
4. Serverless function processes data → optionally calls external email or storage service → responds to client.
c. Architectural patterns & design principles
- App-directory Routing (file-based routing + server components)
- Serverless Functions (per-route lambdas)
- Static vs. Dynamic rendering (SSG for content pages, SSR/Edge for dynamic)
- CSS Utility-First (TailwindCSS)
d. Key technologies & frameworks
- Next.js 13+ (React, SSR, app router)
- Vercel (hosting + CDN + Functions)
- Tailwind CSS + PostCSS
- Markdown processing for content (MDX or custom loader)

##### Essential elements to capture
- Separation of concerns: UI, data/content, backend logic
- Data flow (request/response paths)
- Caching layers (Edge CDN vs. serverless)
- Any third-party integrations (email, analytics, forms)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Build & Deployment Pipeline
    subgraph "Build & Deploy Pipeline"
        direction TB
        Git["Git Repository"]:::pipeline
        VercelCI["Vercel CI/CD"]:::pipeline
        Build["Next.js Build"]:::pipeline
        Git --> VercelCI
        VercelCI --> Build
        Build -->|"deploy"| CDN
        Build -->|"deploy"| ServerlessAPI
    end

    %% CDN Layer
    CDN["Vercel Edge CDN"]:::static

    %% Client Layer
    Browser["Client Browser"]:::frontend
    Browser -->|GET /| CDN
    Browser -->|GET static assets| CDN
    Browser -->|POST /api/contact| CDN

    %% Frontend Layer
    subgraph "Next.js Frontend (React + SSR)"
        direction TB
        SSR["Next.js SSR"]:::frontend
        SSR --> Page
        SSR --> Layout
        SSR --> Header
        SSR --> ExpPopup
        SSR --> ExpItem
        SSR --> ProjectsComp
        SSR --> ContactPage
    end
    CDN -->|SSR or SSG| SSR

    %% Components
    Page["page.js"]:::frontend
    click Page "https://github.com/greg-chang/personal-site/blob/main/src/app/page.js"
    Layout["layout.js"]:::frontend
    click Layout "https://github.com/greg-chang/personal-site/blob/main/src/app/layout.js"
    Header["Header Component"]:::frontend
    click Header "https://github.com/greg-chang/personal-site/blob/main/src/app/components/header.js"
    ExpPopup["ExperiencePopup"]:::frontend
    click ExpPopup "https://github.com/greg-chang/personal-site/blob/main/src/app/components/ExperiencePopup.js"
    ExpItem["Experience Item"]:::frontend
    click ExpItem "https://github.com/greg-chang/personal-site/blob/main/src/app/components/experience.js"
    ProjectsComp["Projects Component"]:::frontend
    click ProjectsComp "https://github.com/greg-chang/personal-site/blob/main/src/app/components/projects.js"
    ContactPage["Contact Page UI"]:::frontend
    click ContactPage "https://github.com/greg-chang/personal-site/blob/main/src/app/contact/page.js"
    GlobalsCSS["globals.css"]:::frontend
    click GlobalsCSS "https://github.com/greg-chang/personal-site/blob/main/src/app/globals.css"

    %% Static Assets
    subgraph "Static Assets" 
        direction TB
        Resume["Resume PDF"]:::static
        click Resume "https://github.com/greg-chang/personal-site/blob/main/public/Resume/Gregory_Chang_Resume_2025.pdf"
        Fonts["Fonts Directory"]:::static
        click Fonts "https://github.com/greg-chang/personal-site/tree/main/public/fonts/"
        ExpImages["Experience Images"]:::static
        click ExpImages "https://github.com/greg-chang/personal-site/tree/main/public/experiences/"
        ProjImages["Project Images"]:::static
        click ProjImages "https://github.com/greg-chang/personal-site/tree/main/public/projects/"
        MDExp1["aggieworks-swe.md"]:::static
        click MDExp1 "https://github.com/greg-chang/personal-site/blob/main/src/app/content/experiences/aggieworks-swe.md"
        MDExp2["datalab-datascience.md"]:::static
        click MDExp2 "https://github.com/greg-chang/personal-site/blob/main/src/app/content/experiences/datalab-datascience.md"
        MDExp3["software-engineer.md"]:::static
        click MDExp3 "https://github.com/greg-chang/personal-site/blob/main/src/app/content/experiences/software-engineer.md"
    end
    CDN --> Resume
    CDN --> Fonts
    CDN --> ExpImages
    CDN --> ProjImages
    SSR --> MDExp1
    SSR --> MDExp2
    SSR --> MDExp3

    %% Backend Layer
    subgraph "Serverless API"
        direction TB
        ServerlessAPI["Contact Form Handler"]:::backend
        click ServerlessAPI "https://github.com/greg-chang/personal-site/blob/main/src/app/api/contact/route.js"
    end
    CDN --> ServerlessAPI
    ServerlessAPI -->|"send email / store"| EmailService

    %% External Services
    EmailService["External Email Service"]:::external
    EmailService -->|"response"| ServerlessAPI
    ServerlessAPI -->|"200 OK"| Browser

    %% Config & Tooling
    subgraph Configuration
        direction TB
        NextConfig["next.config.mjs"]:::config
        JSConfig["jsconfig.json"]:::config
        ESLint["eslint.config.mjs"]:::config
        TailwindCfg["tailwind.config.js"]:::config
        PostCSS["postcss.config.mjs"]:::config
    end
    Build --> NextConfig
    Build --> JSConfig
    Build --> ESLint
    Build --> TailwindCfg
    Build --> PostCSS

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#0366D6,color:#0366D6
    classDef static fill:#E6FFEA,stroke:#28A745,color:#28A745
    classDef backend fill:#FFEBD0,stroke:#D28A00,color:#D28A00
    classDef external fill:#F0E6FF,stroke:#6F42C1,color:#6F42C1
    classDef pipeline fill:#F0F0F0,stroke:#6A737D,color:#6A737D
    classDef config fill:#FFF5CA,stroke:#CB2431,color:#CB2431
```
