# ghghghko/klassic-quote-api architecture

> Architecture diagram of the GitHub repository ghghghko/klassic-quote-api, 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/ghghghko/klassic-quote-api
- Repository: https://github.com/ghghghko/klassic-quote-api

## Overview

##### Main Components

a) API Layer
- Axum Web Server (Main entry point)
- REST Endpoints (/v1/quotes, /v1/random-quote)

b) Data Layer
- In-memory Database (implemented in data.rs)
- JSON Quote Files (stored in src/quotes/)

c) External Services/Infrastructure
- Docker Container Runtime
- GitHub Actions CI/CD
- Status Monitoring (Upptime)
- Domain/DNS (mooo.com)

##### Component Relationships

**[Client Requests] → [DNS (mooo.com)] → [Docker Container]**
- ↓
- [Axum Web Server (main.rs)]
- ↓
- [Quote Service Layer]
- ↓
- [In-memory DB] ← [JSON Quote Files]

##### Important Details

a) API Endpoints:
- GET /v1/quotes
- GET /v1/random-quote

b) Data Flow:
- How quotes are loaded from JSON files into memory
- Request/response flow through the system

c) Infrastructure:
- Docker containerization
- CI/CD pipeline connection

##### Deployment View

- GitHub Actions workflow
- Docker container deployment
- Domain configuration
- Status page monitoring

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style definitions
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef devops fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef container fill:#34495e,stroke:#2c3e50,color:white

    %% Client Layer
    subgraph Clients
        WF["Web Frontend<br/>(klassic-quote.vercel.app)"]:::client
        AC["API Consumers"]:::client
    end

    %% API Layer
    subgraph API
        AS["Axum Web Server"]:::api
        EP["API Endpoints<br/>/v1/quotes<br/>/v1/random-quote"]:::api
        MQH["Movie Quote Handler"]:::api
    end

    %% Data Layer
    subgraph Data
        DB["In-memory Database"]:::data
        subgraph QF["Quote Files"]
            NG["Nameless Gangster"]:::data
            NW["New World"]:::data
            MFN["Man from Nowhere"]:::data
            WOF["War of Flower"]:::data
            W["Wish"]:::data
        end
    end

    %% Infrastructure
    subgraph Infrastructure
        DC["Docker Container"]:::container
        GH["GitHub Actions<br/>CI/CD"]:::devops
        UP["Upptime<br/>Monitoring"]:::devops
    end

    %% Connections
    WF --> AS
    AC --> AS
    AS --> EP
    EP --> MQH
    MQH --> DB
    DB --> QF
    GH --> DC
    DC --> AS
    UP -.-> AS

    %% Click events
    click AS "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/main.rs"
    click DB "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/data.rs"
    click MQH "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/movie_enum.rs"
    click QF "https://github.com/GHGHGHKO/klassic-quote-api/tree/master/src/quotes/"
    click NG "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/quotes/nameless-gangster.json"
    click NW "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/quotes/new-world.json"
    click MFN "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/quotes/the-man-from-nowhere.json"
    click WOF "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/quotes/the-war-of-flower.json"
    click W "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/src/quotes/wish.json"
    click DC "https://github.com/GHGHGHKO/klassic-quote-api/tree/master/Dockerfile"
    click GH "https://github.com/GHGHGHKO/klassic-quote-api/blob/master/.github/workflows/rust-cicd.yml"

    %% Legend
    subgraph Legend
        C1["Client Component"]:::client
        A1["API Component"]:::api
        D1["Data Component"]:::data
        I1["Infrastructure"]:::devops
        CN["Container"]:::container
    end
```
