# amoseui/blog architecture

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

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

## Overview

##### Main Components

a. Build-time Components:
- Gatsby Build System
- Content Sources
- Markdown Files (in /content)
- Configuration (content/config.json)
- GraphQL Data Layer
- Static Site Generator

b. Runtime Components:
- React Application
- Theme System
- Component Library
- Routing System

##### Architecture Layers

**┌─────────────────────────────────────────────┐**
- Client Layer                 │
- (Browser-rendered React components)         │
- ┤
- Template Layer                 │
- (Page, Post, Category, Tag templates)       │
- ┤
- Component Layer                │
- (Sidebar, Layout, Feed, Post components)    │
- ┤
- Build Layer                   │
- (Gatsby Node APIs, GraphQL, Static Gen)     │
- ┤
- Content Layer                  │
- (Markdown posts, Pages, Configuration)      │
- ┘

##### Key Elements to Highlight

a. Data Flow:
- How content flows from markdown files through Gatsby's build process
- GraphQL's role in data transformation
- Demonstrate how templates consume data

b. Component Architecture:
- Main components (Layout, Sidebar, Post, Feed)
- Component hierarchy and relationships
- Theme switching mechanism

##### Integration Points

- CI/CD workflow integration (GitHub Actions)
- Test coverage reporting (Codecov)
- Build output path

##### Important Relationships

- Gatsby node APIs → GraphQL schema
- Templates → Components
- Theme system → Component styling
- Content → Build process
- Build output → Static hosting

##### Technical Details

- TypeScript integration
- SCSS modules
- Jest testing setup
- Husky git hooks
- ESLint/Prettier configuration

Remember to highlight the project's emphasis on type safety (TypeScript) and testing (Jest, Codecov) as these are clearly important aspects of the project based on the file structure and configuration files present.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser Runtime"]
        React["React Application"]
        ThemeSystem["Theme System"]:::theme
        Components["Component Library"]:::components
        Router["Routing System"]:::router
    end

    subgraph BuildSystem
        GatsbyBuild["Gatsby Build System"]:::gatsby
        GraphQL["GraphQL Data Layer"]:::graphql
        StaticGen["Static Site Generator"]
    end

    subgraph Templates
        IndexTemplate["Index Template"]:::template
        PostTemplate["Post Template"]:::template
        PageTemplate["Page Template"]:::template
        CategoryTemplate["Category Template"]:::template
    end

    subgraph Content
        MarkdownPosts["Markdown Posts"]:::content
        Pages["Pages"]:::content
        Config["Configuration"]:::content
    end

    subgraph Components
        Layout["Layout Component"]:::component
        Sidebar["Sidebar Component"]:::component
        Post["Post Component"]:::component
        Feed["Feed Component"]:::component
    end

    %% Relationships
    Content --> GatsbyBuild
    GatsbyBuild --> GraphQL
    GraphQL --> Templates
    Templates --> Components
    Components --> React
    ThemeSystem --> Components
    Router --> React
    React --> Browser

    %% Click events
    click GatsbyBuild "https://github.com/amoseui/blog/blob/main/gatsby-config.ts"
    click GraphQL "https://github.com/amoseui/blog/tree/main/internal/gatsby/queries"
    click ThemeSystem "https://github.com/amoseui/blog/tree/main/src/assets/scss/themes"
    click Components "https://github.com/amoseui/blog/tree/main/src/components"
    click Router "https://github.com/amoseui/blog/blob/main/internal/gatsby/constants/routes.ts"
    click IndexTemplate "https://github.com/amoseui/blog/tree/main/src/templates/IndexTemplate"
    click PostTemplate "https://github.com/amoseui/blog/tree/main/src/templates/PostTemplate"
    click PageTemplate "https://github.com/amoseui/blog/tree/main/src/templates/PageTemplate"
    click CategoryTemplate "https://github.com/amoseui/blog/tree/main/src/templates/CategoryTemplate"
    click MarkdownPosts "https://github.com/amoseui/blog/tree/main/content/posts"
    click Pages "https://github.com/amoseui/blog/tree/main/content/pages"
    click Config "https://github.com/amoseui/blog/blob/main/content/config.json"
    click Layout "https://github.com/amoseui/blog/tree/main/src/components/Layout"
    click Sidebar "https://github.com/amoseui/blog/tree/main/src/components/Sidebar"
    click Post "https://github.com/amoseui/blog/tree/main/src/components/Post"
    click Feed "https://github.com/amoseui/blog/tree/main/src/components/Feed"

    %% Styles
    classDef gatsby fill:#1F618D
    classDef graphql fill:#8E44AD
    classDef template fill:#2ECC71
    classDef content fill:#E67E22
    classDef component fill:#3498DB
    classDef theme fill:#9B59B6
    classDef router fill:#E74C3C

    %% Legend
    subgraph Legend
        L1["Gatsby System"]:::gatsby
        L2["GraphQL Layer"]:::graphql
        L3["Templates"]:::template
        L4["Content"]:::content
        L5["Components"]:::component
        L6["Theme System"]:::theme
        L7["Routing"]:::router
    end
```
