# yree/mdow architecture

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

- Interactive diagram: https://gitdiagram.com/yree/mdow
- Repository: https://github.com/yree/mdow

## Overview

##### Project Type Analysis
This is a web application with a server-side component written in Rust. The presence of Dockerfile and fly.toml indicates it's containerized and deployed on Fly.io. The litefs.yml suggests the use of LiteFS for data storage.

##### Main Components

A. Client Layer:
- Web Browser Interface
- Markdown Editor Component
- Preview Component
- Client-side State Management

B. Server Layer:
- Rust Web Server (main.rs)
- API Endpoints for:
- Markdown processing
- File storage/retrieval
- Link generation

C. Storage Layer:
- LiteFS for file persistence
- Temporary storage for 30-day link retention

D. Infrastructure Layer:
- Docker Container
- Fly.io Deployment
- GitHub Actions CI/CD

**[Client Layer]**
- ↕
**[Server Layer]**
- ↕
**[Storage Layer]**
- ↕
**[Infrastructure Layer]**

##### Key Elements to Emphasize

- The lightweight nature of the application
- The markdown processing flow
- The link sharing mechanism
- The temporary storage system
- The containerized deployment setup

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef client fill:#a8d1f0,stroke:#333
    classDef server fill:#90EE90,stroke:#333
    classDef storage fill:#FFE5B4,stroke:#333
    classDef infra fill:#E0E0E0,stroke:#333
    
    subgraph ClientLayer["Client Layer"]
        Browser["Web Browser"]:::client
        Editor["Markdown Editor"]:::client
        Preview["Preview Component"]:::client
        State["Client State"]:::client
        
        Browser --> Editor
        Browser --> Preview
        Editor --> State
        Preview --> State
    end
    
    subgraph ServerLayer["Server Layer"]
        RustServer["Rust Web Server"]:::server
        APIEndpoints["API Endpoints"]:::server
        MarkdownProc["Markdown Processor"]:::server
        
        APIEndpoints --> RustServer
        RustServer --> MarkdownProc
    end
    
    subgraph StorageLayer["Storage Layer"]
        LiteFS["LiteFS Storage"]:::storage
        TempStore["30-Day Temporary Storage"]:::storage
        
        LiteFS --> TempStore
    end
    
    subgraph InfraLayer["Infrastructure Layer"]
        Docker["Docker Container"]:::infra
        FlyIO["Fly.io Platform"]:::infra
        GitHub["GitHub Actions"]:::infra
        
        GitHub --> Docker
        Docker --> FlyIO
    end
    
    %% Inter-layer connections
    ClientLayer --> ServerLayer
    ServerLayer --> StorageLayer
    StorageLayer --> InfraLayer
    
    %% Click events for component mapping
    click RustServer "https://github.com/yree/mdow/blob/main/src/main.rs"
    click LiteFS "https://github.com/yree/mdow/blob/main/litefs.yml"
    click Docker "https://github.com/yree/mdow/tree/main/Dockerfile"
    click FlyIO "https://github.com/yree/mdow/blob/main/fly.toml"
    click GitHub "https://github.com/yree/mdow/blob/main/.github/workflows/fly-deploy.yml"
    click RustServer "https://github.com/yree/mdow/blob/main/Cargo.toml"
    
    %% Legend
    subgraph Legend
        Client["Client Component"]:::client
        Server["Server Component"]:::server
        Storage["Storage Component"]:::storage
        Infrastructure["Infrastructure Component"]:::infra
    end
```
