# iamvisshu/github-blog architecture

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

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

## Overview

##### Project Type & Purpose
- This is a Jamstack‐style static blog application built with Next.js.
- Purpose: Read Markdown files from `/posts`, parse front‐matter metadata, generate SEO‐friendly static pages (posts, tags, about, index) and deploy them (e.g., on Vercel).

##### Key Components
a. Content Layer
- `/posts` directory (Markdown files + front‐matter)
- `public/images` for post assets
b. Build & Deployment
- Next.js build step (`npm run build`)
- Markdown parser (e.g. remark) invoked in `getStaticProps` / `getStaticPaths`
- Vercel CI/CD pipeline (GitHub → Vercel → build → CDN)
c. Presentation Layer
- React components in `/components` (Header, Footer, Layout)
- Page entrypoints in `/pages` (index, about, posts/[slug], tags/[tag], etc.)
- Styling via Tailwind CSS (configured in `tailwind.config.js`, imported in `globals.css`)
d. Runtime Layer
- Browser loads pre-rendered HTML/CSS/JS from CDN
- Client‐side interactivity: theme switcher, tag filtering, search

##### Relationships & Data Flow
1. Developer pushes Markdown + code to GitHub
2. Vercel picks up changes → runs Next.js build
3. Next.js:
- Reads `/posts/*.md`
- Parses front‐matter & Markdown → HTML
- Runs `getStaticPaths` / `getStaticProps` in `/pages`
- Bundles React components + styles
- Emits static HTML, CSS, JS assets
4. Assets deployed to CDN
5. Browser requests pages → CDN serves static files → React hydrates for client features

##### Architectural Patterns & Principles
- Jamstack (pre-rendering + CDN delivery)
- SSG (Static Site Generation) with Next.js
- Component-based UI (React)
- File-system routing (Next.js pages folder)
- Separation of concerns:
- Content (Markdown)
- Build logic (Next.js + parsing)
- Presentation (components + styles)
- Deployment (Vercel CDN)

##### Essential Details to Capture
- File‐system routing: how `pages/posts/[slug].js` and `pages/tags/[tag].js` generate dynamic paths.
- Front‐matter → data model for each page (title, date, tags, summary, cover).
- Theme switcher & client‐side filtering as small client interactivity layer.
- Configuration files (`next.config.js`, `tailwind.config.js`, `postcss.config.js`) that drive build/tools.

##### Final Advice
- Component boundaries (data, build, UI, infra).
- Don’t overengineer—this is a static site, so the architecture is simple: content → build → deploy → serve.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Infrastructure
    subgraph "Infrastructure"
        GitHub["GitHub Repository"]:::infra
        Vercel["Vercel CI/CD"]:::infra
        CDN["CDN (Static Assets)"]:::infra
    end

    %% Content Layer
    subgraph "Content Layer"
        posts["Markdown Posts (/posts)"]:::content
        images["Post Assets (public/images)"]:::content
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        NextBuild["Next.js Build\nnpm run build"]:::code
        nextConfig["next.config.js"]:::code
        postcssConfig["postcss.config.js"]:::code
        pkg["package.json"]:::code
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        pagesApp["Custom App (pages/_app.js)"]:::code
        layout["Layout (components/Layout.js)"]:::code
        header["Header (components/Header.js)"]:::code
        footer["Footer (components/Footer.js)"]:::code
        indexPage["Home (pages/index.js)"]:::code
        aboutPage["About (pages/about.js)"]:::code
        slugPage["Post Page (pages/posts/[slug].js)"]:::code
        tagsList["Tags Listing (pages/tags.js)"]:::code
        tagPage["Tag Page (pages/tags/[tag].js)"]:::code
        globalsCSS["Global Styles (styles/globals.css)"]:::code
        tailwindConfig["tailwind.config.js"]:::code
    end

    %% Runtime Layer
    subgraph "Runtime Layer"
        Browser["Browser (Client)"]:::runtime
    end

    %% Connections: Infra Pipeline
    GitHub -->|push code| Vercel
    Vercel -->|triggers build| NextBuild
    NextBuild -->|deploy assets| CDN
    CDN -->|serves assets| Browser

    %% Connections: Content to Build
    posts -->|reads Markdown| NextBuild
    images -->|includes assets| NextBuild

    %% Build Tooling to Build
    nextConfig --> NextBuild
    postcssConfig --> NextBuild
    pkg --> NextBuild

    %% Presentation Modules to Build
    pagesApp --> NextBuild
    layout --> NextBuild
    header --> NextBuild
    footer --> NextBuild
    indexPage --> NextBuild
    aboutPage --> NextBuild
    slugPage --> NextBuild
    tagsList --> NextBuild
    tagPage --> NextBuild
    globalsCSS --> NextBuild
    tailwindConfig --> NextBuild

    %% Runtime
    Browser -->|React hydration| layout

    %% Click Events
    click posts "https://github.com/iamvisshu/github-blog/tree/main/posts/"
    click images "https://github.com/iamvisshu/github-blog/tree/main/public/images/"
    click slugPage "https://github.com/iamvisshu/github-blog/blob/main/pages/posts/[slug].js"
    click tagsList "https://github.com/iamvisshu/github-blog/blob/main/pages/tags.js"
    click tagPage "https://github.com/iamvisshu/github-blog/blob/main/pages/tags/[tag].js"
    click layout "https://github.com/iamvisshu/github-blog/blob/main/components/Layout.js"
    click header "https://github.com/iamvisshu/github-blog/blob/main/components/Header.js"
    click footer "https://github.com/iamvisshu/github-blog/blob/main/components/Footer.js"
    click indexPage "https://github.com/iamvisshu/github-blog/blob/main/pages/index.js"
    click aboutPage "https://github.com/iamvisshu/github-blog/blob/main/pages/about.js"
    click pagesApp "https://github.com/iamvisshu/github-blog/blob/main/pages/_app.js"
    click globalsCSS "https://github.com/iamvisshu/github-blog/blob/main/styles/globals.css"
    click tailwindConfig "https://github.com/iamvisshu/github-blog/blob/main/tailwind.config.js"
    click postcssConfig "https://github.com/iamvisshu/github-blog/blob/main/postcss.config.js"
    click nextConfig "https://github.com/iamvisshu/github-blog/blob/main/next.config.js"
    click pkg "https://github.com/iamvisshu/github-blog/blob/main/package.json"

    %% Styles
    classDef infra fill:#F5A623,stroke:#E67E22,color:#000
    classDef content fill:#7ED321,stroke:#417505,color:#000
    classDef code fill:#4A90E2,stroke:#357ABD,color:#FFF
    classDef runtime fill:#BD10E0,stroke:#9013FE,color:#FFF
```
