# taubyte/tau architecture

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

- Interactive diagram: https://gitdiagram.com/taubyte/tau
- Repository: https://github.com/taubyte/tau

## Overview

#### Purpose and Entry Points
Taubyte is a Go-based distributed application platform: developers define projects/resources, build code into WebAssembly or web assets, and deploy/run them across a cloud providing functions, web hosting, KV databases, object storage, and pub/sub. The root node binary enters at `main.go` and CLI/node lifecycle at `cli/app/app.go`, `cli/node/node.go`, and `cli/node/start.go`. User-facing developer workflows are primarily the Tau CLI (`tools/tau/main.go`) and local multi-node “Dream” environment (`tools/dream/main.go`, `dream/universe.go`).

#### Node Composition and Service Plane
A running node composes named platform services through shared core abstractions in `core/services/types.go` and per-service implementations. The main service plane includes:
- identity, projects, repositories, certificates, and GitHub integration: `services/auth/service.go`, `services/auth/http.go`, `services/auth/github.go`;
- deployment/build coordination: `services/patrick/service.go`, `services/patrick/jobs.go`;
- artifact/content replication: `services/hoarder/service.go`, `services/hoarder/placement.go`;
- topology, health, DNS, geo routing: `services/seer/service.go`, `services/seer/dns.go`;
- configuration namespace: `services/tns/service.go`, `services/tns/engine/run.go`;
- request/data execution substrate: `services/substrate/service.go`, `services/substrate/components.go`.

#### Configuration, Project Model, and Publication Flow
Project configuration is represented as structured resources—applications, functions, websites, databases, storage, messaging, services, and smart operations—under `pkg/schema/project/types.go` and resource-specific schema packages such as `pkg/schema/functions/types.go` and `pkg/schema/databases/types.go`. Specs map these declarations to platform naming, paths, and runtime contracts in `pkg/specs/structure/application.go` and `pkg/specs/methods/tns.go`.

The typical control flow is: Tau CLI edits/clones Git-backed project/config repositories; Auth authorizes repository/project operations; configuration is pushed to TNS; Patrick consumes changes as build jobs; Monkey executes build/compile jobs and publishes output to Hoarder; Substrate resolves deployed definitions and serves them. Relevant boundaries: `tools/tau/lib/project/push_config.go`, `services/tns/push.go`, `services/monkey/jobs/run.go`, `services/hoarder/assets.go`.

#### Build and Execution Runtime
Monkey is the build worker and job processor, with code, library, website, configuration, and WebAssembly job paths under `services/monkey/jobs/code.go`, `services/monkey/jobs/website.go`, and `services/monkey/jobs/wasm_helpers.go`. Container backends isolate builds and workloads behind a common manager, with Docker and containerd implementations in `pkg/containers/backend_manager.go`, `pkg/containers/backends/docker/docker.go`, and `pkg/containers/backends/containerd/containerd.go`.

At serving time, Substrate routes HTTP, P2P, pub/sub, database, storage, and IPFS-oriented operations to deployed modules. Its runtime instantiates/caches modules in `services/substrate/runtime/instantiate.go` and `services/substrate/runtime/cache/cache.go`; endpoint-specific dispatch lives in `services/substrate/components/http/function/function.go` and `services/substrate/components/http/website/website.go`. The generic VM layer supports module loading and multiple artifact backends in `pkg/vm/runtime.go`, `pkg/vm/loaders/loader.go`, and `pkg/vm/backend/dfs/backend.go`.

#### Distributed Data and Networking
The platform is peer-to-peer: node primitives provide libp2p-style peers, DAGs, pub/sub, and stream transport in `p2p/peer/peer.go`, `p2p/peer/pubsub.go`, and `p2p/streams/command/router/router.go`. Hoarder manages placement, membership, reconciliation, and replicated assets; its persistence path uses the CRDT/Merkle KV database in `services/hoarder/kvdb.go` and `pkg/kvdb/merklecrdt.go`. Raft is separately available for clustered coordination in `pkg/raft/cluster.go` and `pkg/raft/fsm.go`.

