Appearance
5. Building Block View
This section lists the major building blocks in the repo and how they relate.
Level 1: System decomposition
- Desktop app (
desktop/)desktop/soma: the only Electron app. The typing companion (Tapia) is delivered as the/practiceroute inside this app.
- Backend workspace (
backend/)backend/bins/somad: the only standalone backend binary (subcommands for bot / relay / rendezvous / bff / all-composed mode).backend/crates/daemonandbackend/crates/agentd: library crates (no binary) hosting the desktop peer + agent runtimes; linked intobackend/crates/soma-node.- Shared crates under
backend/crates/*(peer runtime, storage, networking, metrics, …).
- Protocols (
proto/): protobuf service and message definitions. - Deployment (
deploy/,compose/,Dockerfile): helm charts, compose bundles, container images forsomad.
Level 2: Backend artifacts
Server binary
backend/bins/somad(somad)- Single binary with
bot/relay/rendezvous/bff/allsubcommands. Replaces the former per-servicesoma-botd,soma-relayd,soma-rendezvousd,soma-bffd,soma-serverdbinaries. botmode: libp2p peer with cache-only blob behaviour (VDF role) + Axum HTTP surface for info/health/metrics; optional admin control plane inadminmode.relaymode: libp2p Circuit Relay v2 server + Axum health/metrics.rendezvousmode: libp2p Rendezvous server + Axum health/metrics.bffmode: Axum business API for LLM-facing features.allmode: TOML-composed multi-mode runner.
- Single binary with
Desktop runtime (in-process via napi)
backend/crates/soma-node(@soma/node): napi-rs cdylib loaded by the Electron main process. Embeds the daemon + agent libraries; exposes oneSomaHandleto JS.backend/crates/daemon(soma-daemon, library only): libp2p peer identity, blob store, repositories, event bus. In-processDaemonHandlefacade for the napi addon.backend/crates/agentd(soma-agentd, library only): Yjs drift resolver and agent runtime. In-processAgentHandlefacade for the napi addon.
Level 3: Key shared crates
backend/crates/peer(soma-peer): libp2p behaviour wiring, protocol IDs, peer command/event loop.backend/crates/net(soma-net): transport and identity helpers (e.g., default identity path).backend/crates/membership(soma-membership): join deciders, policies, capability flows.backend/crates/storage(soma-storage): SQL repositories and migrations.backend/crates/vdfs(soma-vdfs): blob provider boundary and CAS helpers (name kept for historical reasons).backend/crates/metrics(soma-metrics): Prometheus metrics router helpers.backend/crates/proto-build(soma-proto-build): compile-time prost/tonic bindings forproto/(used for record types; the desktop side no longer uses any tonic service stubs).