Architecture

AutomateIt is a set of small .NET 10 services running as containers on Kubernetes. One API holds the business logic, one service per family of equipment speaks to the hardware, and Dapr carries the messages between them. Everything is built, tested and deployed from Git.

Services

  • API: the only place with business logic. Minimal APIs on ASP.NET Core, an OpenAPI description, and a SignalR hub that pushes every change to the screens that show it.
  • Web host: serves the Blazor app (rendered on the server first, then in WebAssembly) and acts as a backend-for-frontend: it signs the user in and calls the API for the browser, so tokens never reach the browser.
  • Device services: one small service per family of equipment, all built on the same hosting library. Each one translates between the API's commands and the equipment's own protocol, has a simulator that can be switched on at run time, and refuses commands rather than guessing while its equipment is unreachable.

Communication

  • Commands go from the API to a device service by Dapr service invocation.
  • Readings and events come back as messages on Kafka, through Dapr pub/sub; the latest value of every reading is kept in a Redis state store, each service with its own store and credentials.
  • Push, not poll: equipment that can report a change does so; only hardware that cannot is polled.
  • To the screens: the API pushes changes over SignalR to the web app, the wall screens and atHouse.

Data

PostgreSQL through Entity Framework Core. The building's configuration (rooms, names, actions, device types, access profiles) lives in the database, not in code, and is edited in the app. The schema changes only through migrations, applied before the API starts. Every change is protected by optimistic concurrency and idempotency keys, so a double click or a retried request never acts twice.

Security

  • Sign-in through OpenID Connect; atHouse uses the authorization-code flow with PKCE and keeps its tokens in the Keychain.
  • The identity provider only says who you are; what you may see and do is decided by access profiles in AutomateIt, per screen and per operation.
  • Only the API's public routes are exposed; the messaging between services stays inside the cluster.
  • Secrets are stored encrypted in Git and decrypted only inside the cluster.

Observability

Every service reports traces, metrics and logs with OpenTelemetry, collected in Prometheus and Loki and shown in Grafana. Health checks tell Kubernetes when a service is ready and alive.

Delivery: GitOps

  1. A pull request runs the full build and every test; the main branch accepts nothing else.
  2. The pipeline in Azure DevOps builds, tests and analyses the code with SonarQube. A red quality gate stops the release.
  3. The .NET SDK builds the container images directly (no Dockerfile, a non-root user) and pushes them to a private registry.
  4. The pipeline writes the new version to a GitOps repository; Argo CD rolls it out and the pipeline waits until every service is synced and healthy before it tags the release.
  5. The pipeline never writes to the cluster itself. A rollback is a Git revert, and the platform itself is described in Terraform.

atHouse has its own pipeline on Mac build agents: tests, then TestFlight, then private distribution.

Quality in figures

18test projects
≈ 87 %line coverage
≥ 80 %coverage required on new code
0new issues allowed by the quality gate

Next: how the code is organised, in clean architecture.