# yzernik/squeakroad architecture

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

- Interactive diagram: https://gitdiagram.com/yzernik/squeakroad
- Repository: https://github.com/yzernik/squeakroad

## Overview

Squeakroad is a Rocket-based darknet marketplace using SQLite-backed user accounts, listings, orders, and balances, with LND for Lightning invoices and payments. Users sign up, receive a bond invoice, activate an account, publish listings for review, and can place orders or withdraw funds. Admins manage users, market settings, and listing approval. The excerpted routes show registration of handlers and background payment and expiry tasks; the README documents the LND dependency. Several domain modules are represented by their exact source paths, but their internal calls were not sampled.

Main entry points: [`src/routes.rs`](https://github.com/yzernik/squeakroad/blob/master/src/routes.rs) (Rocket routes), [`src/models.rs`](https://github.com/yzernik/squeakroad/blob/master/src/models.rs) (Domain persistence), [`src/lightning.rs`](https://github.com/yzernik/squeakroad/blob/master/src/lightning.rs) (LND client), [`src/auth.rs`](https://github.com/yzernik/squeakroad/blob/master/src/auth.rs) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Web runtime"]
  node_server["Rocket routes<br/>[routes.rs]"]
end

subgraph group_identity["Accounts"]
  node_auth["Login and signup<br/>[auth.rs]"]
  node_activation["Account activation"]
  node_account_ops["Account controls"]
  node_account_views["Account views<br/>[account.rs]"]
  node_active_gate["Active-user guard<br/>[user_account.rs]"]
  node_user_domain["User management<br/>[user.rs]"]
end

subgraph group_market["Marketplace"]
  node_listing_create["Create listings<br/>[new_listing.rs]"]
  node_listing_manage["Listing lifecycle<br/>[listing.rs]"]
  node_listing_review["Listing review"]
  node_catalog["Browse and search<br/>[listings.rs]"]
  node_orders["Orders<br/>[order.rs]"]
  node_order_prepare["Prepare orders<br/>[prepare_order.rs]"]
  node_seller_tools["Seller history<br/>[seller_history.rs]"]
  node_admin_tools["Market administration<br/>[admin.rs]"]
end

subgraph group_money["Payments"]
  node_payment_worker["Payment processing"]
  node_expiry_workers["Order expiry<br/>[order_expiry.rs]"]
  node_withdrawals["Withdrawals<br/>[withdraw.rs]"]
  node_lightning_client["LND client<br/>[lightning.rs]"]
end

subgraph group_core["Shared services"]
  node_db[("SQLite pool<br/>[db.rs]")]
  node_models["Domain persistence<br/>[models.rs]"]
  node_base_context["Shared context<br/>[base.rs]"]
  node_config["Configuration<br/>[config.rs]"]
end

node_browser(("Browser"))
node_lnd(("LND node"))

node_browser -->|"requests pages"| node_server
node_server -->|"mounts routes"| node_auth
node_server -->|"mounts routes"| node_activation
node_server -->|"mounts routes"| node_account_ops
node_server -->|"mounts routes"| node_listing_review
node_server -->|"mounts routes"| node_orders
node_server -->|"mounts routes"| node_order_prepare
node_server -->|"mounts routes"| node_withdrawals
node_server -->|"runs task"| node_payment_worker
node_server -->|"runs task"| node_expiry_workers
node_server -->|"initializes pool"| node_db
node_auth -->|"creates account"| node_models
node_auth -->|"requests invoice"| node_lightning_client
node_account_ops -->|"sends payment"| node_lightning_client
node_listing_review -->|"loads pending listings"| node_models
node_listing_manage -->|"updates listings"| node_models
node_active_gate -->|"loads account"| node_models
node_base_context -->|"loads context data"| node_models
node_payment_worker -.->|"checks payments"| node_lightning_client
node_expiry_workers -.->|"checks invoices"| node_lightning_client
node_lightning_client -->|"connects"| node_lnd
node_models -->|"queries"| node_db
node_server -->|"manages config"| node_config
node_auth -->|"reads settings"| node_config

click node_server "https://github.com/yzernik/squeakroad/blob/master/src/routes.rs"
click node_auth "https://github.com/yzernik/squeakroad/blob/master/src/auth.rs"
click node_activation "https://github.com/yzernik/squeakroad/blob/master/src/account_activation.rs"
click node_account_ops "https://github.com/yzernik/squeakroad/blob/master/src/deactivate_account.rs"
click node_account_views "https://github.com/yzernik/squeakroad/blob/master/src/account.rs"
click node_active_gate "https://github.com/yzernik/squeakroad/blob/master/src/user_account.rs"
click node_user_domain "https://github.com/yzernik/squeakroad/blob/master/src/user.rs"
click node_listing_create "https://github.com/yzernik/squeakroad/blob/master/src/new_listing.rs"
click node_listing_manage "https://github.com/yzernik/squeakroad/blob/master/src/listing.rs"
click node_listing_review "https://github.com/yzernik/squeakroad/blob/master/src/review_pending_listings.rs"
click node_catalog "https://github.com/yzernik/squeakroad/blob/master/src/listings.rs"
click node_orders "https://github.com/yzernik/squeakroad/blob/master/src/order.rs"
click node_order_prepare "https://github.com/yzernik/squeakroad/blob/master/src/prepare_order.rs"
click node_seller_tools "https://github.com/yzernik/squeakroad/blob/master/src/seller_history.rs"
click node_admin_tools "https://github.com/yzernik/squeakroad/blob/master/src/admin.rs"
click node_payment_worker "https://github.com/yzernik/squeakroad/blob/master/src/payment_processor.rs"
click node_expiry_workers "https://github.com/yzernik/squeakroad/blob/master/src/order_expiry.rs"
click node_withdrawals "https://github.com/yzernik/squeakroad/blob/master/src/withdraw.rs"
click node_lightning_client "https://github.com/yzernik/squeakroad/blob/master/src/lightning.rs"
click node_db "https://github.com/yzernik/squeakroad/blob/master/src/db.rs"
click node_models "https://github.com/yzernik/squeakroad/blob/master/src/models.rs"
click node_base_context "https://github.com/yzernik/squeakroad/blob/master/src/base.rs"
click node_config "https://github.com/yzernik/squeakroad/blob/master/src/config.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_server,node_browser toneBlue
class node_auth,node_activation,node_account_ops,node_account_views,node_active_gate,node_user_domain toneAmber
class node_listing_create,node_listing_manage,node_listing_review,node_catalog,node_orders,node_order_prepare,node_seller_tools,node_admin_tools toneMint
class node_payment_worker,node_expiry_workers,node_withdrawals,node_lightning_client toneRose
class node_db,node_models,node_base_context,node_config,node_lnd toneIndigo
```

## Components

### Web runtime

- [Rocket routes](https://github.com/yzernik/squeakroad/blob/master/src/routes.rs): `src/routes.rs`

### Accounts

- [Login and signup](https://github.com/yzernik/squeakroad/blob/master/src/auth.rs): `src/auth.rs`
- [Account activation](https://github.com/yzernik/squeakroad/blob/master/src/account_activation.rs): `src/account_activation.rs`
- [Account controls](https://github.com/yzernik/squeakroad/blob/master/src/deactivate_account.rs): `src/deactivate_account.rs`
- [Account views](https://github.com/yzernik/squeakroad/blob/master/src/account.rs): `src/account.rs`
- [Active-user guard](https://github.com/yzernik/squeakroad/blob/master/src/user_account.rs): `src/user_account.rs`
- [User management](https://github.com/yzernik/squeakroad/blob/master/src/user.rs): `src/user.rs`

### Marketplace

- [Create listings](https://github.com/yzernik/squeakroad/blob/master/src/new_listing.rs): `src/new_listing.rs`
- [Listing lifecycle](https://github.com/yzernik/squeakroad/blob/master/src/listing.rs): `src/listing.rs`
- [Listing review](https://github.com/yzernik/squeakroad/blob/master/src/review_pending_listings.rs): `src/review_pending_listings.rs`
- [Browse and search](https://github.com/yzernik/squeakroad/blob/master/src/listings.rs): `src/listings.rs`
- [Orders](https://github.com/yzernik/squeakroad/blob/master/src/order.rs): `src/order.rs`
- [Prepare orders](https://github.com/yzernik/squeakroad/blob/master/src/prepare_order.rs): `src/prepare_order.rs`
- [Seller history](https://github.com/yzernik/squeakroad/blob/master/src/seller_history.rs): `src/seller_history.rs`
- [Market administration](https://github.com/yzernik/squeakroad/blob/master/src/admin.rs): `src/admin.rs`

### Payments

- [Payment processing](https://github.com/yzernik/squeakroad/blob/master/src/payment_processor.rs): `src/payment_processor.rs`
- [Order expiry](https://github.com/yzernik/squeakroad/blob/master/src/order_expiry.rs): `src/order_expiry.rs`
- [Withdrawals](https://github.com/yzernik/squeakroad/blob/master/src/withdraw.rs): `src/withdraw.rs`
- [LND client](https://github.com/yzernik/squeakroad/blob/master/src/lightning.rs): `src/lightning.rs`

### Shared services

- [SQLite pool](https://github.com/yzernik/squeakroad/blob/master/src/db.rs): `src/db.rs`
- [Domain persistence](https://github.com/yzernik/squeakroad/blob/master/src/models.rs): `src/models.rs`
- [Shared context](https://github.com/yzernik/squeakroad/blob/master/src/base.rs): `src/base.rs`
- [Configuration](https://github.com/yzernik/squeakroad/blob/master/src/config.rs): `src/config.rs`

### Other components

- **Browser**
- **LND node**

## Connections

- Browser → Rocket routes: requests pages (evidence: `src/routes.rs`)
- Rocket routes → Login and signup: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Account activation: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Account controls: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Listing review: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Orders: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Prepare orders: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Withdrawals: mounts routes (evidence: `src/routes.rs`)
- Rocket routes → Payment processing: runs task (evidence: `src/routes.rs`)
- Rocket routes → Order expiry: runs task (evidence: `src/routes.rs`)
- Rocket routes → SQLite pool: initializes pool (evidence: `src/routes.rs`)
- Login and signup → Domain persistence: creates account (evidence: `src/auth.rs`)
- Login and signup → LND client: requests invoice (evidence: `src/auth.rs`)
- Account controls → LND client: sends payment (evidence: `src/deactivate_account.rs`)
- Listing review → Domain persistence: loads pending listings (evidence: `src/review_pending_listings.rs`)
- Listing lifecycle → Domain persistence: updates listings (evidence: `src/listing.rs`)
- Active-user guard → Domain persistence: loads account (evidence: `src/user_account.rs`)
- Shared context → Domain persistence: loads context data (evidence: `src/base.rs`)
- Payment processing → LND client: checks payments (evidence: `src/payment_processor.rs`)
- Order expiry → LND client: checks invoices (evidence: `src/order_expiry.rs`)
- LND client → LND node: connects (evidence: `src/lightning.rs`)
- Domain persistence → SQLite pool: queries (evidence: `src/models.rs`)
- Rocket routes → Configuration: manages config (evidence: `src/routes.rs`)
- Login and signup → Configuration: reads settings (evidence: `src/auth.rs`)
