Reeve Docs

Docs / Architecture

Architecture

Reeve is a self-hosted home-automation platform. One backend owns the household's devices, automations, scenes, dashboards, accounts and access control; two first-party clients present them; and drivers and sidecar workloads reach the actual hardware. Devices, automations and access are core. Protocols are not: every vendor integration is a plugin. This page is the map of the system: what each part owns, which way the dependencies point, how a value travels in each direction, and which principles a change must keep. The topic pages below hold the detail and the rules.

Scope

This repository is the platform. It holds:

  • the backend (backend/): an ASP.NET Core application on .NET 11, run as one or more identical replicas;
  • the web client (frontend/): a React single-page application, also installable as a PWA;
  • the Android companion (mobile/): a .NET MAUI application over a platform-free core;
  • the plugin SDK: the .NET packages Reeve.PluginAbstractions, Reeve.PluginAuthoring and Reeve.Contracts, the WebAssembly contract of record (wit/) and the guest SDKs for Go, Python, Rust and the Node workload client (sdk/);
  • the services that run beside the backend (services/): the adapter wire-protocol contract packages and the Matter bridge;
  • the deployment artefacts (deploy/: Docker Compose and the Helm chart) and the repository tooling (tools/: the plugin development CLI; templates/: the plugin template).

It holds no plugin source. Every plugin lives in its own repository.

Where it sits among the Reeve repositories

Reeve is federated: the platform and every plugin, library and catalogue live in their own repositories and release on their own cadence. Nothing in this repository's build assumes a sibling checkout. The repositories meet only through published artefacts: versioned SDK and library packages, the minimum host version every plugin manifest declares, and the plugin index.

Repository Kind What it provides to the platform
reeve platform the backend, the clients, the plugin SDK, the services, the deployment artefacts
reeve-cluster library (NuGet) single-replica semantics over 1..N replicas on one PostgreSQL: membership, placed units, held slots, the change log (cluster)
reeve-workloads library (NuGet) the workload engine: manifest grammar, providers, reconciler (workloads)
reeve-workflow library (NuGet, npm) the workflow engine and the graph editor (automation)
reeve-pipeline library (NuGet) ordered stages with compensation, walked from a durable journal (the plugin update pipeline)
reeve-advisory-locks library (NuGet) typed PostgreSQL advisory locks for EF Core and Npgsql
reeve-testkit library (NuGet) the in-process test harness and recording fakes for plugin authors
reeve-common-plugins plugins lightweight in-process plugins, each released independently as an OCI artefact
reeve-plugin-matter plugin the Matter controller and Thread commissioning
reeve-plugin-z-wave plugin the Z-Wave integration (plugin plus sidecar)
reeve-plugin-bt plugin Bluetooth Low Energy (plugin plus sidecar that owns the radio)
reeve-plugin-discovery-host plugin network and USB discovery beyond mDNS (SSDP, USB, DHCP)
reeve-plugin-spotify plugin a Spotify output plugin
reeve-plugin-virtual-devices plugin a household of simulated devices for demos and end-to-end tests
reeve-index catalogue the official discovery index of plugins, widgets and blueprints
reeve-blueprints catalogue the official starter blueprints (parametrised workflow templates)
reeve-widgets catalogue the official sandboxed custom dashboard widgets
reeve-matter-vendors catalogue vendor packs (cluster XML and binding manifests) for the Matter plugin

A cross-repository problem is fixed by releasing: bump the SDK version, raise a plugin's minimum host version, or publish a release. Cross-repository decisions are recorded here; the other repositories hold only their own.

Building blocks

Clients render and command. They hold no domain logic and no credential beyond a session cookie (or, for automation clients, a personal access token). The backend owns everything that must be true for the whole household: identity and access, the canonical device model, automations and scenes, history, the real-time fan-out, and the lifecycle of everything beside it. The estate runs beside the backend: plugins loaded into its process, sidecar workloads it deploys and supervises, and the shared stores.

