How block/buzz works
Purpose and entry points
Buzz is a self-hostable, Nostr-based collaboration workspace where people, agents, workflows, git activity, and media become signed events on a community-scoped relay. The primary server entry point is crates/buzz-relay/src/main.rs; Rust workspace membership and binaries are defined by Cargo.toml. Main client entry points are the Tauri desktop app (desktop/src/main.tsx, desktop/src-tauri/src/main.rs), Flutter mobile app (mobile/lib/main.dart), web Git/invite client (web/src/main.tsx), and agent-oriented CLI (crates/buzz-cli/src/main.rs).
Relay as authoritative event boundary
buzz-relay is the system of record and protocol/API boundary: it accepts WebSocket Nostr traffic and REST operations for channels, events, media, workflows, git, admin, and invitations. Routing and shared runtime state are centered in crates/buzz-relay/src/router.rs, crates/buzz-relay/src/state.rs, and crates/buzz-relay/src/handlers/ingest.rs. Event ingestion applies admission, authz/moderation, persistence, subscriptions, and side effects; APIs expose specialized HTTP surfaces under crates/buzz-relay/src/api/.
Protocol, identity, and tenancy
Core domain types, event kinds, channel/filter semantics, identity presence, and pairing live in the I/O-free buzz-core crate: crates/buzz-core/src/event.rs, crates/buzz-core/src/channel.rs, and crates/buzz-core/src/tenant.rs. Authentication uses Nostr NIP-42/NIP-98 and replay/rate-limit protections in crates/buzz-auth/src/nip42.rs, crates/buzz-auth/src/nip98.rs, and crates/buzz-auth/src/rate_limit.rs. Tenant/community isolation is host-derived at the relay boundary; shared backing services must not create a user-visible cross-community namespace.
Persistence, distribution, and audit
Postgres persists events and domain projections, migrations, partitioning, and repository/workflow state through crates/buzz-db/src/lib.rs, crates/buzz-db/src/event.rs, and crates/buzz-db/src/partition.rs; schema evolution is in migrations/. Redis-backed pub/sub distributes live events, presence, typing, cache invalidation, and connection control via crates/buzz-pubsub/src/publisher.rs and crates/buzz-pubsub/src/subscriber.rs. Search is Postgres FTS (crates/buzz-search/src/query.rs), while tamper-evident action/event history is handled by crates/buzz-audit/src/service.rs.
Collaboration and project services
Channels, DMs, threads, reactions, moderation, and feeds share the signed-event substrate. Relay handlers translate events into domain effects (crates/buzz-relay/src/handlers/event.rs, crates/buzz-relay/src/handlers/moderation_commands.rs). Git hosting is an HTTP/event bridge with object-store-oriented pack/CAS handling in crates/buzz-relay/src/api/git/transport.rs, crates/buzz-relay/src/api/git/cas_publish.rs, and crates/buzz-relay/src/api/git/store.rs. Media validates/uploads records and produces thumbnails through crates/buzz-media/src/upload.rs, crates/buzz-media/src/storage.rs, and crates/buzz-media/src/thumbnail.rs.
Agents, automation, and mesh compute
Agents use the same identities and event channels as users. buzz-cli is the JSON-oriented automation client; buzz-acp bridges ACP clients to Buzz/MCP (crates/buzz-acp/src/main.rs, crates/buzz-acp/src/relay.rs); buzz-agent implements agent runtime/configuration (crates/buzz-agent/src/agent.rs, crates/buzz-agent/src/mcp.rs). Workflow definitions/execution are isolated in crates/buzz-workflow/src/schema.rs and crates/buzz-workflow/src/executor.rs. Optional relay mesh/shared model routing is provided by crates/buzz-relay-mesh/src/runtime.rs and relay boot integration in crates/buzz-relay/src/mesh_boot.rs.
Client and deployment boundaries
The desktop app is the richest client: React feature modules call a Tauri Rust backend, which owns local state, secrets, relay sync, managed agent processes, and native media/audio capabilities (desktop/src/shared/api/relayClient.ts, desktop/src-tauri/src/event_sync.rs, desktop/src-tauri/src/managed_agents/runtime.rs). Mobile independently implements Nostr relay/session behavior in Flutter (mobile/lib/shared/relay/relay_client.dart). Deployment targets Docker Compose and Kubernetes Helm, provisioning Postgres, Redis, and S3-compatible MinIO/object storage: deploy/compose/compose.yml, deploy/charts/buzz/templates/deployment.yaml, and deploy/charts/buzz/templates/quickstart-minio.yaml.
Main entry points: router.rs Relay router & state · ingest.rs Event ingestion · lib.rs Postgres · compose.yml Deployment targets
Components 21
Clients & automation
- Desktop React app
desktop/src/main.tsx - Desktop native backend · Owns local state, sync, secrets, agents, and native media.
desktop/src-tauri/src/main.rs - Mobile app
mobile/lib/main.dart - Web Git & invite client
web/src/main.tsx - Automation CLI
crates/buzz-cli/src/main.rs - ACP & agent runtime · Bridges ACP/MCP clients and runs Buzz agents.
crates/buzz-acp/src/main.rs
Authoritative relay
- Relay router & state · Community-scoped API and Nostr protocol entry point.
crates/buzz-relay/src/router.rs - Event ingestion · Applies admission, authorization, persistence, subscriptions, and side effects.
crates/buzz-relay/src/handlers/ingest.rs
Domain services
- Core protocol domain · Defines signed events, channels, filters, identity, pairing, and tenancy.
crates/buzz-core/src/event.rs - Nostr auth & limits · NIP-42/NIP-98 authentication with replay and rate-limit protection.
crates/buzz-auth/src/nip42.rs - Collaboration effects · Channels, DMs, threads, reactions, feeds, and moderation.
crates/buzz-relay/src/handlers/event.rs - Git bridge & CAS · Publishes packs and objects through object-store-oriented CAS.
crates/buzz-relay/src/api/git/transport.rs - Media pipeline · Validates uploads, records media, and creates thumbnails.
crates/buzz-media/src/upload.rs - Workflow executor
crates/buzz-workflow/src/executor.rs - Relay mesh
crates/buzz-relay-mesh/src/runtime.rs - Postgres FTS
crates/buzz-search/src/query.rs - Tamper-evident audit
crates/buzz-audit/src/service.rs
Backing infrastructure
- Postgres · Persists events, projections, partitions, repository, and workflow state.
crates/buzz-db/src/lib.rs - Redis pub/sub · Distributes events, presence, typing, invalidation, and connection control.
crates/buzz-pubsub/src/publisher.rs - S3-compatible storage · Provisioned as MinIO in quickstart deployments.
deploy/charts/buzz/templates/quickstart-minio.yaml - Deployment targets · Deploys relay with Postgres, Redis, and object storage.
deploy/compose/compose.yml
Connections 31
- Desktop React app → Desktop native backend: invokes
- Desktop native backend → Relay router & state: relay sync
- Mobile app → Relay router & state: Nostr sessions
- Web Git & invite client → Relay router & state: Git & invites
- Automation CLI → Relay router & state: automation events
- ACP & agent runtime → Relay router & state: agent events
- Relay router & state → Event ingestion: signed events
- Relay router & state → Git bridge & CAS: Git API
- Relay router & state → Media pipeline: media API
- Relay router & state → Workflow executor: workflow API
- Relay router & state → Nostr auth & limits: authenticates
- Relay router & state → Core protocol domain: host-derived tenant context
- Event ingestion → Core protocol domain: validates semantics
- Event ingestion → Nostr auth & limits: authorizes
- Event ingestion → Postgres: persists events
- Event ingestion → Redis pub/sub: publishes live updates
- Event ingestion → Collaboration effects: domain effects
- Event ingestion → Tamper-evident audit: records history
- Collaboration effects → Postgres: updates projections
- Git bridge & CAS → Postgres: repository state
- Git bridge & CAS → S3-compatible storage: packs & CAS objects
- Media pipeline → S3-compatible storage: uploads & thumbnails
- Media pipeline → Postgres: media records
- Workflow executor → Postgres: definitions & runs
- Postgres FTS → Postgres: FTS queries
- Relay router & state → Postgres FTS: search API
- Relay router & state → Relay mesh: optional routing
- Deployment targets → Relay router & state: deploys
- Deployment targets → Postgres: provisions
- Deployment targets → Redis pub/sub: provisions
- Deployment targets → S3-compatible storage: provisions