# scadoshi/zwipe architecture

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

- Interactive diagram: https://gitdiagram.com/scadoshi/zwipe
- Repository: https://github.com/scadoshi/zwipe

## Overview

Zwipe is a mobile-first Magic: The Gathering deck builder, with a companion website. The main user workflow is to browse or search cards, add and manage them in a deck, then analyze or share the result. The README documents the app/site → typed client → shared core → server architecture; the graph preserves those boundaries and the product’s card, deck, account, and site capabilities. Internal calls in unsampled code are not asserted beyond those documented relationships.

Main entry points: [`zwipe-core/src/domain`](https://github.com/scadoshi/zwipe/tree/main/zwipe-core/src/domain) (Domain and contracts), [`zwiper/src/lib/inbound/router.rs`](https://github.com/scadoshi/zwipe/blob/main/zwiper/src/lib/inbound/router.rs) (Mobile app), [`zite/src/main.rs`](https://github.com/scadoshi/zwipe/blob/main/zite/src/main.rs) (Website), [`zwipe-client/src/call.rs`](https://github.com/scadoshi/zwipe/blob/main/zwipe-client/src/call.rs) (Typed API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["User surfaces"]
  node_mobile_app["Mobile app<br/>[router.rs]"]
  node_deck_screens["Deck workflow<br/>[view.rs]"]
  node_website["Website<br/>[main.rs]"]
  node_site_pages["Guides and sharing<br/>[shared_deck.rs]"]
end

subgraph group_shared["Shared platform"]
  node_shared_ui["Shared UI components"]
  node_api_client["Typed API client<br/>[call.rs]"]
  node_shared_core["Domain and contracts"]
  node_card_search["Card search rules<br/>[query.rs]"]
  node_deck_domain["Deck rules and models"]
end

subgraph group_server["API and services"]
  node_auth_api["Authentication API"]
  node_card_api["Card API"]
  node_deck_api["Deck API"]
  node_server_services["Server orchestration<br/>[services.rs]"]
  node_postgres[("PostgreSQL storage<br/>[postgres.rs]")]
end

subgraph group_integrations["Data integrations"]
  node_scryfall["Scryfall"]
  node_archidekt["Archidekt"]
  node_email_service["Email delivery"]
end

node_app_user(("Deck builder"))
node_site_user(("Site visitor"))

node_app_user -->|"uses"| node_mobile_app
node_mobile_app -.->|"navigates"| node_deck_screens
node_deck_screens -.->|"uses"| node_shared_ui
node_deck_screens -.->|"requests data"| node_api_client
node_site_user -->|"visits"| node_website
node_website -->|"renders"| node_site_pages
node_website -->|"uses"| node_api_client
node_website -->|"uses"| node_shared_ui
node_mobile_app -->|"uses"| node_api_client
node_mobile_app -->|"uses"| node_shared_ui
node_api_client -->|"uses contracts"| node_shared_core
node_shared_core -->|"defines"| node_card_search
node_shared_core -.->|"defines"| node_deck_domain
node_card_api -->|"uses contracts"| node_shared_core
node_deck_api -->|"uses contracts"| node_shared_core
node_auth_api -->|"uses domain"| node_shared_core
node_server_services -.->|"persists data"| node_postgres
node_card_api -.->|"delegates"| node_server_services
node_deck_api -.->|"delegates"| node_server_services
node_card_api -->|"syncs card data"| node_scryfall
node_deck_api -.->|"imports decks"| node_archidekt
node_auth_api -.->|"sends mail"| node_email_service

click node_mobile_app "https://github.com/scadoshi/zwipe/blob/main/zwiper/src/lib/inbound/router.rs"
click node_deck_screens "https://github.com/scadoshi/zwipe/blob/main/zwiper/src/lib/inbound/screens/deck/card/view.rs"
click node_website "https://github.com/scadoshi/zwipe/blob/main/zite/src/main.rs"
click node_site_pages "https://github.com/scadoshi/zwipe/blob/main/zite/src/pages/shared_deck.rs"
click node_shared_ui "https://github.com/scadoshi/zwipe/tree/main/zwipe-components/src"
click node_api_client "https://github.com/scadoshi/zwipe/blob/main/zwipe-client/src/call.rs"
click node_shared_core "https://github.com/scadoshi/zwipe/tree/main/zwipe-core/src/domain"
click node_card_search "https://github.com/scadoshi/zwipe/blob/main/zwipe-core/src/domain/card/models/search_card/card_filter/query.rs"
click node_deck_domain "https://github.com/scadoshi/zwipe/tree/main/zwipe-core/src/domain/deck"
click node_auth_api "https://github.com/scadoshi/zwipe/tree/main/zerver/src/lib/inbound/http/handlers/auth"
click node_card_api "https://github.com/scadoshi/zwipe/tree/main/zerver/src/lib/inbound/http/handlers/card"
click node_deck_api "https://github.com/scadoshi/zwipe/tree/main/zerver/src/lib/inbound/http/handlers/deck"
click node_server_services "https://github.com/scadoshi/zwipe/blob/main/zerver/src/lib/domain/deck/services.rs"
click node_postgres "https://github.com/scadoshi/zwipe/blob/main/zerver/src/lib/outbound/sqlx/postgres.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mobile_app,node_deck_screens,node_website,node_site_pages toneBlue
class node_shared_ui,node_api_client,node_shared_core,node_card_search,node_deck_domain toneAmber
class node_auth_api,node_card_api,node_deck_api,node_server_services,node_postgres toneMint
class node_scryfall,node_archidekt,node_email_service toneRose
class node_app_user,node_site_user toneIndigo
```

## Components

### User surfaces

- [Mobile app](https://github.com/scadoshi/zwipe/blob/main/zwiper/src/lib/inbound/router.rs): `zwiper/src/lib/inbound/router.rs`
- [Deck workflow](https://github.com/scadoshi/zwipe/blob/main/zwiper/src/lib/inbound/screens/deck/card/view.rs): `zwiper/src/lib/inbound/screens/deck/card/view.rs`
- [Website](https://github.com/scadoshi/zwipe/blob/main/zite/src/main.rs): `zite/src/main.rs`
- [Guides and sharing](https://github.com/scadoshi/zwipe/blob/main/zite/src/pages/shared_deck.rs): `zite/src/pages/shared_deck.rs`

### Shared platform

- [Shared UI components](https://github.com/scadoshi/zwipe/tree/main/zwipe-components/src): `zwipe-components/src`
- [Typed API client](https://github.com/scadoshi/zwipe/blob/main/zwipe-client/src/call.rs): `zwipe-client/src/call.rs`
- [Domain and contracts](https://github.com/scadoshi/zwipe/tree/main/zwipe-core/src/domain): `zwipe-core/src/domain`
- [Card search rules](https://github.com/scadoshi/zwipe/blob/main/zwipe-core/src/domain/card/models/search_card/card_filter/query.rs): `zwipe-core/src/domain/card/models/search_card/card_filter/query.rs`
- [Deck rules and models](https://github.com/scadoshi/zwipe/tree/main/zwipe-core/src/domain/deck): `zwipe-core/src/domain/deck`

### API and services

- [Authentication API](https://github.com/scadoshi/zwipe/tree/main/zerver/src/lib/inbound/http/handlers/auth): `zerver/src/lib/inbound/http/handlers/auth`
- [Card API](https://github.com/scadoshi/zwipe/tree/main/zerver/src/lib/inbound/http/handlers/card): `zerver/src/lib/inbound/http/handlers/card`
- [Deck API](https://github.com/scadoshi/zwipe/tree/main/zerver/src/lib/inbound/http/handlers/deck): `zerver/src/lib/inbound/http/handlers/deck`
- [Server orchestration](https://github.com/scadoshi/zwipe/blob/main/zerver/src/lib/domain/deck/services.rs): `zerver/src/lib/domain/deck/services.rs`
- [PostgreSQL storage](https://github.com/scadoshi/zwipe/blob/main/zerver/src/lib/outbound/sqlx/postgres.rs): `zerver/src/lib/outbound/sqlx/postgres.rs`

### Data integrations

- **Scryfall**
- **Archidekt**
- **Email delivery**

### Other components

- **Deck builder**
- **Site visitor**

## Connections

- Deck builder → Mobile app: uses
- Mobile app → Deck workflow: navigates
- Deck workflow → Shared UI components: uses
- Deck workflow → Typed API client: requests data
- Site visitor → Website: visits
- Website → Guides and sharing: renders
- Website → Typed API client: uses
- Website → Shared UI components: uses (evidence: `zwipe-components/src/lib.rs`)
- Mobile app → Typed API client: uses
- Mobile app → Shared UI components: uses (evidence: `zwipe-components/src/lib.rs`)
- Typed API client → Domain and contracts: uses contracts
- Domain and contracts → Card search rules: defines (evidence: `zwipe-core/src/domain/card/models/search_card/card_filter/query.rs`)
- Domain and contracts → Deck rules and models: defines
- Card API → Domain and contracts: uses contracts
- Deck API → Domain and contracts: uses contracts
- Authentication API → Domain and contracts: uses domain
- Server orchestration → PostgreSQL storage: persists data
- Card API → Server orchestration: delegates
- Deck API → Server orchestration: delegates
- Card API → Scryfall: syncs card data
- Deck API → Archidekt: imports decks
- Authentication API → Email delivery: sends mail
