# ximpley/muchtrans architecture

> Architecture diagram of the GitHub repository ximpley/muchtrans, 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/ximpley/muchtrans
- Repository: https://github.com/ximpley/muchtrans

## Overview

##### Main System Components

a) Static Site Generator Component
- Input Processing: Show how articles in markdown format (*.md and *.ko.md) are processed
- Template Engine: Illustrate how templates (from /templates directory) are used
- Build System: Show the build process (build.py) that generates the static site

b) Development Server Component
- Dev.py server component that serves the site locally

c) Deployment Component
- Netlify integration for automated builds and hosting

##### Data Flow and Structure

- Content Flow: From source markdown files to generated HTML
- Build Process Flow: From build.py to _build directory
- Deployment Flow: From repository to Netlify

##### Specific Elements

- Blue rectangles: Source content (articles directory)
- Green rectangles: Templates (templates directory)
- Orange rectangles: Build system components
- Purple rectangles: Output (_build directory)
- Gray rectangles: External services (Netlify)

**[Source Layer]**
**Articles (*.md, *.ko.md) → Templates**

**[Processing Layer]**
**Build System (build.py) → Development Server (dev.py)**

**[Output Layer]**
**Static Site (_build directory)**

**[Deployment Layer]**
**Netlify Hosting**

##### Important Details to Highlight

- Bilingual Content Management: Show how original and translated content (*.md and *.ko.md) are paired
- Template Processing: Illustrate how templates (base.html, article.html, etc.) are applied
- Static Asset Management: Show how CSS and images are processed
- Feed Generation: Include the feed.xml generation process

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Source
        Articles[Articles]:::source
        Templates[Templates]:::source
        Articles --> |Content| Build
        Templates --> |Layout| Build
    end

    subgraph Processing
        Build[Build System]:::process
        DevServer[Development Server]:::process
        Build --> DevServer
    end

    subgraph Output
        StaticSite["Static Site"]:::output
        Build --> StaticSite
    end

    subgraph Deployment
        Netlify[Netlify Hosting]:::deploy
        StaticSite --> Netlify
    end

    subgraph Content["Content Management"]
        OriginalMD["Original (*.md)"]:::content
        TranslatedMD["Translated (*.ko.md)"]:::content
        OriginalMD --> Articles
        TranslatedMD --> Articles
    end

    subgraph TemplateSystem["Template System"]
        BaseTemplate["Base Template"]:::template
        ArticleTemplate["Article Template"]:::template
        FeedTemplate["Feed Template"]:::template
        CommentsTemplate["Comments Integration"]:::template
        AnalyticsTemplate["Analytics Integration"]:::template
        
        BaseTemplate --> Templates
        ArticleTemplate --> Templates
        FeedTemplate --> Templates
        CommentsTemplate --> Templates
        AnalyticsTemplate --> Templates
    end

    subgraph BuildOutput["Build Output Structure"]
        CSS["CSS Assets"]:::assets
        Images["Images"]:::assets
        ArticleAssets["Article Assets"]:::assets
        Feeds["Generated Feeds"]:::output
        TranslationOutput["Generated Translations"]:::output
        
        StaticSite --> CSS
        StaticSite --> Images
        StaticSite --> ArticleAssets
        StaticSite --> Feeds
        StaticSite --> TranslationOutput
    end

    %% Click Events
    click Build "https://github.com/ximpley/muchtrans/blob/master/build.py"
    click DevServer "https://github.com/ximpley/muchtrans/blob/master/dev.py"
    click BaseTemplate "https://github.com/ximpley/muchtrans/blob/master/templates/base.html"
    click ArticleTemplate "https://github.com/ximpley/muchtrans/blob/master/templates/article.html"
    click FeedTemplate "https://github.com/ximpley/muchtrans/blob/master/templates/feed.xml"
    click CommentsTemplate "https://github.com/ximpley/muchtrans/blob/master/templates/utterances.html"
    click AnalyticsTemplate "https://github.com/ximpley/muchtrans/blob/master/templates/gtag.html"
    click Articles "https://github.com/ximpley/muchtrans/tree/master/articles/"
    click TranslatedMD "https://github.com/ximpley/muchtrans/blob/master/articles/*.ko.md"
    click OriginalMD "https://github.com/ximpley/muchtrans/blob/master/articles/*.md"
    click CSS "https://github.com/ximpley/muchtrans/tree/master/_build/static/css"
    click Images "https://github.com/ximpley/muchtrans/tree/master/_build/static/images"
    click ArticleAssets "https://github.com/ximpley/muchtrans/tree/master/_build/static/articles/"
    click StaticSite "https://github.com/ximpley/muchtrans/tree/master/_build"
    click Feeds "https://github.com/ximpley/muchtrans/tree/master/_build/feeds"
    click TranslationOutput "https://github.com/ximpley/muchtrans/tree/master/_build/translations"

    %% Styles
    classDef source fill:#3498db,stroke:#2980b9,color:white
    classDef process fill:#e67e22,stroke:#d35400,color:white
    classDef output fill:#9b59b6,stroke:#8e44ad,color:white
    classDef deploy fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef content fill:#2ecc71,stroke:#27ae60,color:white
    classDef template fill:#f1c40f,stroke:#f39c12,color:white
    classDef assets fill:#1abc9c,stroke:#16a085,color:white
```
