# steveruizok/personal-blog architecture

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

- Interactive diagram: https://gitdiagram.com/steveruizok/personal-blog
- Repository: https://github.com/steveruizok/personal-blog

## Overview

##### Main Components

A. Frontend Layer
- Next.js Pages (Static & Dynamic Routes)
- React Components
- MDX Content System
- Styling System (Stitches)

B. Build & Static Generation Layer
- Next.js Static Site Generation
- Content Generation System
- Asset Processing

C. Content Management Layer
- MDX Files
- Static Assets (images/videos)
- Content JSON

D. Infrastructure Layer
- Vercel Deployment
- API Routes

**┌─ Client Layer ─────────────────────┐**
- Browser                          │
- Client-side Navigation           │
- Client-side React Hydration      │
- ┬───────────────────┘
- ↓
**┌─ Frontend Layer ───────────────────┐**
- ┌─ Pages ─────┐ ┌─ Components ─┐   │
- _app.tsx  │ │ - Layout     │   │
- index.tsx │ │ - MDX        │   │
- [slug].tsx│ │ - UI Elements│   │
- ┘ └─────────────┘    │
- ┌─ Hooks ─────┐ ┌─ Styles ────┐   │
- useGtag   │ │ - Stitches  │   │
- useScroll │ │ - Global CSS │   │
- ┘ └─────────────┘    │
- ┬───────────────────┘
- ↓
**┌─ Build Layer ────────────────────┐**
- Next.js Static Generation      │
- Content Generation Script      │
- MDX Processing                 │
- ┬─────────────────┘
- ↓
**┌─ Content Layer ──────────────────┐**
- ┌─ MDX ───────┐ ┌─ Assets ────┐  │
- Posts     │ │ - Images    │  │
- Pages     │ │ - Videos    │  │
- ┘ └────────────┘   │
- ┬─────────────────┘
- ↓
**┌─ Infrastructure ────────────────┐**
- Vercel Hosting               │
- API Routes                   │
- CDN (Static Assets)          │
- ┘

##### Important Relationships to Highlight

- How the content generation script (scripts/generate-content.ts) processes MDX files into content.json
- Relationship between pages and their corresponding MDX content
- Demonstrate how components are composed within the layout system
- Build-time vs. runtime processes

##### Additional Elements

- Annotations for key architectural decisions
- Development vs. production flow
- Where client-side interactivity occurs

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Browser"]:::client
        CSN["Client-side Navigation"]:::client
        CSH["Client-side React Hydration"]:::client
        Browser --> CSN
        CSN --> CSH
    end

    subgraph Frontend
        Pages["Pages"]:::frontend
        Components["Components"]:::frontend
        Hooks["Hooks"]:::frontend
        Styles["Styling System"]:::frontend

        subgraph PagesDetail["Pages Detail"]
            App["_app.tsx"]:::frontend
            Index["index.tsx"]:::frontend
            Slug["[slug].tsx"]:::frontend
            About["about.tsx"]:::frontend
            Archive["archive.tsx"]:::frontend
        end

        subgraph ComponentsDetail["Components Detail"]
            Layout["Layout Components"]:::frontend
            MDXComponents["MDX Components"]:::frontend
            UIElements["UI Elements"]:::frontend
        end

        subgraph HooksDetail["Hooks Detail"]
            UseGtag["useGtag"]:::frontend
            UseScroll["useScrollPosition"]:::frontend
        end

        subgraph StylesDetail["Styles Detail"]
            Stitches["Stitches Config"]:::frontend
            GlobalCSS["Global CSS"]:::frontend
        end
    end

    subgraph Build
        SSG["Next.js Static Generation"]:::build
        ContentGen["Content Generation Script"]:::build
        MDXProcess["MDX Processing"]:::build
    end

    subgraph Content
        MDXFiles["MDX Files"]:::content
        Assets["Static Assets"]:::content
        ContentJSON["content.json"]:::content

        subgraph MDXDetail["MDX Detail"]
            Posts["Posts"]:::content
            Pages["Pages"]:::content
        end

        subgraph AssetsDetail["Assets Detail"]
            Images["Images"]:::content
            Videos["Videos"]:::content
        end
    end

    subgraph Infrastructure
        Vercel["Vercel Hosting"]:::infra
        API["API Routes"]:::infra
        CDN["CDN"]:::infra
    end

    Client --> Frontend
    Frontend --> Build
    Build --> Content
    Content --> Infrastructure

    %% Click Events
    click App "https://github.com/steveruizok/personal-blog/blob/master/pages/_app.tsx"
    click Index "https://github.com/steveruizok/personal-blog/blob/master/pages/index.tsx"
    click Slug "https://github.com/steveruizok/personal-blog/blob/master/pages/posts/[slug].tsx"
    click About "https://github.com/steveruizok/personal-blog/blob/master/pages/about.tsx"
    click Archive "https://github.com/steveruizok/personal-blog/blob/master/pages/archive.tsx"
    click Layout "https://github.com/steveruizok/personal-blog/blob/master/components/layout/layout.tsx"
    click MDXComponents "https://github.com/steveruizok/personal-blog/blob/master/components/mdx-components/index.ts"
    click UseGtag "https://github.com/steveruizok/personal-blog/blob/master/hooks/useGtag.tsx"
    click UseScroll "https://github.com/steveruizok/personal-blog/blob/master/hooks/useScrollPosition.tsx"
    click Stitches "https://github.com/steveruizok/personal-blog/blob/master/stitches.config.ts"
    click GlobalCSS "https://github.com/steveruizok/personal-blog/blob/master/styles/globals.css"
    click Posts "https://github.com/steveruizok/personal-blog/tree/master/content/posts"
    click Pages "https://github.com/steveruizok/personal-blog/tree/master/content/pages"
    click Images "https://github.com/steveruizok/personal-blog/tree/master/public/images"
    click Videos "https://github.com/steveruizok/personal-blog/tree/master/public/video"
    click ContentGen "https://github.com/steveruizok/personal-blog/blob/master/scripts/generate-content.ts"
    click ContentJSON "https://github.com/steveruizok/personal-blog/blob/master/content/content.json"
    click API "https://github.com/steveruizok/personal-blog/blob/master/pages/api/hello.ts"

    %% Styling
    classDef client fill:#2196F3,stroke:#1565C0,color:white
    classDef frontend fill:#42A5F5,stroke:#1E88E5,color:white
    classDef build fill:#4CAF50,stroke:#388E3C,color:white
    classDef content fill:#FFC107,stroke:#FFA000,color:black
    classDef infra fill:#9E9E9E,stroke:#757575,color:white

    %% Legend
    subgraph Legend
        Client_L["Client Layer"]:::client
        Frontend_L["Frontend Layer"]:::frontend
        Build_L["Build Layer"]:::build
        Content_L["Content Layer"]:::content
        Infra_L["Infrastructure Layer"]:::infra
    end
```
