# shunshiratori/shirablog architecture

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

- Interactive diagram: https://gitdiagram.com/shunshiratori/shirablog
- Repository: https://github.com/shunshiratori/shirablog

## Overview

##### Project type and purpose
- This is a full-stack, content-driven Next.js application (a blog/docs site) generated with Create Fumadocs.
- It uses file-based routing (under src/app), MDX files in the content directory, and a serverless API route (src/app/api/search/route.ts) for search functionality.

##### File structure
- **Top-level files**: next.config.mjs, tsconfig.json, postcss.config.mjs, next-sitemap.config.js, package.json – indicate a Next.js/TypeScript setup with CSS processing and sitemap generation.
- **content/**: MDX files → source of static blog pages.
- **src/app/**: Next.js 13+ App Router:
- (home) layout and page.tsx for root and blog indexes
- dynamic route [slug] for individual posts
- api/search/route.ts as a serverless function
- **src/components/**: shared UI (header, footer, menu, pagination).
- **src/lib/source.ts**: likely loads/parses MDX.
- **public/**: static assets, favicon, etc.

##### README
- Confirms Next.js + Fumadocs usage, how to run dev server, and links to Next.js/Fumadocs docs.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client"
        Browser["Browser"]:::client
    end

    %% CDN / Static Asset Host
    CDN["CDN / Static Asset Host"]:::static

    %% Server Side Components
    subgraph "Next.js App Server"
        HomeLayout["Home Layout"]:::service
        HomePage["Home Page"]:::service
        HomeBlogDynamic["Blog Catch-all Page"]:::service
        BlogLayout["Blog Layout"]:::service
        BlogSlugPage["Blog Post Page"]:::service
        API["Search API (serverless)"]:::service
        MDXParser["MDX Parser & Fumadocs Engine"]:::service
        ContentStore["Content Store (MDX files)"]:::db
    end

    %% Build-time Components
    subgraph "Build Pipeline"
        Build["Build Pipeline (TS, PostCSS, Node.js)"]:::build
        Sitemap["Sitemap Generator"]:::build
    end

    %% Client interactions
    Browser -->|Requests static assets| CDN
    CDN -->|Serves JS/CSS/Assets| Browser
    Browser -->|Page request| HomePage
    Browser -->|Page request| HomeBlogDynamic
    Browser -->|Page request| BlogSlugPage
    Browser -->|Search API call| API

    %% Server rendering flows
    HomePage -->|uses MDXParser| MDXParser
    HomeBlogDynamic -->|uses MDXParser| MDXParser
    BlogLayout -->|wraps pages| BlogSlugPage
    BlogSlugPage -->|uses MDXParser| MDXParser
    API -->|queries content| MDXParser
    MDXParser -->|reads files| ContentStore

    %% Build pipeline flows
    Build -->|outputs static pages & assets| CDN
    Build -->|deploys serverless functions| HomePage
    Build -->|deploys serverless functions| API
    Sitemap -->|generates sitemap.xml| CDN
    Sitemap -->|scans routes| HomePage

    %% Click Events
    click ContentStore "https://github.com/shunshiratori/shirablog/tree/main/content/"
    click MDXParser "https://github.com/shunshiratori/shirablog/blob/main/src/lib/source.ts"
    click API "https://github.com/shunshiratori/shirablog/blob/main/src/app/api/search/route.ts"
    click HomeLayout "https://github.com/shunshiratori/shirablog/blob/main/src/app/(home)/layout.tsx"
    click HomePage "https://github.com/shunshiratori/shirablog/blob/main/src/app/(home)/page.tsx"
    click HomeBlogDynamic "https://github.com/shunshiratori/shirablog/blob/main/src/app/(home)/blog/[[...slug]]/page.tsx"
    click BlogLayout "https://github.com/shunshiratori/shirablog/blob/main/src/app/blog/layout.tsx"
    click BlogSlugPage "https://github.com/shunshiratori/shirablog/blob/main/src/app/blog/[slug]/page.tsx"
    click Package "https://github.com/shunshiratori/shirablog/blob/main/package.json"
    click NextConfig "https://github.com/shunshiratori/shirablog/blob/main/next.config.mjs"
    click TSConfig "https://github.com/shunshiratori/shirablog/blob/main/tsconfig.json"
    click PostCSS "https://github.com/shunshiratori/shirablog/blob/main/postcss.config.mjs"
    click SitemapConfig "https://github.com/shunshiratori/shirablog/blob/main/next-sitemap.config.js"
    click Components "https://github.com/shunshiratori/shirablog/tree/main/src/components/"
    click Header "https://github.com/shunshiratori/shirablog/blob/main/src/components/header.tsx"
    click Footer "https://github.com/shunshiratori/shirablog/blob/main/src/components/footer.tsx"
    click Menu "https://github.com/shunshiratori/shirablog/blob/main/src/components/menu.tsx"
    click Navbar "https://github.com/shunshiratori/shirablog/blob/main/src/components/navbar.tsx"
    click Pagination "https://github.com/shunshiratori/shirablog/blob/main/src/components/pagination.tsx"
    click DocsComp "https://github.com/shunshiratori/shirablog/blob/main/src/components/docs.tsx"
    click Public "https://github.com/shunshiratori/shirablog/tree/main/public/"
    click GlobalStyles "https://github.com/shunshiratori/shirablog/blob/main/src/app/global.css"
    click LayoutConfig "https://github.com/shunshiratori/shirablog/blob/main/src/app/layout.config.tsx"
    click SourceConfig "https://github.com/shunshiratori/shirablog/blob/main/source.config.ts"

    %% Styling
    classDef client fill:#B3E5FC,stroke:#0277BD,color:#000
    classDef static fill:#C8E6C9,stroke:#2E7D32,color:#000
    classDef service fill:#FFF9C4,stroke:#F9A825,color:#000
    classDef db fill:#FFCDD2,stroke:#C62828,color:#000
    classDef build fill:#D1C4E9,stroke:#6A1B9A,color:#000
```
