# quinnkeast/quinnkeast-website architecture

> Architecture diagram of the GitHub repository quinnkeast/quinnkeast-website, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quinnkeast/quinnkeast-website
- Repository: https://github.com/quinnkeast/quinnkeast-website

## Overview

##### Project Type Analysis
This is a modern JAMstack personal website/blog with the following characteristics:
- Static site generation capabilities through Next.js
- Content management through MDX files
- Frontend-focused architecture
- API routes for basic functionality

##### Main Components

A. Static Site Generation Layer:
- MDX Content Sources (_posts, _books, _talks, _favourites directories)
- Build-time Processing (fetch-mdx-files.mjs, lib/mdxToHtml.js)
- Static Page Generation

B. Frontend Application Layer:
- Page Components (pages directory)
- Reusable Components (components directory)
- Styling (Tailwind CSS, styles directory)

C. Dynamic Features:
- API Routes (pages/api directory)
- Authentication System (login/logout endpoints)
- User Session Management (lib/useUser.js, lib/session.js)

D. Asset Management:
- Static Assets (public directory)
- Fonts
- Media Files

- [Content Layer (MDX Files)] → [Build Process] → [Static Assets]
- ↓
- [Client Browser] ← [Next.js Server] ← [Static Pages/Assets]
- ↕
- [API Routes]

##### Key Elements to Emphasize

- Content Pipeline:
- MDX processing flow
- Static site generation process
- Asset optimization and delivery

- Application Architecture:
- Next.js page router structure
- Component hierarchy
- API route integration

- Performance Considerations:
- Static generation benefits
- Client-side navigation
- Asset optimization

##### Implementation Details

- Build Process:
- [MDX Files] → [MDX Processing] → [HTML Generation] → [Static Pages]

- Request Flow:
- [Browser] → [Static Pages] → [Client-side Navigation]
- ↘ [API Routes] → [Authentication/Session]

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Content
        MDX[("MDX Content")]
        Posts["Blog Posts"]:::content
        Books["Books"]:::content
        Talks["Talks"]:::content
        Favs["Favourites"]:::content
        
        MDX --> Posts
        MDX --> Books
        MDX --> Talks
        MDX --> Favs
    end

    subgraph "Build Process"
        Fetcher["Content Fetcher"]:::build
        MDXProc["MDX Processor"]:::build
        MarkProc["Markdown Processor"]:::build
        
        MDX --> Fetcher
        Fetcher --> MDXProc
        Fetcher --> MarkProc
    end

    subgraph "Frontend Application"
        Pages["Page Components"]:::frontend
        Components["Reusable Components"]:::frontend
        Layout["Layout Component"]:::frontend
        PostComps["Post Components"]:::frontend
        
        Components --> Layout
        Components --> PostComps
    end

    subgraph "Styling Layer"
        Styles["Global Styles"]:::styling
        Tailwind["Tailwind Config"]:::styling
        Syntax["Syntax Highlighting"]:::styling
    end

    subgraph "Dynamic Features"
        API["API Routes"]:::api
        Auth["Authentication"]:::api
        Session["Session Management"]:::api
        
        API --> Auth
        API --> Session
    end

    subgraph "Asset Management"
        Assets["Static Assets"]:::assets
        Fonts["Font Files"]:::assets
        ProjectMedia["Project Media"]:::assets
        WritingAssets["Writing Assets"]:::assets
    end

    subgraph "Core Application"
        AppEntry["App Entry"]:::core
        MainRoutes["Main Routes"]:::core
        APIUtils["API Utilities"]:::core
        
        AppEntry --> MainRoutes
        AppEntry --> APIUtils
    end

    BuildProcess["Static Site Generation"]
    MDXProc & MarkProc --> BuildProcess
    BuildProcess --> Pages
    
    Pages --> Layout
    Styles & Tailwind --> Components
    API --> Session

    %% Click Events
    click Posts "https://github.com/quinnkeast/quinnkeast-website/tree/main//_posts"
    click Books "https://github.com/quinnkeast/quinnkeast-website/tree/main//_books"
    click Talks "https://github.com/quinnkeast/quinnkeast-website/tree/main//_talks"
    click Favs "https://github.com/quinnkeast/quinnkeast-website/tree/main//_favourites"
    click MDXProc "https://github.com/quinnkeast/quinnkeast-website/blob/main//lib/mdxToHtml.js"
    click MarkProc "https://github.com/quinnkeast/quinnkeast-website/blob/main//lib/markdownToHtml.js"
    click Fetcher "https://github.com/quinnkeast/quinnkeast-website/blob/main//fetch-mdx-files.mjs"
    click Pages "https://github.com/quinnkeast/quinnkeast-website/tree/main//pages"
    click Components "https://github.com/quinnkeast/quinnkeast-website/tree/main//components"
    click Layout "https://github.com/quinnkeast/quinnkeast-website/blob/main//components/layout.js"
    click PostComps "https://github.com/quinnkeast/quinnkeast-website/blob/main//components/post-body.js"
    click Styles "https://github.com/quinnkeast/quinnkeast-website/blob/main//styles/globals.css"
    click Tailwind "https://github.com/quinnkeast/quinnkeast-website/blob/main//tailwind.config.js"
    click Syntax "https://github.com/quinnkeast/quinnkeast-website/blob/main//styles/github-dark.css"
    click API "https://github.com/quinnkeast/quinnkeast-website/tree/main//pages/api"
    click Auth "https://github.com/quinnkeast/quinnkeast-website/blob/main//pages/api/login.js"
    click Session "https://github.com/quinnkeast/quinnkeast-website/blob/main//lib/session.js"
    click Assets "https://github.com/quinnkeast/quinnkeast-website/tree/main//public/assets"
    click Fonts "https://github.com/quinnkeast/quinnkeast-website/tree/main//public/fonts"
    click ProjectMedia "https://github.com/quinnkeast/quinnkeast-website/tree/main//public/assets/projects"
    click WritingAssets "https://github.com/quinnkeast/quinnkeast-website/tree/main//public/assets/writing"
    click AppEntry "https://github.com/quinnkeast/quinnkeast-website/blob/main//pages/_app.js"
    click MainRoutes "https://github.com/quinnkeast/quinnkeast-website/blob/main//pages/index.js"
    click APIUtils "https://github.com/quinnkeast/quinnkeast-website/blob/main//lib/api.js"

    %% Styling Classes
    classDef content fill:#e1eaff,stroke:#333
    classDef build fill:#ffecb3,stroke:#333
    classDef frontend fill:#b2dfdb,stroke:#333
    classDef styling fill:#f8bbd0,stroke:#333
    classDef api fill:#ffccbc,stroke:#333
    classDef assets fill:#d1c4e9,stroke:#333
    classDef core fill:#c8e6c9,stroke:#333
```
