Architecture — the crate map
This is the one-diagram floor doc: the crates and the arrows between them. The full rationale lives in docs/planning-artifacts/architecture.md; the decisions are recorded as ADRs in docs/adr/.
Dependency direction (the invariant)
apps → {ui, domain-core, substrate}; within librariesui → domain-core → substrate; never upward, neverui → substrate.
Build-enforced by tests/dep_direction.rs. Libraries layer strictly downward (rank substrate=0 → domain-core=1 → ui=2); apps and services are leaves that nothing internal may depend on.
┌─────────────────────────────────────────────┐
│ apps / services │
│ │
│ apps/organizer (wasm) apps/organizer/ │
│ ── frontend ──┐ src-tauri (native) │ services/relay
│ │ │ │ (build-deferred)
└─────────────────┼──────────────┼─────────────┘
│ │
depends on │ │ depends on
▼ ▼
┌───────────────┐ ┌───────────────┐
│ crates/ui │ │ crates/ │
│ (rank 2) │ │ substrate │
└───────┬───────┘ │ (rank 0) │
│ └───────▲────────┘
depends on│ │ (allowed, currently unused:
▼ │ domain-core → substrate)
┌───────────────┐ │
│ crates/ │───────────┘
│ domain-core │
│ (rank 1) │
└───────────────┘
Legend: arrows = "depends on". The ONLY internal library edge that exists today is
ui → domain-core. substrate and domain-core depend on nothing internal. The wasm
frontend never pulls substrate (keeps llama-cpp-2/rusqlite out of the browser build).
What each crate owns
| crate | kind | owns | depends on (internal) |
|---|---|---|---|
|
lib |
every trait boundary: |
— |
|
lib |
shared entities; no IO; |
— |
|
lib |
Leptos component library + Tailwind v4 design tokens (single home) |
|
|
app (wasm) |
the Leptos CSR shell; reaches the core via async Tauri commands |
|
|
app (native) |
the Tauri host process; wires |
|
|
service |
zero-knowledge sync relay (Axum) — build-deferred |
— |