# guibeira/secret-santa architecture

> Architecture diagram of the GitHub repository guibeira/secret-santa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guibeira/secret-santa
- Repository: https://github.com/guibeira/secret-santa

## Overview

##### Main Components Identification

The system consists of two primary components:
- Frontend (WebAssembly-based web application)
- Backend (Rust server without a traditional database)

##### Specific Implementation Details

**[Web Browser]**
- ↓
**[Frontend - WASM]**
- Main App
- Components
- API Client
- ↕ (HTTP/WS)
**[Backend - Rust]**
- Routes
- Models
- Error Handling
- Utils

##### Important Elements

- Trunk (Frontend builder)
- Cargo Watch (Backend development)
- Make (Build automation)

b. Build Pipeline (in a separate flow):
- WASM compilation process
- Backend compilation process

##### Additional Notes

- A note about the Portuguese language UI
- Development workflow with two separate processes (trunk serve and make start)
- That it's a single-page application

- Full-stack Rust implementation
- WebAssembly frontend
- No traditional database
- Development tooling integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef browser fill:#f9f,stroke:#333,stroke-width:2px
    classDef frontend fill:#b3d9ff,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef tools fill:#FFE5CC,stroke:#333,stroke-width:1px
    classDef communication fill:none,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5

    %% Browser Layer
    Browser["Web Browser (Port 8080)"]:::browser

    %% Frontend Layer
    subgraph Frontend["Frontend - WebAssembly"]
        EntryPoint["index.html"]
        MainApp["Main Application"]
        AppComp["App Component"]
        APIClient["API Client"]
        UIComps["UI Components"]
    end

    %% Backend Layer
    subgraph Backend["Backend - Rust Server"]
        ServerMod["Server Module"]
        Routes["Routes Handler"]
        Models["Models"]
        ErrorHandle["Error Handling"]
        Utils["Utilities"]
    end

    %% Development Tools
    subgraph DevTools["Development Tools"]
        Trunk["Trunk - Frontend Builder"]
        Make["Make - Build Automation"]
    end

    %% Relationships
    Browser --> EntryPoint
    EntryPoint --> MainApp
    MainApp --> AppComp
    AppComp --> UIComps
    AppComp --> APIClient
    APIClient -.->|HTTP/WebSocket| Routes
    Routes --> Models
    Routes --> ErrorHandle
    Routes --> Utils
    ServerMod --> Routes

    %% Click events for component mapping
    click EntryPoint "https://github.com/guibeira/secret-santa/blob/main/front/index.html"
    click MainApp "https://github.com/guibeira/secret-santa/blob/main/front/src/main.rs"
    click AppComp "https://github.com/guibeira/secret-santa/blob/main/front/src/app.rs"
    click APIClient "https://github.com/guibeira/secret-santa/blob/main/front/src/api.rs"
    click UIComps "https://github.com/guibeira/secret-santa/blob/main/front/src/components.rs"
    click Routes "https://github.com/guibeira/secret-santa/blob/main/src/server/routes.rs"
    click Models "https://github.com/guibeira/secret-santa/blob/main/src/server/models.rs"
    click ErrorHandle "https://github.com/guibeira/secret-santa/blob/main/src/server/error.rs"
    click Utils "https://github.com/guibeira/secret-santa/blob/main/src/server/utils.rs"
    click Trunk "https://github.com/guibeira/secret-santa/blob/main/front/Trunk.toml"
    click Make "https://github.com/guibeira/secret-santa/tree/main/Makefile"
    click ServerMod "https://github.com/guibeira/secret-santa/blob/main/src/server/mod.rs"

    %% Notes
    subgraph Notes["Legend"]
        Browser_Note["Browser Layer"]:::browser
        Frontend_Note["Frontend Components"]:::frontend
        Backend_Note["Backend Components"]:::backend
        Tools_Note["Development Tools"]:::tools
        Comm_Note["API Communication"]:::communication
    end
```
