# rochacbruno/marmite architecture

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

- Interactive diagram: https://gitdiagram.com/rochacbruno/marmite
- Repository: https://github.com/rochacbruno/marmite

## Overview

##### Main Components Identification

The system should be represented with these primary components:

a) Input Processing Layer
- Content Reader (markdown files)
- Configuration Parser (marmite.yaml)
- Static Assets Handler (static/, media/)

b) Core Processing Layer
- Markdown Parser (CommonMark + GFM)
- Metadata Extractor (frontmatter)
- Template Engine (Tera templates)

c) Output Generation Layer
- HTML Generator
- Feed Generator (RSS)
- Search Index Builder
- Static File Copier

d) Development Tools
- HTTP Server
- File Watcher
- CLI Interface

##### Component Relationships

**Input → Processing → Output**
- Watch Service (optional)

##### Specific Implementation Details

a) Input Sources:
- content/*.md files
- templates/*.html
- static/* assets
- marmite.yaml config

b) Processing Pipeline:
- Parallel processing of:
- Content (markdown → HTML)
- Templates (template compilation)
- Static assets (direct copying)

c) Output Targets:
- HTML files
- RSS feeds
- Search index
- Copied static assets

##### Special Features

- Taxonomy System (tags, streams)
- Author Management
- Template Customization
- Search Functionality
- Development Server

##### Technical Details

- Integration with:
- CommonMark parser
- Tera templating engine
- Built-in HTTP server
- File system watchers

##### Development tools as optional components

This system design should help developers understand both the simplicity and capability of Marmite as a static site generator.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef input fill:#a8d1f0,stroke:#333
    classDef process fill:#90EE90,stroke:#333
    classDef output fill:#FFB347,stroke:#333
    classDef dev fill:#D3D3D3,stroke:#333
    
    %% Input Layer
    subgraph InputLayer["Input Processing Layer"]
        Config["Configuration Parser"]
        Content["Content Reader"]
        StaticAssets["Static Assets Handler"]
        ConfigFile["marmite.yaml"]
        ContentFiles["Markdown Files"]
        AssetFiles["Static Files"]
    end
    
    %% Core Processing Layer
    subgraph CoreLayer["Core Processing Layer"]
        MarkdownParser["Markdown Parser"]
        MetadataExtractor["Metadata Extractor"]
        TemplateEngine["Template Engine"]
        SiteGenerator["Site Generator"]
    end
    
    %% Output Layer
    subgraph OutputLayer["Output Generation Layer"]
        HTMLGen["HTML Generator"]
        FeedGen["Feed Generator"]
        SearchBuilder["Search Index Builder"]
        StaticCopier["Static File Copier"]
    end
    
    %% Development Tools
    subgraph DevTools["Development Tools"]
        HTTPServer["HTTP Server"]
        FileWatcher["File Watcher"]
        CLI["CLI Interface"]
    end
    
    %% Relationships
    ConfigFile --> Config
    ContentFiles --> Content
    AssetFiles --> StaticAssets
    
    Config --> SiteGenerator
    Content --> MarkdownParser
    StaticAssets --> StaticCopier
    
    MarkdownParser --> MetadataExtractor
    MetadataExtractor --> TemplateEngine
    TemplateEngine --> HTMLGen
    
    SiteGenerator --> HTMLGen
    SiteGenerator --> FeedGen
    SiteGenerator --> SearchBuilder
    
    FileWatcher --> Content
    FileWatcher --> StaticAssets
    FileWatcher --> Config
    
    CLI --> SiteGenerator
    HTMLGen --> HTTPServer
    StaticCopier --> HTTPServer
    
    %% Click events for component mapping
    click CLI "https://github.com/rochacbruno/marmite/blob/main/src/cli.rs"
    click Config "https://github.com/rochacbruno/marmite/blob/main/src/config.rs"
    click Content "https://github.com/rochacbruno/marmite/blob/main/src/content.rs"
    click FeedGen "https://github.com/rochacbruno/marmite/blob/main/src/feed.rs"
    click TemplateEngine "https://github.com/rochacbruno/marmite/blob/main/src/templates.rs"
    click HTTPServer "https://github.com/rochacbruno/marmite/blob/main/src/server.rs"
    click SiteGenerator "https://github.com/rochacbruno/marmite/blob/main/src/site.rs"
    click MarkdownParser "https://github.com/rochacbruno/marmite/blob/main/src/parser.rs"
    click ConfigFile "https://github.com/rochacbruno/marmite/blob/main/example/marmite.yaml"
    click ContentFiles "https://github.com/rochacbruno/marmite/tree/main/example/content/"
    click AssetFiles "https://github.com/rochacbruno/marmite/tree/main/example/static/"
    click SearchBuilder "https://github.com/rochacbruno/marmite/blob/main/example/static/search.js"
    
    %% Legend
    subgraph Legend
        InputLegend["Input Components"]:::input
        ProcessLegend["Processing Components"]:::process
        OutputLegend["Output Components"]:::output
        DevLegend["Development Components"]:::dev
    end
```
