Skip to content

Architecture Diagrams

A gallery of Mermaid diagrams for the system. Each diagram also lives inside the page where it is most relevant; this page collects them for quick reference and as canonical style examples (see contributing.md).

System context

flowchart LR
    WEB["Web app (v2)"]
    MOB["Mobile app (v3)"]
    API["dichit-backend"]
    PG[(PostgreSQL)]
    RD[(Redis)]
    S3[AWS S3]
    FCM[Firebase]
    SMPT[SMTP]
    SMS[SMS provider]
    PAY[Zwitch]
    SL[Slack]

    WEB -->|REST + WS| API
    MOB -->|REST + WS| API
    API --> PG
    API --> RD
    API --> S3
    API --> FCM
    API --> SMPT
    API --> SMS
    API --> PAY
    API --> SL

Container / layering

flowchart TB
    subgraph Client
        WEB[Web SPA]
        MOB[Mobile]
    end
    subgraph Api["dichit-backend (Fastify)"]
        subgraph I["interfaces"]
            HTTP["HTTP routes v1/v2/v3"]
            WS2["WebSocket /ws"]
            WH["webhooks"]
        end
        subgraph A["application"]
            UC["use-cases"]
            Q["queue processors"]
        end
        subgraph Inf["infrastructure"]
            R["repositories"]
            P["providers"]
        end
    end
    subgraph Data
        PG[(PostgreSQL)]
        RD[(Redis)]
    end
    Client --> HTTP & WS2
    HTTP --> UC
    WS2 --> UC
    UC --> Q
    UC --> R
    R --> PG
    Q --> RD
    WS2 --> RD

CI/CD pipeline

flowchart LR
    PR["PR"] --> CI["ci.yml: lint, typecheck, build, unit + functional tests"]
    CI --> SEC["security-scan / scan-dockerfile"]
    CI --> CDDEV["cd-dev.yml: deploy dev"]
    CDDEV --> REL["release-please: version + changelog"]
    REL --> CDSTG["cd-staging.yml: deploy staging"]
    REL --> PRD["prod-release.yml: release to prod"]

See deployment/ci-cd.md.

Deployment topology (production)

flowchart TB
    Users --> CDN[CloudFront / DNS]
    CDN --> LB[ALB]
    LB --> EC2["ECS / EC2 - app containers"]
    EC2 --> PG[(PostgreSQL - RDS)]
    EC2 --> RD[(Redis - ElastiCache)]
    EC2 --> S3[AWS S3]
    EC2 --> CF[CloudWatch Logs]
    EC2 --> SN[Sentry]

See deployment/production.md and infrastructure/aws.md.