# santaclaas/meal architecture

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

- Interactive diagram: https://gitdiagram.com/santaclaas/meal
- Repository: https://github.com/santaclaas/meal

## Overview

##### Main Components

a. Frontend Layer (app directory):
- SolidJS application structure
- WebAssembly integration point
- Components (Camera, Chat, Preview)
- Worker architecture for file handling

b. Core Services:
- Core library (core directory) - likely contains the OpenMLS implementation
- Delivery service for message handling
- Pumpe service (purpose needs to be inferred)
- Tugboat deployment service

c. Infrastructure Layer:
- Docker containerization
- Database system (shown in tugboat/src/database)
- Authentication system (shown in tugboat/src/auth)

##### Component Relationships

**[Frontend (SolidJS)] <---> [WebAssembly Bridge] <---> [Core Rust Library]**

- v
**[Delivery Service] <---> [Message Queue/Broker] <---> [Backend Services]**

- v
- [Database Layer]

**[Tugboat Deployment] ---> [Docker Container Management]**

##### Detailed Component Breakdown

Frontend (app/):
**[Top App Bar] --> [Camera Component]**

- v
**[Preview Component] --> [Chat Routes]**

Backend Services:
**[Delivery Service] --> [Core Library]**
**[Tugboat Service] --> [Container Management]**

- v
- [Project Management]

##### Additional Elements

- Version/environment indicators
- WebAssembly boundary clearly
- Security perimeters

##### Notes for Implementation

- Use double lines for encryption boundaries
- Database schema references
- API endpoints and their security levels

##### Service interconnections

Keep the abstraction level focused on the architectural components while maintaining enough detail to show the security and message flow patterns. This is particularly important given the emphasis on end-to-end encryption and secure messaging in the requirements.

Remember to include a section showing the GitHub Actions workflow integration with the deployment process, as this is a key feature mentioned in the project goals.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        TopBar["Top App Bar"]
        Camera["Camera Component"]
        Preview["Preview Component"]
        Chat["Chat Routes"]
        FileWorker["File Handler Worker"]
        WebAssembly["WebAssembly Bridge"]
    end

    subgraph CoreServices
        CoreLib["Core Library"]
        DeliveryService["Delivery Service"]
        PumpeService["Pumpe Service"]
    end

    subgraph Infrastructure
        Docker["Docker Container Management"]
        DB[(Database)]
        Auth["Authentication System"]
        GitHubActions["GitHub Actions"]
    end

    subgraph TugboatService
        TugboatMain["Tugboat Main"]
        ContainerMgmt["Container Management"]
        ProjectMgmt["Project Management"]
    end

    %% Frontend Relationships
    TopBar --> Camera
    Camera --> Preview
    Preview --> Chat
    Chat --> FileWorker
    FileWorker --> WebAssembly

    %% Core Service Relationships
    WebAssembly <--> CoreLib
    CoreLib <--> DeliveryService
    DeliveryService <--> PumpeService

    %% Infrastructure Relationships
    TugboatMain --> Docker
    TugboatMain --> DB
    TugboatMain --> Auth
    GitHubActions --> TugboatMain
    ContainerMgmt --> Docker
    ProjectMgmt --> DB

    %% Styling
    classDef frontend fill:#a8d1ff
    classDef core fill:#90EE90
    classDef infra fill:#FFE5B4
    classDef tugboat fill:#DDA0DD
    classDef security fill:#FFB6C1

    class TopBar,Camera,Preview,Chat,FileWorker,WebAssembly frontend
    class CoreLib,DeliveryService,PumpeService core
    class Docker,DB,GitHubActions infra
    class TugboatMain,ContainerMgmt,ProjectMgmt tugboat
    class Auth security

    %% Click Events
    click TopBar "https://github.com/santaclaas/meal/blob/main/app/src/components/TopAppBar.jsx"
    click Camera "https://github.com/santaclaas/meal/blob/main/app/src/components/Camera.jsx"
    click Preview "https://github.com/santaclaas/meal/blob/main/app/src/components/Preview.jsx"
    click Chat "https://github.com/santaclaas/meal/blob/main/app/src/routes/chat.jsx"
    click FileWorker "https://github.com/santaclaas/meal/blob/main/app/src/workers/saveFile.js"
    click CoreLib "https://github.com/santaclaas/meal/blob/main/core/src/lib.rs"
    click DeliveryService "https://github.com/santaclaas/meal/blob/main/delivery-service/src/main.rs"
    click PumpeService "https://github.com/santaclaas/meal/blob/main/pumpe/src/main.rs"
    click Docker "https://github.com/santaclaas/meal/blob/main/tugboat/src/docker.rs"
    click DB "https://github.com/santaclaas/meal/tree/main/tugboat/src/database/"
    click Auth "https://github.com/santaclaas/meal/tree/main/tugboat/src/auth/"
    click TugboatMain "https://github.com/santaclaas/meal/blob/main/tugboat/src/main.rs"
    click ContainerMgmt "https://github.com/santaclaas/meal/blob/main/tugboat/src/route/container.rs"
    click ProjectMgmt "https://github.com/santaclaas/meal/blob/main/tugboat/src/route/project.rs"
    click GitHubActions "https://github.com/santaclaas/meal/tree/main/.github/workflows/"
```
