# stidhagn/thrift-walk architecture

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

- Interactive diagram: https://gitdiagram.com/stidhagn/thrift-walk
- Repository: https://github.com/stidhagn/thrift-walk

## Overview

Thrift Walk is a community marketplace with user accounts, virtual stores, and a Godot game, plus a photo-to-3D scanning workflow for listing items. Users sign up and gain access through approval; they can browse stores, manage inventory, and attach completed scans to listings. Scans are stored and queued by the web app, reconstructed and previewed by a worker, then made available to the web and game. Edges reflect the shown source references and README; several web route implementations and UI components were not sampled, so their internal call paths are omitted.

Main entry points: [`web/src/lib/market/service.ts`](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/service.ts) (Market service), [`web/src/app/api/scan/route.ts`](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/scan/route.ts) (Scan API), [`worker/run_worker.py`](https://github.com/stidhagn/thrift-walk/blob/demo/worker/run_worker.py) (Worker queue loop), [`web/src/lib/auth.ts`](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/auth.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_accounts["Accounts"]
  node_signup["Sign up<br/>[sign-up-form.tsx]"]
  node_signin["Sign in<br/>[sign-in-form.tsx]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_approval["Account approval<br/>[page.tsx]"]
  node_profile["Profile<br/>[page.tsx]"]
end

subgraph group_market["Market and game"]
  node_marketui["Storefront UI<br/>[store-browser.tsx]"]
  node_inventory["Owner inventory"]
  node_marketapi["Market API<br/>[route.ts]"]
  node_marketservice["Market service<br/>[service.ts]"]
  node_procedures["Market procedures<br/>[procedures.ts]"]
  node_validation["Market validation<br/>[validation.ts]"]
  node_gamedb[("Domain data<br/>[schema.ts]")]
end

subgraph group_scanweb["Scan web workflow"]
  node_scanui["Scan upload and list<br/>[scan-dropzone.tsx]"]
  node_scanapi["Scan API<br/>[route.ts]"]
  node_scanfiles["Scan file endpoints<br/>[route.ts]"]
  node_scanstorage[("Scan storage<br/>[scan-storage.ts]")]
  node_redis["Job queue<br/>[redis.ts]"]
end

subgraph group_worker["Scan reconstruction"]
  node_workerloop["Worker queue loop<br/>[run_worker.py]"]
  node_pipeline["3D reconstruction<br/>[pipeline.py]"]
  node_texture["Texture baking<br/>[texture.py]"]
  node_preview["Preview rendering<br/>[preview.py]"]
  node_dispatcher["Runpod dispatcher"]
end

node_visitor(("User"))
node_gpu{{"Runpod GPU"}}

node_visitor -->|"creates account"| node_signup
node_signup -->|"uses auth"| node_auth
node_visitor -->|"signs in"| node_signin
node_signin -->|"uses auth"| node_auth
node_auth -->|"reads and writes"| node_gamedb
node_visitor -->|"submits code"| node_approval
node_visitor -->|"browses stores"| node_marketui
node_visitor -->|"manages items"| node_inventory
node_marketapi -.->|"delegates to"| node_marketservice
node_marketservice -->|"dispatches operations"| node_procedures
node_marketservice -->|"validates input"| node_validation
node_marketservice -->|"queries data"| node_gamedb
node_visitor -->|"uploads photos"| node_scanui
node_scanapi -.->|"stores photos"| node_scanstorage
node_scanapi -->|"queues job"| node_redis
node_scanapi -->|"creates scan job"| node_gamedb
node_scanfiles -.->|"transfers files"| node_scanstorage
node_redis -->|"delivers job"| node_workerloop
node_workerloop -->|"runs reconstruction"| node_pipeline
node_pipeline -->|"bakes texture"| node_texture
node_workerloop -->|"generates preview"| node_preview
node_dispatcher -.->|"dispatches scans"| node_gpu
node_gpu -->|"transfers scan files"| node_scanfiles
node_gpu -->|"runs reconstruction"| node_pipeline
node_gpu -->|"renders preview"| node_preview

click node_signup "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(auth)/sign-up/sign-up-form.tsx"
click node_signin "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(auth)/sign-in/sign-in-form.tsx"
click node_auth "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/auth.ts"
click node_approval "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(auth)/approval/page.tsx"
click node_profile "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(site)/profile/page.tsx"
click node_marketui "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/components/store-browser.tsx"
click node_inventory "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/components/owner-inventory.tsx"
click node_marketapi "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/market/%5B...path%5D/route.ts"
click node_marketservice "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/service.ts"
click node_procedures "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/procedures.ts"
click node_validation "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/validation.ts"
click node_gamedb "https://github.com/stidhagn/thrift-walk/blob/demo/web/zenstack/schema.ts"
click node_scanui "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/components/scan-dropzone.tsx"
click node_scanapi "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/scan/route.ts"
click node_scanfiles "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/scan-transfer/%5Bid%5D/%5Bfile%5D/route.ts"
click node_scanstorage "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/scan-storage.ts"
click node_redis "https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/redis.ts"
click node_workerloop "https://github.com/stidhagn/thrift-walk/blob/demo/worker/run_worker.py"
click node_pipeline "https://github.com/stidhagn/thrift-walk/blob/demo/worker/pipeline.py"
click node_texture "https://github.com/stidhagn/thrift-walk/blob/demo/worker/texture.py"
click node_preview "https://github.com/stidhagn/thrift-walk/blob/demo/worker/preview.py"
click node_dispatcher "https://github.com/stidhagn/thrift-walk/blob/demo/worker/runpod_dispatcher.py"

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_signup,node_signin,node_auth,node_approval,node_profile,node_visitor toneBlue
class node_marketui,node_inventory,node_marketapi,node_marketservice,node_procedures,node_validation,node_gamedb toneAmber
class node_scanui,node_scanapi,node_scanfiles,node_scanstorage,node_redis toneMint
class node_workerloop,node_pipeline,node_texture,node_preview,node_dispatcher toneRose
class node_gpu toneIndigo
```

## Components

### Accounts

- [Sign up](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(auth)/sign-up/sign-up-form.tsx): `web/src/app/(auth)/sign-up/sign-up-form.tsx`
- [Sign in](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(auth)/sign-in/sign-in-form.tsx): `web/src/app/(auth)/sign-in/sign-in-form.tsx`
- [Authentication](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/auth.ts): `web/src/lib/auth.ts`
- [Account approval](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(auth)/approval/page.tsx): `web/src/app/(auth)/approval/page.tsx`
- [Profile](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/(site)/profile/page.tsx): `web/src/app/(site)/profile/page.tsx`

### Market and game

- [Storefront UI](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/components/store-browser.tsx): `web/src/components/store-browser.tsx`
- [Owner inventory](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/components/owner-inventory.tsx): `web/src/components/owner-inventory.tsx`
- [Market API](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/market/%5B...path%5D/route.ts): `web/src/app/api/market/[...path]/route.ts`
- [Market service](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/service.ts): `web/src/lib/market/service.ts`
- [Market procedures](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/procedures.ts): `web/src/lib/market/procedures.ts`
- [Market validation](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/market/validation.ts): `web/src/lib/market/validation.ts`
- [Domain data](https://github.com/stidhagn/thrift-walk/blob/demo/web/zenstack/schema.ts): `web/zenstack/schema.ts`

### Scan web workflow

- [Scan upload and list](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/components/scan-dropzone.tsx): `web/src/components/scan-dropzone.tsx`
- [Scan API](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/scan/route.ts): `web/src/app/api/scan/route.ts`
- [Scan file endpoints](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/app/api/scan-transfer/%5Bid%5D/%5Bfile%5D/route.ts): `web/src/app/api/scan-transfer/[id]/[file]/route.ts`
- [Scan storage](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/scan-storage.ts): `web/src/lib/scan-storage.ts`
- [Job queue](https://github.com/stidhagn/thrift-walk/blob/demo/web/src/lib/redis.ts): `web/src/lib/redis.ts`

### Scan reconstruction

- [Worker queue loop](https://github.com/stidhagn/thrift-walk/blob/demo/worker/run_worker.py): `worker/run_worker.py`
- [3D reconstruction](https://github.com/stidhagn/thrift-walk/blob/demo/worker/pipeline.py): `worker/pipeline.py`
- [Texture baking](https://github.com/stidhagn/thrift-walk/blob/demo/worker/texture.py): `worker/texture.py`
- [Preview rendering](https://github.com/stidhagn/thrift-walk/blob/demo/worker/preview.py): `worker/preview.py`
- [Runpod dispatcher](https://github.com/stidhagn/thrift-walk/blob/demo/worker/runpod_dispatcher.py): `worker/runpod_dispatcher.py`

### Other components

- **User**
- **Runpod GPU**

## Connections

- User → Sign up: creates account (evidence: `README.md`)
- Sign up → Authentication: uses auth (evidence: `web/src/lib/auth.ts`)
- User → Sign in: signs in (evidence: `README.md`)
- Sign in → Authentication: uses auth (evidence: `web/src/lib/auth.ts`)
- Authentication → Domain data: reads and writes (evidence: `web/src/lib/auth.ts`)
- User → Account approval: submits code (evidence: `README.md`)
- User → Storefront UI: browses stores (evidence: `README.md`)
- User → Owner inventory: manages items (evidence: `README.md`)
- Market API → Market service: delegates to
- Market service → Market procedures: dispatches operations (evidence: `web/src/lib/market/service.ts`)
- Market service → Market validation: validates input (evidence: `web/src/lib/market/service.ts`)
- Market service → Domain data: queries data (evidence: `web/src/lib/market/service.ts`)
- User → Scan upload and list: uploads photos (evidence: `README.md`)
- Scan API → Scan storage: stores photos
- Scan API → Job queue: queues job
- Scan API → Domain data: creates scan job
- Scan file endpoints → Scan storage: transfers files
- Job queue → Worker queue loop: delivers job (evidence: `worker/run_worker.py`)
- Worker queue loop → 3D reconstruction: runs reconstruction (evidence: `worker/run_worker.py`)
- 3D reconstruction → Texture baking: bakes texture (evidence: `worker/pipeline.py`)
- Worker queue loop → Preview rendering: generates preview (evidence: `worker/run_worker.py`)
- Runpod dispatcher → Runpod GPU: dispatches scans
- Runpod GPU → Scan file endpoints: transfers scan files
- Runpod GPU → 3D reconstruction: runs reconstruction
- Runpod GPU → Preview rendering: renders preview
