# romainb82/laruche-domotique architecture

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

- Interactive diagram: https://gitdiagram.com/romainb82/laruche-domotique
- Repository: https://github.com/romainb82/laruche-domotique

## Overview

Domotique is a local-first smart-home control system, with a Vue PWA and a native iOS client sharing a server and domain contract. The main workflow is residents signing in, viewing house/device state, and sending commands; the server dispatches commands through interchangeable simulated or hardware adapters and publishes confirmed state. Configuration, accounts, history, cameras, scheduling, and HomeKit are distinct capabilities. Edges reflect excerpted calls, SOURCE INDEX references, or README statements; some unsampled subsystem details and runtime wiring are therefore omitted.

Main entry points: [`packages/server/src/index.ts`](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/index.ts) (HTTP and WS API), [`packages/app/src/App.vue`](https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/App.vue) (Web shell), [`packages/server/src/state.ts`](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/state.ts) (State hub), [`packages/server/src/adapters/homeassistant.ts`](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/homeassistant.ts) (Home Assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Resident clients"]
  node_webapp["Web shell<br/>[App.vue]"]
  node_web_routes["Web routes<br/>[router.ts]"]
  node_web_settings["Web settings<br/>[SettingsView.vue]"]
  node_ios_store["iOS house state<br/>[HouseStore.swift]"]
  node_ios_client["iOS API client<br/>[DomoClient.swift]"]
  node_ios_house["iOS house view<br/>[HouseView.swift]"]
  node_ios_room["iOS room view<br/>[RoomView.swift]"]
  node_ios_plan["iOS floor plan"]
end

subgraph group_server["Server runtime"]
  node_server_api["HTTP and WS API<br/>[index.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_state["State hub<br/>[state.ts]"]
  node_database[("SQLite store<br/>[db.ts]")]
  node_scheduler["Scheduler<br/>[planificateur.ts]"]
  node_cameras["Camera access<br/>[cameras.ts]"]
  node_homekit["HomeKit bridge<br/>[homekit.ts]"]
end

subgraph group_hardware["Device channels"]
  node_driver_contract["Driver contract<br/>[driver.ts]"]
  node_sim_driver["Simulation driver<br/>[sim.ts]"]
  node_adapter_contract["Adapter contract<br/>[adapter.ts]"]
  node_mqtt["MQTT adapter<br/>[mqtt.ts]"]
  node_http_adapter["HTTP adapter<br/>[http.ts]"]
  node_modbus["Modbus adapter<br/>[modbus.ts]"]
  node_homeassistant["Home Assistant<br/>[homeassistant.ts]"]
end

subgraph group_domain["House domain"]
  node_shared_types["Shared domain types<br/>[types.ts]"]
  node_shared_config["House configuration<br/>[config.ts]"]
  node_house_seed["Reference house seed<br/>[seed.ts]"]
  node_energy["Energy domain<br/>[energie.ts]"]
end

node_resident(("Resident"))

node_resident -->|"uses"| node_webapp
node_resident -->|"uses"| node_ios_house
node_webapp -->|"hosts"| node_web_routes
node_web_routes -->|"routes to"| node_web_settings
node_web_routes -->|"guards access"| node_resident
node_ios_house -->|"renders"| node_ios_plan
node_ios_house -->|"renders"| node_ios_room
node_ios_room -->|"reads state"| node_ios_store
node_ios_store -->|"calls"| node_ios_client
node_ios_client -->|"HTTP requests"| node_server_api
node_webapp -.->|"uses API"| node_server_api
node_server_api -->|"authenticates"| node_auth
node_server_api -->|"serves state"| node_state
node_server_api -->|"reads and writes"| node_database
node_server_api -->|"configures"| node_scheduler
node_server_api -->|"requests snapshots"| node_cameras
node_server_api -->|"forwards state"| node_homekit
node_state -->|"persists state"| node_database
node_state -->|"uses driver"| node_driver_contract
node_state -->|"uses registry"| node_adapter_contract
node_sim_driver -->|"implements"| node_driver_contract
node_homeassistant -->|"extends"| node_adapter_contract
node_homeassistant -->|"uses types"| node_shared_types
node_homeassistant -.->|"selected channel"| node_server_api
node_mqtt -.->|"selected channel"| node_server_api
node_http_adapter -.->|"selected channel"| node_server_api
node_modbus -.->|"selected channel"| node_server_api
node_server_api -->|"loads configuration"| node_shared_config
node_house_seed -->|"builds seed"| node_shared_config
node_webapp -->|"shares contract"| node_shared_types
node_server_api -->|"shares contract"| node_shared_types

click node_webapp "https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/App.vue"
click node_web_routes "https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/router.ts"
click node_web_settings "https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/views/SettingsView.vue"
click node_ios_store "https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/DomoKit/Sources/DomoKit/HouseStore.swift"
click node_ios_client "https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/DomoKit/Sources/DomoKit/DomoClient.swift"
click node_ios_house "https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/Maison/Sources/Views/HouseView.swift"
click node_ios_room "https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/Maison/Sources/Views/RoomView.swift"
click node_ios_plan "https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/Maison/Sources/Views/HousePlanView.swift"
click node_server_api "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/index.ts"
click node_auth "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/auth.ts"
click node_state "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/state.ts"
click node_database "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/db.ts"
click node_scheduler "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/planificateur.ts"
click node_cameras "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/cameras.ts"
click node_homekit "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/homekit.ts"
click node_driver_contract "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/drivers/driver.ts"
click node_sim_driver "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/drivers/sim.ts"
click node_adapter_contract "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/adapter.ts"
click node_mqtt "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/mqtt.ts"
click node_http_adapter "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/http.ts"
click node_modbus "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/modbus.ts"
click node_homeassistant "https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/homeassistant.ts"
click node_shared_types "https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/types.ts"
click node_shared_config "https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/config.ts"
click node_house_seed "https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/seed.ts"
click node_energy "https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/energie.ts"

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_webapp,node_web_routes,node_web_settings,node_ios_store,node_ios_client,node_ios_house,node_ios_room,node_ios_plan toneBlue
class node_server_api,node_auth,node_state,node_database,node_scheduler,node_cameras,node_homekit toneAmber
class node_driver_contract,node_sim_driver,node_adapter_contract,node_mqtt,node_http_adapter,node_modbus,node_homeassistant toneMint
class node_shared_types,node_shared_config,node_house_seed,node_energy toneRose
class node_resident toneIndigo
```

## Components

### Resident clients

- [Web shell](https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/App.vue): `packages/app/src/App.vue`
- [Web routes](https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/router.ts): `packages/app/src/router.ts`
- [Web settings](https://github.com/romainb82/laruche-domotique/blob/main/packages/app/src/views/SettingsView.vue): `packages/app/src/views/SettingsView.vue`
- [iOS house state](https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/DomoKit/Sources/DomoKit/HouseStore.swift): `packages/ios/DomoKit/Sources/DomoKit/HouseStore.swift`
- [iOS API client](https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/DomoKit/Sources/DomoKit/DomoClient.swift): `packages/ios/DomoKit/Sources/DomoKit/DomoClient.swift`
- [iOS house view](https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/Maison/Sources/Views/HouseView.swift): `packages/ios/Maison/Sources/Views/HouseView.swift`
- [iOS room view](https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/Maison/Sources/Views/RoomView.swift): `packages/ios/Maison/Sources/Views/RoomView.swift`
- [iOS floor plan](https://github.com/romainb82/laruche-domotique/blob/main/packages/ios/Maison/Sources/Views/HousePlanView.swift): `packages/ios/Maison/Sources/Views/HousePlanView.swift`

### Server runtime

- [HTTP and WS API](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/index.ts): `packages/server/src/index.ts`
- [Authentication](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/auth.ts): `packages/server/src/auth.ts`
- [State hub](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/state.ts): `packages/server/src/state.ts`
- [SQLite store](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/db.ts): `packages/server/src/db.ts`
- [Scheduler](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/planificateur.ts): `packages/server/src/planificateur.ts`
- [Camera access](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/cameras.ts): `packages/server/src/cameras.ts`
- [HomeKit bridge](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/homekit.ts): `packages/server/src/homekit.ts`

### Device channels

- [Driver contract](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/drivers/driver.ts): `packages/server/src/drivers/driver.ts`
- [Simulation driver](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/drivers/sim.ts): `packages/server/src/drivers/sim.ts`
- [Adapter contract](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/adapter.ts): `packages/server/src/adapters/adapter.ts`
- [MQTT adapter](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/mqtt.ts): `packages/server/src/adapters/mqtt.ts`
- [HTTP adapter](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/http.ts): `packages/server/src/adapters/http.ts`
- [Modbus adapter](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/modbus.ts): `packages/server/src/adapters/modbus.ts`
- [Home Assistant](https://github.com/romainb82/laruche-domotique/blob/main/packages/server/src/adapters/homeassistant.ts): `packages/server/src/adapters/homeassistant.ts`

### House domain

- [Shared domain types](https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/types.ts): `packages/shared/src/types.ts`
- [House configuration](https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/config.ts): `packages/shared/src/config.ts`
- [Reference house seed](https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/seed.ts): `packages/shared/src/seed.ts`
- [Energy domain](https://github.com/romainb82/laruche-domotique/blob/main/packages/shared/src/energie.ts): `packages/shared/src/energie.ts`

### Other components

- **Resident**

## Connections

- Resident → Web shell: uses (evidence: `README.md`)
- Resident → iOS house view: uses (evidence: `README.md`)
- Web shell → Web routes: hosts (evidence: `packages/app/src/main.ts`)
- Web routes → Web settings: routes to (evidence: `packages/app/src/router.ts`)
- Web routes → Resident: guards access (evidence: `packages/app/src/router.ts`)
- iOS house view → iOS floor plan: renders (evidence: `packages/ios/Maison/Sources/Views/HouseView.swift`)
- iOS house view → iOS room view: renders (evidence: `packages/ios/Maison/Sources/Views/HouseView.swift`)
- iOS room view → iOS house state: reads state (evidence: `packages/ios/Maison/Sources/Views/RoomView.swift`)
- iOS house state → iOS API client: calls (evidence: `packages/ios/DomoKit/Sources/DomoKit/HouseStore.swift`)
- iOS API client → HTTP and WS API: HTTP requests (evidence: `packages/ios/DomoKit/Sources/DomoKit/DomoClient.swift`)
- Web shell → HTTP and WS API: uses API
- HTTP and WS API → Authentication: authenticates (evidence: `packages/server/src/index.ts`)
- HTTP and WS API → State hub: serves state (evidence: `packages/server/src/index.ts`)
- HTTP and WS API → SQLite store: reads and writes (evidence: `packages/server/src/index.ts`)
- HTTP and WS API → Scheduler: configures (evidence: `packages/server/src/index.ts`)
- HTTP and WS API → Camera access: requests snapshots (evidence: `packages/server/src/index.ts`)
- HTTP and WS API → HomeKit bridge: forwards state (evidence: `packages/server/src/index.ts`)
- State hub → SQLite store: persists state (evidence: `packages/server/src/state.ts`)
- State hub → Driver contract: uses driver (evidence: `packages/server/src/state.ts`)
- State hub → Adapter contract: uses registry (evidence: `packages/server/src/state.ts`)
- Simulation driver → Driver contract: implements (evidence: `packages/server/src/drivers/sim.ts`)
- Home Assistant → Adapter contract: extends (evidence: `packages/server/src/adapters/homeassistant.ts`)
- Home Assistant → Shared domain types: uses types (evidence: `packages/server/src/adapters/homeassistant.ts`)
- Home Assistant → HTTP and WS API: selected channel (evidence: `README.md`)
- MQTT adapter → HTTP and WS API: selected channel (evidence: `README.md`)
- HTTP adapter → HTTP and WS API: selected channel (evidence: `README.md`)
- Modbus adapter → HTTP and WS API: selected channel (evidence: `README.md`)
- HTTP and WS API → House configuration: loads configuration (evidence: `packages/server/src/index.ts`)
- Reference house seed → House configuration: builds seed (evidence: `packages/shared/src/seed.ts`)
- Web shell → Shared domain types: shares contract (evidence: `packages/app/src/App.vue`)
- HTTP and WS API → Shared domain types: shares contract (evidence: `packages/server/src/index.ts`)
