# zikompo/website_v2 architecture

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

- Interactive diagram: https://gitdiagram.com/zikompo/website_v2
- Repository: https://github.com/zikompo/website_v2

## Overview

##### Project type and purpose
- This is a Next.js-based personal website (portfolio/blog) using the App Router (app/ directory) and MDX for writing posts. It delivers static and semi-dynamic content (SSG/ISR) and lives entirely in the frontend layer—there is no custom backend or microservice.

##### File structure
- Top-level “my-website” folder holds all source.
- app/ contains the Next.js App Router: page.tsx files for each route, layout.tsx for shared wrappers, global CSS.
- app/components + components/ui/ houses reusable React components (cards, dialogs, buttons).
- app/writing and writings/ store MDX content. lib/ contains utility functions (MDX serialization, theme helpers).
- hooks/ for React hooks (e.g., useTheme).
- public/ holds static assets (PDF, images).
- Configuration files: next.config.js/ts, tsconfig.json, postcss.config.mjs, package.json.

##### Elements
- Clear labels for: Browser, CDN/Hosting, Next.js Build, App Router, MDX Compiler, React Components, CSS Processor, Public Assets.
- Build phase data flows: MDX files → MDX Compiler → Static HTML + JS bundles
- Runtime flows: Browser ↔ JS bundles via React hydration; Browser → public assets
- Runtime components (Router, React, Hooks) in another
- Static assets and external hosting as a third

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build-Time Processes
    subgraph "Build-Time Processes"
        MDXCompiler["MDX Compiler\n(lib/mdx.ts + writings/*.mdx)"]:::build
        CSSProcessor["PostCSS Processor\n(app/globals.css)"]:::build
        NextBuild["Next.js Build\n(next.config.js,\ntsconfig.json)"]:::build
    end

    MDXCompiler --> NextBuild
    CSSProcessor --> NextBuild
    NextBuild -->|"Generates"| Bundles["Static HTML & JS Bundles"]:::artifact

    Bundles --> Hosting["CDN / Vercel Hosting"]:::external

    %% Static Assets
    subgraph "Static Assets"
        PublicAssets["public/"]:::static
    end
    PublicAssets --> Hosting

    %% Runtime Interaction
    Browser["User's Browser"]:::client
    Hosting -->|Serves HTML, JS, CSS| Browser
    Browser -->|Navigates Routes| Router["App Router\n(app/)"]:::runtime

    subgraph "Routing & Rendering"
        Router --> Layout["Shared Layout\n(app/layout.tsx)"]:::runtime
        Router --> PageHome["Home Page\n(app/page.tsx)"]:::runtime
        Router --> PageAbout["About Page\n(app/about/page.tsx)"]:::runtime
        Router --> PageExperiences["Experiences Page\n(app/experiences/page.tsx)"]:::runtime
        Router --> PageProjects["Projects Page\n(app/projects/page.tsx)"]:::runtime
        Router --> PageReading["Reading Page\n(app/reading/page.tsx)"]:::runtime
        Router --> PageWritingIndex["Writing Index\n(app/writing/page.tsx)"]:::runtime
        Router --> PageWritingDetail["Writing Detail\n(app/writing/[slug]/page.tsx)"]:::runtime
        PageWritingIndex --> StaticMDX["MDX Example\n(app/writing/welcome.mdx)"]:::static
    end

    subgraph "UI & Components"
        PageHome --> PageUI["Page-specific UI\n(app/components/)"]:::ui
        PageAbout --> PageUI
        PageExperiences --> PageUI
        PageProjects --> PageUI
        PageReading --> PageUI
        PageWritingIndex --> PageUI
        PageWritingDetail --> PageUI

        UIPrimitives["UI Primitives\n(components/ui/)"]:::ui
        PageUI --> UIPrimitives

        Hooks["Theme Hook\n(hooks/useTheme.tsx)"]:::runtime
        PageUI --> Hooks
    end

    %% Legend
    classDef build fill:#f9f,stroke:#333,stroke-width:1px
    classDef runtime fill:#bbf,stroke:#333,stroke-width:1px
    classDef ui fill:#bfb,stroke:#333,stroke-width:1px
    classDef static fill:#ffb,stroke:#333,stroke-width:1px
    classDef artifact fill:#fbf,stroke:#333,stroke-width:1px
    classDef external fill:#ddd,stroke:#333,stroke-width:1px
    classDef client fill:#ffe,stroke:#333,stroke-width:1px

    %% Click Events - Routing Layer
    click Router "https://github.com/zikompo/website_v2/tree/main/my-website/app/"
    click Layout "https://github.com/zikompo/website_v2/blob/main/my-website/app/layout.tsx"
    click PageHome "https://github.com/zikompo/website_v2/blob/main/my-website/app/page.tsx"
    click PageAbout "https://github.com/zikompo/website_v2/blob/main/my-website/app/about/page.tsx"
    click PageExperiences "https://github.com/zikompo/website_v2/blob/main/my-website/app/experiences/page.tsx"
    click PageProjects "https://github.com/zikompo/website_v2/blob/main/my-website/app/projects/page.tsx"
    click PageReading "https://github.com/zikompo/website_v2/blob/main/my-website/app/reading/page.tsx"
    click PageWritingIndex "https://github.com/zikompo/website_v2/blob/main/my-website/app/writing/page.tsx"
    click PageWritingDetail "https://github.com/zikompo/website_v2/blob/main/my-website/app/writing/[slug]/page.tsx"
    click StaticMDX "https://github.com/zikompo/website_v2/blob/main/my-website/app/writing/welcome.mdx"

    %% Click Events - React Components
    click PageUI "https://github.com/zikompo/website_v2/tree/main/my-website/app/components/"
    click UIPrimitives "https://github.com/zikompo/website_v2/tree/main/my-website/components/ui/"

    %% Click Events - Build Tools & Content
    click MDXCompiler "https://github.com/zikompo/website_v2/blob/main/my-website/lib/mdx.ts"
    click CSSProcessor "https://github.com/zikompo/website_v2/blob/main/my-website/app/globals.css"
    click PublicAssets "https://github.com/zikompo/website_v2/tree/main/my-website/public/"

    %% Click Events - Hooks & Utils
    click Hooks "https://github.com/zikompo/website_v2/blob/main/my-website/hooks/useTheme.tsx"
    click NextBuild "https://github.com/zikompo/website_v2/blob/main/my-website/next.config.js"
    click NextBuild "https://github.com/zikompo/website_v2/blob/main/my-website/tsconfig.json"
    click Bundles "https://github.com/zikompo/website_v2/blob/main/my-website/package.json"
    click Bundles "https://github.com/zikompo/website_v2/blob/main/my-website/postcss.config.mjs"
```