#### APIs, Tooling, and Deployment Infrastructure
Taucorder exposes node/service operations as protobuf/Connect APIs, with contracts in `pkg/taucorder/proto/taucorder/v1/*.proto` and handlers in `pkg/taucorder/service/handlers.go`. Generated JavaScript clients mirror these APIs under `pkg/taucorder/clients/js/src/Taucorder.ts`. Dream supplies local in-process service universes plus HTTP/MCP control interfaces via `dream/service.go`, `dream/api/api.go`, and `dream/mcp/service.go`.

Spore Drive is the deployment/control-plane subsystem for configuring and displacing workloads across hosts, with Connect APIs and language clients rooted at `pkg/spore-drive/proto/drive/v1/drive.proto`, `pkg/spore-drive/drive/service/serve.go`, and `pkg/spore-drive/clients/py/spore_drive/drive.py`. External integrations include Git/GitHub (`services/auth/github_client.go`), ACME certificate handling (`services/auth/api_acme.go`), Docker/containerd, IPFS-oriented storage components, and host networking/firewall controls (`pkg/netguard/netguard.go`).

Main entry points: [`core/services/types.go`](https://github.com/taubyte/tau/blob/main/core/services/types.go) (Service core), [`services/hoarder/service.go`](https://github.com/taubyte/tau/blob/main/services/hoarder/service.go) (Hoarder), [`services/tns/service.go`](https://github.com/taubyte/tau/blob/main/services/tns/service.go) (TNS), [`tools/tau/main.go`](https://github.com/taubyte/tau/blob/main/tools/tau/main.go) (Tau CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dev["Developer workflows"]
  node_tau["Tau CLI<br/>developer CLI<br/>[main.go]"]
  node_dream["Dream<br/>local multi-node runtime<br/>[universe.go]"]
end

subgraph group_node["Node control plane"]
  node_node_lifecycle{{"Node lifecycle<br/>node bootstrap<br/>[start.go]"}}
  node_service_core["Service core<br/>service abstractions<br/>[types.go]"]
  node_auth["Auth and GitHub<br/>identity service<br/>[service.go]"]
  node_tns[("TNS<br/>configuration namespace<br/>[service.go]")]
  node_patrick["Patrick<br/>deployment coordinator<br/>[jobs.go]"]
  node_seer["Seer<br/>topology and routing<br/>[service.go]"]
end

subgraph group_build["Build and artifacts"]
  node_project_schema["Project resources<br/>configuration schema<br/>[types.go]"]
  node_specs["Platform specs<br/>resource mapping<br/>[application.go]"]
  node_monkey["Monkey<br/>build worker<br/>[run.go]"]
  node_containers["Container manager<br/>isolation backend<br/>[backend_manager.go]"]
  node_hoarder[("Hoarder<br/>artifact replication<br/>[service.go]")]
end

subgraph group_runtime["Execution and data plane"]
  node_substrate{{"Substrate<br/>request execution service"}}
  node_module_runtime["Module runtime<br/>module lifecycle<br/>[instantiate.go]"]
  node_vm["VM and loaders<br/>execution engine<br/>[runtime.go]"]
  node_p2p["P2P primitives<br/>peer network<br/>[peer.go]"]
  node_merkle_kv[("Merkle CRDT KV<br/>replicated database<br/>[merklecrdt.go]")]
end

subgraph group_ops["APIs and deployment"]
  node_taucorder["Taucorder<br/>node operations API<br/>[handlers.go]"]
  node_spore_drive["Spore Drive<br/>workload control plane<br/>[serve.go]"]
end

node_tau -->|"edits"| node_project_schema
node_project_schema -->|"mapped by"| node_specs
node_tau -->|"repository operations"| node_auth
node_tau -->|"pushes configuration"| node_tns
node_dream -->|"runs locally"| node_node_lifecycle
node_node_lifecycle -->|"composes"| node_service_core
node_service_core -->|"hosts"| node_auth
node_service_core -->|"hosts"| node_tns
node_service_core -->|"hosts"| node_patrick
node_service_core -->|"hosts"| node_seer
node_service_core -->|"hosts"| node_substrate
node_tns -->|"configuration changes"| node_patrick
node_patrick -->|"build jobs"| node_monkey
node_monkey -->|"isolates jobs"| node_containers
node_monkey -->|"publishes artifacts"| node_hoarder
node_hoarder -->|"persists replication state"| node_merkle_kv
node_hoarder -->|"replicates over"| node_p2p
node_substrate -->|"resolves definitions"| node_tns
node_substrate -->|"dispatches to"| node_module_runtime
node_module_runtime -->|"loads modules"| node_vm
node_vm -->|"loads artifacts"| node_hoarder
node_substrate -->|"P2P and pub/sub"| node_p2p
node_seer -->|"routes requests"| node_substrate
node_taucorder -->|"operates node services"| node_node_lifecycle
node_spore_drive -->|"places workloads"| node_containers

click node_tau "https://github.com/taubyte/tau/blob/main/tools/tau/main.go"
click node_dream "https://github.com/taubyte/tau/blob/main/dream/universe.go"
click node_node_lifecycle "https://github.com/taubyte/tau/blob/main/cli/node/start.go"
click node_service_core "https://github.com/taubyte/tau/blob/main/core/services/types.go"
click node_auth "https://github.com/taubyte/tau/blob/main/services/auth/service.go"
click node_tns "https://github.com/taubyte/tau/blob/main/services/tns/service.go"
click node_patrick "https://github.com/taubyte/tau/blob/main/services/patrick/jobs.go"
click node_seer "https://github.com/taubyte/tau/blob/main/services/seer/service.go"
click node_project_schema "https://github.com/taubyte/tau/blob/main/pkg/schema/project/types.go"
click node_specs "https://github.com/taubyte/tau/blob/main/pkg/specs/structure/application.go"
click node_monkey "https://github.com/taubyte/tau/blob/main/services/monkey/jobs/run.go"
click node_containers "https://github.com/taubyte/tau/blob/main/pkg/containers/backend_manager.go"
click node_hoarder "https://github.com/taubyte/tau/blob/main/services/hoarder/service.go"
click node_module_runtime "https://github.com/taubyte/tau/blob/main/services/substrate/runtime/instantiate.go"
click node_vm "https://github.com/taubyte/tau/blob/main/pkg/vm/runtime.go"
click node_p2p "https://github.com/taubyte/tau/blob/main/p2p/peer/peer.go"
click node_merkle_kv "https://github.com/taubyte/tau/blob/main/pkg/kvdb/merklecrdt.go"
click node_taucorder "https://github.com/taubyte/tau/blob/main/pkg/taucorder/service/handlers.go"
click node_spore_drive "https://github.com/taubyte/tau/blob/main/pkg/spore-drive/drive/service/serve.go"

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_tau,node_dream toneBlue
class node_node_lifecycle,node_service_core,node_auth,node_tns,node_patrick,node_seer toneAmber
class node_project_schema,node_specs,node_monkey,node_containers,node_hoarder toneMint
class node_substrate,node_module_runtime,node_vm,node_p2p,node_merkle_kv toneRose
class node_taucorder,node_spore_drive toneIndigo
```

## Components

### Developer workflows

- [Tau CLI](https://github.com/taubyte/tau/blob/main/tools/tau/main.go): developer CLI · Edits, clones, and publishes project configuration. · `tools/tau/main.go`
- [Dream](https://github.com/taubyte/tau/blob/main/dream/universe.go): local multi-node runtime · Runs in-process platform universes for local development. · `dream/universe.go`

### Node control plane

- [Node lifecycle](https://github.com/taubyte/tau/blob/main/cli/node/start.go): node bootstrap · Starts the platform node and composes its services. · `cli/node/start.go`
- [Service core](https://github.com/taubyte/tau/blob/main/core/services/types.go): service abstractions · Shared contracts for named node services. · `core/services/types.go`
- [Auth and GitHub](https://github.com/taubyte/tau/blob/main/services/auth/service.go): identity service · Authorizes project and repository operations. · `services/auth/service.go`
- [TNS](https://github.com/taubyte/tau/blob/main/services/tns/service.go): configuration namespace · Publishes and serves platform configuration. · `services/tns/service.go`
- [Patrick](https://github.com/taubyte/tau/blob/main/services/patrick/jobs.go): deployment coordinator · Consumes configuration changes as build jobs. · `services/patrick/jobs.go`
- [Seer](https://github.com/taubyte/tau/blob/main/services/seer/service.go): topology and routing · Provides health, DNS, geo-routing, and topology. · `services/seer/service.go`

### Build and artifacts

- [Project resources](https://github.com/taubyte/tau/blob/main/pkg/schema/project/types.go): configuration schema · Defines deployable applications and resource declarations. · `pkg/schema/project/types.go`
- [Platform specs](https://github.com/taubyte/tau/blob/main/pkg/specs/structure/application.go): resource mapping · Maps declarations to platform paths and contracts. · `pkg/specs/structure/application.go`
- [Monkey](https://github.com/taubyte/tau/blob/main/services/monkey/jobs/run.go): build worker · Builds code, websites, configuration, and WebAssembly jobs. · `services/monkey/jobs/run.go`
- [Container manager](https://github.com/taubyte/tau/blob/main/pkg/containers/backend_manager.go): isolation backend · Selects Docker or containerd for isolated builds and workloads. · `pkg/containers/backend_manager.go`
- [Hoarder](https://github.com/taubyte/tau/blob/main/services/hoarder/service.go): artifact replication · Places, reconciles, and replicates published assets. · `services/hoarder/service.go`

### Execution and data plane

- **Substrate**: request execution service · Routes deployed HTTP, P2P, pub/sub, database, and storage operations.
- [Module runtime](https://github.com/taubyte/tau/blob/main/services/substrate/runtime/instantiate.go): module lifecycle · Instantiates and caches deployed modules. · `services/substrate/runtime/instantiate.go`
- [VM and loaders](https://github.com/taubyte/tau/blob/main/pkg/vm/runtime.go): execution engine · Loads modules through multiple artifact backends. · `pkg/vm/runtime.go`
- [P2P primitives](https://github.com/taubyte/tau/blob/main/p2p/peer/peer.go): peer network · Provides peers, DAGs, pub/sub, and stream transport. · `p2p/peer/peer.go`
- [Merkle CRDT KV](https://github.com/taubyte/tau/blob/main/pkg/kvdb/merklecrdt.go): replicated database · Persists Hoarder state using CRDT/Merkle storage. · `pkg/kvdb/merklecrdt.go`

### APIs and deployment

- [Taucorder](https://github.com/taubyte/tau/blob/main/pkg/taucorder/service/handlers.go): node operations API · Exposes node and service operations through Connect APIs. · `pkg/taucorder/service/handlers.go`
- [Spore Drive](https://github.com/taubyte/tau/blob/main/pkg/spore-drive/drive/service/serve.go): workload control plane · Configures and displaces workloads across hosts. · `pkg/spore-drive/drive/service/serve.go`

## Connections

- Tau CLI → Project resources: edits
- Project resources → Platform specs: mapped by
- Tau CLI → Auth and GitHub: repository operations
- Tau CLI → TNS: pushes configuration
- Dream → Node lifecycle: runs locally
- Node lifecycle → Service core: composes
- Service core → Auth and GitHub: hosts
- Service core → TNS: hosts
- Service core → Patrick: hosts
- Service core → Seer: hosts
- Service core → Substrate: hosts
- TNS → Patrick: configuration changes
- Patrick → Monkey: build jobs
- Monkey → Container manager: isolates jobs
- Monkey → Hoarder: publishes artifacts
- Hoarder → Merkle CRDT KV: persists replication state
- Hoarder → P2P primitives: replicates over
- Substrate → TNS: resolves definitions
- Substrate → Module runtime: dispatches to
- Module runtime → VM and loaders: loads modules
- VM and loaders → Hoarder: loads artifacts
- Substrate → P2P primitives: P2P and pub/sub
- Seer → Substrate: routes requests
- Taucorder → Node lifecycle: operates node services
- Spore Drive → Container manager: places workloads