Tier What runs there What it owns
Clients the web SPA, the Android companion, and any Matter controller paired with the bridge presentation and local UI state; nothing another client could disagree about (clients)
Backend one ASP.NET Core application, N interchangeable replicas identity and access, the device model, automations, persistence, real time, the estate's lifecycle
Estate plugins in the backend's process; sidecar workloads on Kubernetes, Docker or run by hand; PostgreSQL with TimescaleDB, Redis, an MQTT broker vendor protocols, hardware-bound radios and heavy native runtimes, all durable and ephemeral storage

The backend is layered, with one-way dependencies (layering and dependencies):

Project Role
Reeve.Domain entities, the permission catalogue, invariants; the dependency root
Reeve.Application use cases and the interfaces the outer ring implements; never touches storage or transport
Reeve.Infrastructure EF Core and the persistence model, authentication, the plugin host, the workflow engine host, the workload reconciler, broker and cache clients
Reeve.Api controllers, the real-time hubs, middleware, the composition root
Reeve.Contracts DTOs, the canonical device records and the generated capability catalogue; referenced by every tier, plugins and the mobile core included
Reeve.PluginAbstractions, Reeve.PluginAuthoring the published plugin SDK: the host facade a plugin sees, and optional driver conveniences
Reeve.Ble.Decoding, Reeve.Discovery.Contracts the BLE advertisement decoding library and the discovery contracts plugins share

No backend project references a plugin. Plugins reach the host only at run time, through the plugin host.

Runtime model

How a reading reaches a screen

A vendor message arrives at the plugin that owns the device: over the broker, a socket, a poll or a sidecar's gateway session. The plugin is the driver: it translates the vendor payload into canonical state (a real boolean, a canonical enum token, a number in its canonical unit) and hands the host that state, the raw payload verbatim, and the per-instance capability availability descriptor that says what this device actually exposes (device model).

The host writes the source's current-state row, a telemetry sample on a hypertable, and, when the value changed and the report is not older than the stored one, a notification to the real-time hub. The hub delivers it to the subscribers allowed to see that device; each client patches its cached entry and the bound tile, drawer or widget re-renders. Above the plugin nothing parses a vendor key or coerces a wire value, which is why adding a vendor is a plugin and nothing else.

Momentary events (a button press, a scene-controller activation) carry no state and never enter that path. They travel on a separate device-event channel that automations subscribe to.

How a command reaches a device

A client posts canonical capability assignments for a logical device. The device service resolves the caller's access through the single access evaluator (authorization) before anything else, then validates each assignment against the target's availability descriptor; an absent capability, an out-of-range number or a token outside the instance's set is refused server-side. The command goes to the logical device's active source, and the plugin encodes it onto the vendor wire. When the owning instance runs on another replica, the command is a durable row and the owner is nudged to deliver it (cluster). The device's new value arrives separately, over the reading path. The only other way to write is the untranslated raw-property escape hatch.

When several sources of one logical device declare the same capability, the device's capability is controllable if any source controls it, and its name, unit and allowed values come from the declaring source with the best priority (the lowest priority number, ties broken by source id), whichever source reported last.

Where plugins attach

A plugin is a driver plus whatever it chooses to contribute: devices, trigger types, workflow blocks, discovery matchers, configuration flows and server-driven views. It is installed from an OCI registry behind the publisher index, verified by content, and loaded either as a .NET assembly in a collectible load context or as a WebAssembly module. What it can reach is a set of capabilities keyed by the permission codes the operator granted, and an ungranted capability is absent. A plugin contributes no code to either client. Detail: plugins, plugin trust.

Where workloads attach

A plugin that needs code outside the backend process declares a deployment section in its manifest: a closed, versioned schema of managed workloads, each pinned by image digest. A reconciler renders it for the installation's provider (Kubernetes, a local Docker daemon, or manual, where the operator applies rendered artefacts) and checks on every pass that the desired spec stays inside the profile the operator consented to. The workload dials back over one WebSocket session authenticated by a per-instance token and holds no broker credentials. Hardware-bound integrations and heavy native runtimes run there; a protocol that is only a network socket stays in process (workloads, integrations).

Persistence

