# hexwars/hexw architecture

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

- Interactive diagram: https://gitdiagram.com/hexwars/hexw
- Repository: https://github.com/hexwars/hexw

## Overview

##### Main System Components

a) Client Layer
- Browser/client interface
- Dark mode toggle functionality
- RSS feed consumer

b) Frontend Application Layer
- Astro Pages (Dynamic & Static)
- React Components
- TailwindCSS Styling
- Content Layer

c) Build & Generation Layer
- Static Site Generation
- Content Processing
- Asset Pipeline

##### Component Organization

Create distinct sections showing:

a) Core Framework Components:
- Root Layout System
- BaseLayout
- PostLayout
- SimpleLayout
- RootLayout

b) Feature Components:
- Navigation System
- Content Components
- UI Components (Shadcn)
- Social Integration

c) Content Management:
- Markdown Processing
- Content Collections
- Tag/Category System

##### Data Flow Representation

- Content flow from markdown files to rendered pages
- Static asset delivery
- Dark mode state management
- RSS feed generation
- Dynamic routing paths

##### Specific Implementation Details

Technical elements:
- Astro's hybrid rendering strategy
- React islands for interactive components
- TailwindCSS styling system
- Content collection configuration

**┌─ Runtime Layer ─────────────────┐**
- Browser                       │
- Client-side JavaScript        │
- TailwindCSS                   │
- ┘

**┌─ Page Layer ──────────────────┐**
- Dynamic Routes              │
- Static Pages               │
- MDX Processing             │
- ┘

**┌─ Component Layer ─────────────┐**
- Astro Components           │
- React Components           │
- UI Library                 │
- ┘

**┌─ Content Layer ───────────────┐**
- Markdown Files             │
- Content Collections        │
- Assets                     │
- ┘

##### Integration Points

Key integration points:
- Shadcn UI component library
- TailwindCSS configuration
- RSS feed generation
- Social media integration
- Content collection API

Remember to:
- Use consistent styling
- Brief annotations for complex interactions
- Both build-time and runtime processes

This structure will provide a clear understanding of how the blog theme works, from content creation to final rendering, while highlighting the key technical decisions and architectural patterns used in the project.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser/Client"]
        DarkMode["Dark Mode Toggle"]:::react
        RSS["RSS Feed Consumer"]
    end

    subgraph "Frontend Application"
        subgraph "Page Components"
            DynamicRoutes["Dynamic Routes"]
            StaticPages["Static Pages"]
            TagPages["Tag Pages"]:::astro
            CategoryPages["Category Pages"]:::astro
        end

        subgraph "Layout System"
            BaseLayout["Base Layout"]:::astro
            PostLayout["Post Layout"]:::astro
            SimpleLayout["Simple Layout"]:::astro
            RootLayout["Root Layout"]:::astro
        end

        subgraph "Core Components"
            Navigation["Navigation Menu"]:::react
            SocialIcons["Social Icons"]:::react
            ArticleItem["Article Item"]:::astro
            Comments["Comments"]:::astro
            TagList["Tag List"]:::astro
            TagItem["Tag Item"]:::astro
        end

        subgraph "UI Components"
            Button["Button"]:::react
            Badge["Badge"]:::react
            Card["Card"]:::react
            Separator["Separator"]:::react
        end
    end

    subgraph "Content Management"
        MarkdownFiles["Markdown Files"]
        ContentConfig["Content Config"]
        Types["Type Definitions"]
        Collections["Content Collections"]
    end

    subgraph "Build System"
        SSG["Static Site Generation"]
        AssetPipeline["Asset Pipeline"]
        StyleSystem["Styling System"]
        RSSGen["RSS Generator"]
    end

    Browser --> DarkMode
    DarkMode --> StateStore["State Store"]:::react

    MarkdownFiles --> Collections
    Collections --> DynamicRoutes
    ContentConfig --> Collections
    Types --> ContentConfig

    BaseLayout --> RootLayout
    PostLayout --> RootLayout
    SimpleLayout --> RootLayout

    DynamicRoutes --> ArticleItem
    TagPages --> TagList
    TagList --> TagItem

    StyleSystem --> Browser
    RSSGen --> RSS

    %% Click Events
    click BaseLayout "https://github.com/hexWars/hexw/blob/develop/src/layouts/BaseLayout.astro"
    click PostLayout "https://github.com/hexWars/hexw/blob/develop/src/layouts/PostLayout.astro"
    click SimpleLayout "https://github.com/hexWars/hexw/blob/develop/src/layouts/SimpleLayout.astro"
    click RootLayout "https://github.com/hexWars/hexw/blob/develop/src/layouts/RootLayout.astro"
    click DarkMode "https://github.com/hexWars/hexw/blob/develop/src/components/ModeToggle.tsx"
    click StateStore "https://github.com/hexWars/hexw/blob/develop/src/store.ts"
    click Navigation "https://github.com/hexWars/hexw/blob/develop/src/components/NavigationMenu.tsx"
    click ContentConfig "https://github.com/hexWars/hexw/blob/develop/src/content/config.ts"
    click MarkdownFiles "https://github.com/hexWars/hexw/tree/develop/src/content/posts"
    click Types "https://github.com/hexWars/hexw/blob/develop/src/types.ts"
    click SocialIcons "https://github.com/hexWars/hexw/blob/develop/src/components/SocialIcons.tsx"
    click RSSGen "https://github.com/hexWars/hexw/blob/develop/src/pages/rss.xml.js"
    click TagPages "https://github.com/hexWars/hexw/blob/develop/src/pages/tag/[tag].astro"
    click CategoryPages "https://github.com/hexWars/hexw/blob/develop/src/pages/category/[category].astro"
    click TagItem "https://github.com/hexWars/hexw/blob/develop/src/components/TagItem.astro"
    click TagList "https://github.com/hexWars/hexw/blob/develop/src/components/TagList.astro"
    click ArticleItem "https://github.com/hexWars/hexw/blob/develop/src/components/ArticleItem.astro"
    click Comments "https://github.com/hexWars/hexw/blob/develop/src/components/Comments.astro"
    click Button "https://github.com/hexWars/hexw/blob/develop/src/components/ui/button.tsx"
    click Badge "https://github.com/hexWars/hexw/blob/develop/src/components/ui/badge.tsx"
    click Card "https://github.com/hexWars/hexw/blob/develop/src/components/ui/card.tsx"
    click Separator "https://github.com/hexWars/hexw/blob/develop/src/components/ui/separator.tsx"
    click StyleSystem "https://github.com/hexWars/hexw/blob/develop/src/styles/globals.css"
    click Collections "https://github.com/hexWars/hexw/blob/develop/src/content/posts/*.md"

    %% Styling
    classDef react fill:#61DAFB,stroke:#333,stroke-width:2px
    classDef astro fill:#FF5D01,stroke:#333,stroke-width:2px
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        React["React Component"]:::react
        Astro["Astro Component"]:::astro
        Static["Static Component"]
    end
```
