# sparrowapp-dev/sparrow-app architecture

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

- Interactive diagram: https://gitdiagram.com/sparrowapp-dev/sparrow-app
- Repository: https://github.com/sparrowapp-dev/sparrow-app

## Overview

##### Project type and purpose
- Sparrow is a full‑stack, monorepo‑style API management platform.
- Frontends:
– Desktop client (Tauri + Rust + Svelte).
– Web client (Svelte + Vite).
– Design system / Storybook for UI components.
- Backends (external repos, orchestrated via Docker Compose):
– Auth service (NestJS + MongoDB).
– API service (NestJS + MongoDB + Kafka).
– Proxy/gateway service.
- Shared code (packages/@sparrow‑*): common DTOs, component libraries, utilities.

##### File structure
- Top‑level folders:
– apps/@sparrow‑desktop, apps/@sparrow‑web, apps/@sparrow‑storybook
– packages/@sparrow‑common, @sparrow‑library, @sparrow‑support, etc.
– docker‑compose.yml for local infrastructure.
– .github/workflows for CI/CD pipelines.
- Monorepo pattern: share common code in “packages”, consume in “apps”.
- Separate Svelte/Vite configs per app, Cargo config under desktop for Rust/Tauri.

##### README for technical stack
- Frontend: Svelte 3/4, Vite, Storybook.
- Desktop: Tauri + Rust for native shell + Svelte UI.
- Backend (not in this repo): NestJS, Mongoose (MongoDB), Kafka.
- Dev & deploy: Docker, Docker Compose, Yarn, Husky, GitHub Actions.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Clients
    subgraph "Clients"
        DesktopApp["Desktop App\n(Tauri + Rust + Svelte)"]:::client
        WebApp["Web App\n(Svelte + Vite)"]:::client
        Storybook["Design System / Storybook"]:::client
    end

    %% Shared Packages
    subgraph "Shared Packages"
        Common["@sparrow-common"]:::shared
        Library["@sparrow-library"]:::shared
        Support["@sparrow-support"]:::shared
        Teams["@sparrow-teams"]:::shared
        Types["@sparrow-types"]:::shared
        Workspaces["@sparrow-workspaces"]:::shared
    end

    %% Microservices
    subgraph "Microservices"
        Gateway["API Gateway / Proxy Service"]:::service
        Auth["Authentication Service\n(NestJS + MongoDB)"]:::service
        APIService["API Service\n(NestJS + MongoDB + Kafka)"]:::service
    end

    %% Data Stores
    subgraph "Data Stores"
        MongoAuth["MongoDB (Auth)"]:::db
        MongoAPI["MongoDB (API)"]:::db
        Kafka["Kafka"]:::db
    end

    %% External Services
    subgraph "External Services"
        GitHubOAuth["GitHub OAuth"]:::external
        Canny["Canny"]:::external
        Mixpanel["Mixpanel"]:::external
    end

    %% Infrastructure
    subgraph "Infrastructure"
        DockerCompose["Local Dev Infra\n(Docker Compose)"]:::infra
        CICD["CI/CD Pipelines\n(GitHub Actions)"]:::infra
    end

    %% Relationships
    DesktopApp -->|"HTTP/WS"| Gateway
    WebApp -->|"HTTP/WS"| Gateway
    Storybook -->|"uses UI libs"| Common

    Common --> DesktopApp
    Common --> WebApp
    Library --> DesktopApp
    Library --> WebApp
    Support --> DesktopApp
    Support --> WebApp
    Teams --> DesktopApp
    Teams --> WebApp
    Types --> DesktopApp
    Types --> WebApp
    Workspaces --> DesktopApp
    Workspaces --> WebApp

    Gateway -->|"routes auth"| Auth
    Gateway -->|"routes API"| APIService

    Auth -->|"CRUD"| MongoAuth
    APIService -->|"CRUD"| MongoAPI
    APIService -->|"events"| Kafka

    DesktopApp -->|Analytics| Mixpanel
    WebApp -->|Analytics| Mixpanel
    DesktopApp -->|Feedback| Canny
    WebApp -->|Feedback| Canny

    Auth -->|OAuth calls| GitHubOAuth

    CICD --> DesktopApp
    CICD --> WebApp
    CICD --> Storybook
    CICD --> Common
    CICD --> Library
    CICD --> Support
    CICD --> Teams
    CICD --> Types
    CICD --> Workspaces
    CICD --> Gateway
    CICD --> Auth
    CICD --> APIService

    DockerCompose --> Gateway
    DockerCompose --> Auth
    DockerCompose --> APIService
    DockerCompose --> MongoAuth
    DockerCompose --> MongoAPI
    DockerCompose --> Kafka

    %% Click Events
    click DesktopApp "https://github.com/sparrowapp-dev/sparrow-app/tree/development/apps/@sparrow-desktop"
    click WebApp "https://github.com/sparrowapp-dev/sparrow-app/tree/development/apps/@sparrow-web"
    click Storybook "https://github.com/sparrowapp-dev/sparrow-app/tree/development/apps/@sparrow-storybook"
    click Common "https://github.com/sparrowapp-dev/sparrow-app/tree/development/packages/@sparrow-common"
    click Library "https://github.com/sparrowapp-dev/sparrow-app/tree/development/packages/@sparrow-library"
    click Support "https://github.com/sparrowapp-dev/sparrow-app/tree/development/packages/@sparrow-support"
    click Teams "https://github.com/sparrowapp-dev/sparrow-app/tree/development/packages/@sparrow-teams"
    click Types "https://github.com/sparrowapp-dev/sparrow-app/tree/development/packages/@sparrow-types"
    click Workspaces "https://github.com/sparrowapp-dev/sparrow-app/tree/development/packages/@sparrow-workspaces"
    click DockerCompose "https://github.com/sparrowapp-dev/sparrow-app/blob/development/docker-compose.yml"
    click CICD "https://github.com/sparrowapp-dev/sparrow-app/tree/development/.github/workflows"

    %% Styles
    classDef client fill:#D6EFFF,stroke:#0284C7;
    classDef shared fill:#FFF4E8,stroke:#E36A06;
    classDef service fill:#E2F0D9,stroke:#2D6A4F;
    classDef db fill:#FFF3BF,stroke:#CC8E00,stroke-dasharray:5 5;
    classDef external fill:#E8E8E8,stroke:#6B7280,stroke-dasharray:2 2;
    classDef infra fill:#F0F0F0,stroke:#4B5563,stroke-dasharray:5 2;
```