PostgreSQL with TimescaleDB holds everything durable: relational tables and hypertables for telemetry and event series, with the schema applied at boot. Redis is mandatory and holds only state that is safe to lose or rebuild: sessions, caches, flows, rate-limit counters, coordination claims and the real-time backplane. Blob-shaped state goes to a namespaced object store backed by the database, a filesystem or an S3-compatible endpoint. An optional read replica serves reporting-shaped reads, never security-sensitive ones. Detail: data.

Real time and replicas

Each client holds one hub connection, opened without negotiation, so any replica can take it and no session affinity is needed. Replicas are interchangeable: nothing correctness-critical lives in one replica's memory, PostgreSQL arbitrates ownership and liveness, the cluster library places work that must run once, and Redis carries only lossy hints. Configuration-derived state is rebuilt from the cluster change log into generations, and a configuration write is answered once every serving replica has applied it. Builds overlap during a rolling upgrade inside a window; anything else is a full stop. Detail: cluster.

Principles

The rules a change must not break are catalogued in constraints, each with what enforces it. The principles they serve:

  • Core owns the vocabulary; plugins translate. The canonical device vocabulary is closed and core-owned, and nothing above a driver sees a vendor value.
  • The logical device is the identity. Everything a person or an automation targets addresses a logical device; sources are feeds, and merging them is explicit.
  • One store of record. PostgreSQL is authoritative for data and for cluster state; nothing that matters lives only in Redis or in one process's memory.
  • Contracts grow additively. Published contracts and persisted enums change by appending, so built plugins and stored rows keep working.
  • The operator is the source of trust. A native plugin is trusted code, a WASM plugin is sandboxed, workloads run on informed consent, and nothing pretends to be a boundary it is not (known limitations).
  • Deny by default at the edges. Permissions are a closed catalogue checked in services, outbound connections to private addresses are refused unless allowed, and secrets at rest go through purpose-isolated protectors (network egress, secrets and audit).
  • Gates degrade open; destructive steps fail closed. A check that only protects latency or tidiness lets work through when its dependency is down; a step that deletes or overwrites stops.
  • Reeve exports, the infrastructure keeps. Backups, monitoring stacks and disk watching belong to the operator's infrastructure; Reeve exports telemetry and readiness.
  • Refuse rare cases. A case no real data reaches is refused with a clear diagnostic rather than handled by a mechanism that costs code and tests for as long as it exists.

Two things that fail silently

Each produces a system that looks healthy and is wrong, with no error to follow:

  • A Matter mapper that writes a cluster it did not declare on the endpoint plan freezes every control on that device; a Matter node with no declared device type never advertises (Matter bridge).
  • The camera media proxy is the only path to a frame: no client learns a workload address, the proxy follows no redirects, and media routes take only the session cookie (camera media).

Pages

Page Covers
constraints.md the rule catalogue: layering, plugins, devices, data, concurrency, rolling upgrades, host composition, testing
device-model.md the canonical vocabulary, physical and logical layers, sources and merging, availability, state, model changes
device-drivers.md the driver contract: what a plugin must do to expose a device
plugins.md the plugin host: lanes, install convergence, grants, distribution, flows, health
workloads.md the workload abstraction, providers, consent, updates, the gateway session, observation replication
integrations.md integration topology, the session plane, discovery, Bluetooth; the Matter bridge is in reference
camera-media.md cameras, the media proxy contract, transports; the shared media plane is in reference
camera-webrtc-signalling.md WebRTC negotiation through the host
baby-monitor.md the baby monitor: alarms, sessions, delivery
automation.md workflows, triggers, runs, helpers, scenes, utility metering, blueprints
data.md persistence, time series, retention, object storage, alerts and system status
cluster.md active-active replicas: ownership, the hint bus, fencing, safe mode, the plugin roll
applied-snapshots.md declared configuration stored as immutable versions, served by a reconciler, with secrets protected per field
clients.md the web application and the Android companion
security/ authentication, authorization, network egress, plugin trust, secrets and audit, known limitations
glossary.md the vocabulary, and what separates the confusable terms

Elsewhere: reference (one page per module), development (building, testing, writing plugins), operations (deploying and running Reeve).