# getmeemaw/meemaw architecture

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

- Interactive diagram: https://gitdiagram.com/getmeemaw/meemaw
- Repository: https://github.com/getmeemaw/meemaw

## Overview

##### Major Components
- Client Applications:
– Web Client (located under client/web/meemaw-js and client/web/wasm)
– iOS Client (located under client/ios/meemaw-ios)
– A Go-based client (client/client.go and client/tss_add.go) that might be used for ancillary functionality.
- Server-Side Components:
– Main server application (server/main.go and server/cmd/main.go)
– Auth providers (server/auth_providers.go)
– Database layer (server/database including models, queries, and SQLC integration with schema.sql and query.sql)
– TSS operations (multiple files in server like tss_add.go, tss_dkg.go, tss_recover.go, tss_sign.go)
– Vault operations (server/vault)
- Utilities and Common Services:
– TSS and transaction related utilities (under utils/tss, utils/tx)
– Configuration utilities (utils/config) and custom types (utils/types)
– WebSocket functionality (utils/ws)
- Infrastructure & Deployment Artifacts:
– Dockerfile and docker-compose.yml for containerization
– GitHub Actions workflows (in .github/workflows) for testing, build, documentation, and releases
– Go releaser configuration (.goreleaser.yml)
- Documentation:
– The complete docs folder with Docusaurus configuration (docs folder) that also houses the blog and guides.

##### Relationships and Interactions
- Client-to-Server Communication:
– The Web and iOS client SDKs integrate with the backend server via exposed APIs.
– The interactions involve wallet creation, recovery, and cryptographic operations without transmitting actual private keys.
- Server’s Internal Architecture:
– The server handles authentication (integrates with external Auth Providers) and processes wallet operations using TSS logic.
– It interacts with a database module for persistent storage (models and queries).
– It likely also mediates signing operations, connecting with lower-level utilities (TSS and vault services) to create and sign transactions.
- Auxiliary Services & Utilities:
– Utilities in the “utils” directory orchestrate tasks like configuration management, transaction processing, and peer coordination in TSS.
- Deployment Pipeline:
– CI/CD configurations and container files indicate automated builds and releases with Docker and GitHub Actions.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
– User-facing client SDKs are separated from the backend service that handles secure wallet operations.
- Modular Design:
– Individual directories for TSS, database, and utilities suggest modular design that isolates cryptographic processing, configuration, and domain logic.
- Microservices-Like Boundaries (Logical):
– Even if deployed as a single service, the clear separation of “client”, “server”, and “utils” implies logical boundaries that might be decomposed in the future into specialized microservices.
- Security and Trustlessness:
– Emphasis on a trustless design where the server never directly accesses private keys, using MPC-TSS protocols.
- Use of CI/CD and Containerization:
– Docker and GitHub actions denote a continuous integration and deployment approach.

##### Diagramming the Architecture
– “Web Client SDK” (with JavaScript/WebAssembly aspects)
– “iOS Client SDK”
– “Backend Server” with sub-components: Authentication, Database, TSS Management, Vault Services.
– “Utilities” illustrating shared services like transaction processing, configuration, and WebSockets.
– Illustrate API calls from the web/iOS clients to the backend server.
– Show internal data flows from the server’s authentication module to the database and TSS modules.
– Use a distinct style for infrastructure elements (containerization/CI pipelines).
- External Dependencies:
– Optionally, show integration with third-party Auth providers if applicable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Applications
    subgraph "Client Applications"
        A1["Web Client SDK"]:::client
        A2["iOS Client SDK"]:::client
        A3["Go-based Client"]:::client
    end

    %% Backend Server Components
    subgraph "Backend Server"
        B1["Main Server Application"]:::server
        B2["Authentication Providers"]:::server
        B3["Database Layer"]:::server
        B4["TSS Management"]:::server
        B5["Vault Operations"]:::server
    end

    %% Utilities & Common Services
    subgraph "Utilities & Common Services"
        U1["TSS Utilities: handles multiparty computation logic"]:::utility
        U2["Transaction Utilities: manages transaction processing"]:::utility
        U3["Configuration Utilities: manages configurations"]:::utility
        U4["Custom Types: defines domain-specific types"]:::utility
        U5["WebSocket Functionality: real-time communication"]:::utility
    end

    %% Infrastructure & Deployment Artifacts
    subgraph "Infrastructure & Deployment"
        I1["Dockerfile"]:::infra
        I2["docker-compose.yml"]:::infra
        I3["CI/CD Workflows"]:::infra
        I4["Go Releaser Configuration"]:::infra
        I5["Documentation"]:::infra
    end

    %% External Dependencies
    E["Blockchain / RPC Node"]:::external

    %% Client-to-Server Communication
    A1 -->|"API_call"| B1
    A2 -->|"API_call"| B1
    A3 -->|"API_call"| B1

    %% Server Internal Architecture
    B1 -->|"authenticates"| B2
    B1 -->|"queries"| B3
    B1 -->|"executes TSS"| B4
    B1 -->|"calls vault"| B5

    %% Server to Utilities Interactions
    B4 -->|"orchestrates"| U1
    B1 -->|"processes"| U2
    B1 -->|"loads"| U3
    B1 -->|"uses"| U4
    B1 -->|"notifies"| U5

    %% Server to External Dependency
    B1 -->|"sends TX"| E

    %% Infrastructure and Deployment Flow
    I1 -->|"deploys"| B1
    I2 -->|"deploys"| B1
    I3 -->|"automates"| B1
    I4 -->|"packages"| B1
    I5 -->|"documents"| B1

    %% Click Events
    click A1 "https://github.com/getmeemaw/meemaw/tree/main/client/web/meemaw-js"
    click A2 "https://github.com/getmeemaw/meemaw/tree/main/client/ios/meemaw-ios"
    click A3 "https://github.com/getmeemaw/meemaw/blob/main/client/client.go"
    click B1 "https://github.com/getmeemaw/meemaw/blob/main/server/main.go"
    click B2 "https://github.com/getmeemaw/meemaw/blob/main/server/auth_providers.go"
    click B3 "https://github.com/getmeemaw/meemaw/tree/main/server/database"
    click B4 "https://github.com/getmeemaw/meemaw/blob/main/server/tss_add.go"
    click B5 "https://github.com/getmeemaw/meemaw/tree/main/server/vault"
    click U1 "https://github.com/getmeemaw/meemaw/tree/main/utils/tss"
    click U2 "https://github.com/getmeemaw/meemaw/tree/main/utils/tx"
    click U3 "https://github.com/getmeemaw/meemaw/tree/main/utils/config"
    click U4 "https://github.com/getmeemaw/meemaw/tree/main/utils/types"
    click U5 "https://github.com/getmeemaw/meemaw/tree/main/utils/ws"
    click I1 "https://github.com/getmeemaw/meemaw/tree/main/Dockerfile"
    click I2 "https://github.com/getmeemaw/meemaw/blob/main/docker-compose.yml"
    click I3 "https://github.com/getmeemaw/meemaw/tree/main/.github/workflows"
    click I4 "https://github.com/getmeemaw/meemaw/blob/main/.goreleaser.yml"
    click I5 "https://github.com/getmeemaw/meemaw/tree/main/docs"

    %% Styles
    classDef client fill:#f9c,stroke:#333,stroke-width:2px;
    classDef server fill:#ccf,stroke:#333,stroke-width:2px;
    classDef utility fill:#cfc,stroke:#333,stroke-width:2px;
    classDef infra fill:#fc9,stroke:#333,stroke-width:2px;
    classDef external fill:#ddd,stroke:#333,stroke-width:2px;
```
