How t0bst4r/home-assistant-matter-hub works
Project type and purpose
• This is a full-stack, monorepo IoT integration platform (“Home-Assistant-Matter-Hub”) that simulates Matter bridges for Home Assistant entities.
• It exposes HA entities over the Matter protocol to local controllers (Apple Home, Google Home, Alexa) without port forwarding.
File structure
• Root
• pnpm/Nx monorepo config (pnpm-workspace.yaml, nx.json, biome.json)
• workspace-wide scripts and CI (.github/workflows, utils/build)
• apps/docker
• Two Dockerized deployment modes: “addon” (Home Assistant addon) and “standalone”
• Build scripts, Dockerfiles, entrypoint
• apps/home-assistant-matter-hub
• CLI package to scaffold or publish the HA addon
• packages/common
• Shared TypeScript definitions: clusters, schemas, device and HA entity types
• packages/backend
• Core Bridge Service (Node.js/TS)
• CLI entrypoint (cli.ts, bootstrap.ts, start-command.ts)
• API adapters: HTTP web-API (web-api.ts, web-ui.ts), Matter bridge service (bridge-server-node.ts), Home Assistant client (home-assistant-client.ts)
• Persistence: custom & legacy storage adapters, migrations
• Matter behaviors and device definitions (in matter/behaviors and matter/devices)
• packages/frontend
• React (Vite) single-page app to manage bridges and devices
• State management with Redux (slices for bridges/devices), API hooks, UI components
• packages/docs
• Static documentation site source
README
• Describes the core use case: publish HA entities as Matter devices on the local network.
• Points to online docs for installation and guides.
a. Main components
• External Systems: Home Assistant, Matter Controllers (e.g., Apple Home)
• Backend Service
• HTTP API layer
• Matter Bridge Service
• Home Assistant Client
• Storage & Migrations
• CLI/Bootstrap
• Frontend SPA
• Shared Library (common types & schemas)
• Deployment Artifacts: Docker images (addon & standalone)
b. Relationships & interactions
• Frontend ⇄ Backend HTTP API
• Backend ⇄ Home Assistant via REST/WebSocket client
• Backend ⇄ Matter Controllers via mDNS and Matter server node
• Backend ⇄ Storage (read/write configs & state, run migrations)
• CLI initiates Backend bootstrap (registers MDNS, loads behaviors/devices)
• Both frontend and backend import shared types from “common”
c. Architectural patterns
• Monorepo modularization (apps vs packages)
• Hexagonal/adaptor pattern in the backend (core logic decoupled from storage & network)
• Redux/Flux in the frontend for predictable state
• Docker for packaging two deployment modes
d. Key technologies
• Node.js + TypeScript, Vite, React
• Redux, React Query (via custom hooks)
• pnpm, Nx, Biome (lint/build)
• Docker, shell scripts, mDNS (zeroconf)
Detailed pointers
• Bootstrap sequence: CLI loads environment → runs start-handler → registers mDNS → instantiates bridge-service → syncs HA entities → exposes Matter endpoints.
• Matter Device Manager grouping multiple device behaviors and clusters.
• Storage migration pipeline under the storage adapter.
• Extension points: the custom-behaviors folder and the shared schemas for extensibility.
• Call out the Docker build steps (build.sh scripts) for the addon vs standalone modes.