openhome

Architecture

openhome is a local-first monorepo. Every component runs on the home box; the cloud

is optional and opt-in.

                          ┌─────────────────────────────┐
                          │        apps/app             │
                          │   web + mobile control UI   │
                          └──────────────┬──────────────┘
                                         │ HTTPS / WebSocket
                          ┌──────────────▼──────────────┐
                          │        services/hub         │
                          │  ┌───────────────────────┐  │
                          │  │      Agent loop       │  │  ← local LLM (Ollama)
                          │  │  monitor · automate · │  │     or cloud (opt-in)
                          │  │  answer · notify      │  │
                          │  └───────────────────────┘  │
                          │  REST API · rules engine ·  │
                          │  event bus · auth           │
                          └───┬──────────────┬──────────┘
                              │ MQTT         │ SQL / files
              ┌───────────────▼──┐   ┌───────▼──────────────┐
              │ device-gateway   │   │      storage         │
              │ Matter · Zigbee  │   │ recordings · backups │
              │ Z-Wave · ONVIF   │   │ metadata DB (SQLite/ │
              │ RTSP · MQTT      │   │ Postgres)            │
              └───┬────┬────┬────┘   └──────────────────────┘
                  │    │    │
              cameras locks lights ...   (integrations/)

Principles

  1. Local-first. The LAN is the source of truth. Internet outage ≠ home outage.
  2. Event-driven. Devices publish events to an MQTT bus; the hub subscribes and reacts.
  3. Protocol-agnostic core. The hub speaks a normalized device schema

(packages/shared); adapters translate vendor protocols into it.

  1. Agent as operator, not gatekeeper. The agent automates and informs. Safety-

critical actions (unlock door, disable alarm) require explicit policy + confirmation.

  1. Privacy by construction. Video/audio never leaves the box unless a user

explicitly enables a cloud feature for a specific stream.

Components

services/hub — the brain

notifications. Model is pluggable: local (Ollama) by default, cloud opt-in.

sensitive actions.

services/device-gateway — the hands

Adapter processes that bridge physical protocols to the MQTT bus using the shared

device schema. Planned adapters:

services/storage — the NAS layer

apps/app — the face

packages/shared — the contract

Data flows

Event: device → gateway adapter → MQTT → hub bus → (rules + agent + app push).

Command: app/agent → hub API → MQTT command topic → gateway adapter → device.

Agent query ("who was at the door at 2pm?"): agent → storage (clip search) +

device metadata → LLM → answer, with the source clip linked in the app.

Cloud, when you want it

Cloud is a per-feature toggle, never a requirement:

cloud in the middle.