# hhhaan/firstcrack architecture

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

- Interactive diagram: https://gitdiagram.com/hhhaan/firstcrack
- Repository: https://github.com/hhhaan/firstcrack

## Overview

First Crack is a desktop roastery-management app. Its central workflow is to connect a roaster, capture a live roast and profile, save and review the session, and manage resulting inventory and production plans. The product also covers cupping, pricing, and sales-channel orders. The frontend, Tauri shell, Python hardware sidecar, Supabase backend, and R2 profile storage are documented; detailed implementation links beyond the excerpts are shown only where documented or evidenced.

Main entry points: [`src/App.tsx`](https://github.com/hhhaan/firstcrack/blob/main/src/App.tsx) (Application shell), [`src/views/active-roast/ActiveRoast.tsx`](https://github.com/hhhaan/firstcrack/blob/main/src/views/active-roast/ActiveRoast.tsx) (Live roast workspace), [`src-tauri/sidecar/main.py`](https://github.com/hhhaan/firstcrack/blob/main/src-tauri/sidecar/main.py) (Sidecar HTTP API), [`src/views/active-roast/model/useSidecarPolling.ts`](https://github.com/hhhaan/firstcrack/blob/main/src/views/active-roast/model/useSidecarPolling.ts) (Sidecar polling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Desktop app"]
  node_app["Application shell<br/>[App.tsx]"]
  node_auth["Authentication"]
  node_tauri["Desktop runtime<br/>[lib.rs]"]
end

subgraph group_roasting["Roast operations"]
  node_roast_view["Live roast workspace<br/>[ActiveRoast.tsx]"]
  node_polling["Sidecar polling"]
  node_roast_capture["Roast capture and save"]
  node_roast_history["Roast history"]
  node_profiles["Roast profiles"]
end

subgraph group_operations["Roastery operations"]
  node_inventory["Bean inventory"]
  node_schedule["Production planning"]
  node_orders["Orders and channels"]
  node_cupping["Cupping"]
  node_pricing["Pricing"]
end

subgraph group_hardware["Hardware integration"]
  node_sidecar_api["Sidecar HTTP API<br/>[main.py]"]
  node_manager["Roaster manager<br/>[manager.py]"]
  node_adapters["Roaster adapters"]
end

subgraph group_services["Backend services"]
  node_supabase[("Supabase backend")]
  node_edge_functions["Backend functions"]
  node_r2[("Cloudflare R2")]
end

node_operator(("Roastery staff"))

node_operator -->|"uses"| node_app
node_app -->|"starts sign-in"| node_auth
node_app -->|"routes to"| node_roast_view
node_operator -->|"records roast"| node_roast_view
node_roast_view -->|"polls hardware"| node_polling
node_polling -.->|"requests status"| node_sidecar_api
node_sidecar_api -->|"dispatches requests"| node_manager
node_manager -->|"uses drivers"| node_adapters
node_roast_view -.->|"captures session"| node_roast_capture
node_roast_capture -.->|"saves records"| node_roast_history
node_roast_history -.->|"uses profiles"| node_profiles
node_operator -->|"manages stock"| node_inventory
node_operator -->|"plans production"| node_schedule
node_operator -->|"manages orders"| node_orders
node_operator -->|"records cuppings"| node_cupping
node_operator -.->|"calculates pricing"| node_pricing
node_tauri -->|"launches sidecar"| node_sidecar_api
node_app -->|"uses backend"| node_supabase
node_supabase -->|"provides functions"| node_edge_functions
node_profiles -->|"stores profiles"| node_r2

click node_app "https://github.com/hhhaan/firstcrack/blob/main/src/App.tsx"
click node_auth "https://github.com/hhhaan/firstcrack/tree/main/src/features/auth"
click node_roast_view "https://github.com/hhhaan/firstcrack/blob/main/src/views/active-roast/ActiveRoast.tsx"
click node_polling "https://github.com/hhhaan/firstcrack/blob/main/src/views/active-roast/model/useSidecarPolling.ts"
click node_roast_capture "https://github.com/hhhaan/firstcrack/tree/main/src/features/active-roast"
click node_roast_history "https://github.com/hhhaan/firstcrack/tree/main/src/views/history"
click node_profiles "https://github.com/hhhaan/firstcrack/tree/main/src/entities/roast-profile"
click node_inventory "https://github.com/hhhaan/firstcrack/tree/main/src/entities/bean"
click node_schedule "https://github.com/hhhaan/firstcrack/tree/main/src/views/schedule"
click node_orders "https://github.com/hhhaan/firstcrack/tree/main/src/views/orders"
click node_cupping "https://github.com/hhhaan/firstcrack/tree/main/src/views/cupping"
click node_pricing "https://github.com/hhhaan/firstcrack/tree/main/src/views/pricing"
click node_tauri "https://github.com/hhhaan/firstcrack/blob/main/src-tauri/src/lib.rs"
click node_sidecar_api "https://github.com/hhhaan/firstcrack/blob/main/src-tauri/sidecar/main.py"
click node_manager "https://github.com/hhhaan/firstcrack/blob/main/src-tauri/sidecar/manager.py"
click node_adapters "https://github.com/hhhaan/firstcrack/tree/main/src-tauri/sidecar/adapters"
click node_edge_functions "https://github.com/hhhaan/firstcrack/tree/main/supabase/functions"

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_app,node_auth,node_tauri toneBlue
class node_roast_view,node_polling,node_roast_capture,node_roast_history,node_profiles toneAmber
class node_inventory,node_schedule,node_orders,node_cupping,node_pricing toneMint
class node_sidecar_api,node_manager,node_adapters toneRose
class node_supabase,node_edge_functions,node_r2,node_operator toneIndigo
```

## Components

### Desktop app

- [Application shell](https://github.com/hhhaan/firstcrack/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/hhhaan/firstcrack/tree/main/src/features/auth): `src/features/auth`
- [Desktop runtime](https://github.com/hhhaan/firstcrack/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Roast operations

- [Live roast workspace](https://github.com/hhhaan/firstcrack/blob/main/src/views/active-roast/ActiveRoast.tsx): `src/views/active-roast/ActiveRoast.tsx`
- [Sidecar polling](https://github.com/hhhaan/firstcrack/blob/main/src/views/active-roast/model/useSidecarPolling.ts): `src/views/active-roast/model/useSidecarPolling.ts`
- [Roast capture and save](https://github.com/hhhaan/firstcrack/tree/main/src/features/active-roast): `src/features/active-roast`
- [Roast history](https://github.com/hhhaan/firstcrack/tree/main/src/views/history): `src/views/history`
- [Roast profiles](https://github.com/hhhaan/firstcrack/tree/main/src/entities/roast-profile): `src/entities/roast-profile`

### Roastery operations

- [Bean inventory](https://github.com/hhhaan/firstcrack/tree/main/src/entities/bean): `src/entities/bean`
- [Production planning](https://github.com/hhhaan/firstcrack/tree/main/src/views/schedule): `src/views/schedule`
- [Orders and channels](https://github.com/hhhaan/firstcrack/tree/main/src/views/orders): `src/views/orders`
- [Cupping](https://github.com/hhhaan/firstcrack/tree/main/src/views/cupping): `src/views/cupping`
- [Pricing](https://github.com/hhhaan/firstcrack/tree/main/src/views/pricing): `src/views/pricing`

### Hardware integration

- [Sidecar HTTP API](https://github.com/hhhaan/firstcrack/blob/main/src-tauri/sidecar/main.py): `src-tauri/sidecar/main.py`
- [Roaster manager](https://github.com/hhhaan/firstcrack/blob/main/src-tauri/sidecar/manager.py): `src-tauri/sidecar/manager.py`
- [Roaster adapters](https://github.com/hhhaan/firstcrack/tree/main/src-tauri/sidecar/adapters): `src-tauri/sidecar/adapters`

### Backend services

- **Supabase backend**
- [Backend functions](https://github.com/hhhaan/firstcrack/tree/main/supabase/functions): `supabase/functions`
- **Cloudflare R2**

### Other components

- **Roastery staff**

## Connections

- Roastery staff → Application shell: uses (evidence: `README.md`)
- Application shell → Authentication: starts sign-in (evidence: `src/App.tsx`)
- Application shell → Live roast workspace: routes to (evidence: `src/App.tsx`)
- Roastery staff → Live roast workspace: records roast (evidence: `README.md`)
- Live roast workspace → Sidecar polling: polls hardware
- Sidecar polling → Sidecar HTTP API: requests status
- Sidecar HTTP API → Roaster manager: dispatches requests (evidence: `src-tauri/sidecar/main.py`)
- Roaster manager → Roaster adapters: uses drivers (evidence: `src-tauri/sidecar/manager.py`)
- Live roast workspace → Roast capture and save: captures session
- Roast capture and save → Roast history: saves records (evidence: `README.md`)
- Roast history → Roast profiles: uses profiles
- Roastery staff → Bean inventory: manages stock (evidence: `README.md`)
- Roastery staff → Production planning: plans production (evidence: `README.md`)
- Roastery staff → Orders and channels: manages orders (evidence: `README.md`)
- Roastery staff → Cupping: records cuppings (evidence: `README.md`)
- Roastery staff → Pricing: calculates pricing
- Desktop runtime → Sidecar HTTP API: launches sidecar (evidence: `src-tauri/src/lib.rs`)
- Application shell → Supabase backend: uses backend (evidence: `README.md`)
- Supabase backend → Backend functions: provides functions (evidence: `README.md`)
- Roast profiles → Cloudflare R2: stores profiles (evidence: `README.md`)
