Skip to content
@home-anthill

home-anthill

Project icon by brgfx - https://www.freepik.com/free-vector/underground-ant-nest-with-red-ants_18582279.htm


home-anthill logo

Home Anthill

A self-hosted IoT home automation platform built around ESP32 devices, MQTT, Kubernetes microservices, a React dashboard, and an Android app.


Start Here

The fastest way to understand or run home-anthill is through the documentation repository:

Need Start with
Run the platform locally Local development setup
Flash and wire ESP32 devices Firmware install guide
Download the main project workspace download-full-project.sh
Seed a local development database fill-local-db.sh
Understand service flows visually Architecture diagrams
Try the HTTP APIs Bruno API collections

Quick Start: Full Checkout

Use the full-project helper when you want the main service, app, firmware, and infrastructure repositories in one local workspace:

curl -fsSLO https://raw.githubusercontent.com/home-anthill/docs/master/download-full-project.sh
sh download-full-project.sh
cd home-anthill

Then follow Local development setup to start MongoDB, Redis, RabbitMQ, Mosquitto, and the services you need.

After api-server and admission are running, seed sample homes, rooms, devices, and assignments with:

curl -fsSLO https://raw.githubusercontent.com/home-anthill/docs/master/fill-local-db.sh
chmod +x fill-local-db.sh
./fill-local-db.sh "<JWT_VALUE>" "oauth_session=<COOKIE_VALUE>"

fill-local-db.sh defaults to API_SERVER=http://localhost:8082 and ADMISSION_SERVER=http://localhost:8099; override those environment variables if your local services use different addresses.

What Is Home Anthill?

home-anthill is a full-stack home automation project for collecting sensor data, controlling devices, tracking device presence, and sending mobile notifications.

The system starts at the edge: ESP32 microcontrollers run firmware for sensors, controllers, or hybrid devices. They communicate over MQTT with a backend that validates, routes, stores, and exposes device state through APIs. Users interact with the platform through a web dashboard and an Android app backed by GitHub OAuth2 authentication.

The project is intentionally split into focused repositories. Each service owns a small part of the system, while the docs and deployer repositories explain how to run everything together locally or on Kubernetes.

What It Can Do

  • Register homes, rooms, devices, profiles, and sensors.
  • Collect temperature, humidity, motion, light, air pressure, and air quality readings from ESP32 devices.
  • Control supported devices, including infrared air conditioners and thermostat-style controllers.
  • Track whether devices are online by consuming signed MQTT presence messages.
  • Store sensor history in MongoDB and online state in Redis.
  • Send Firebase Cloud Messaging notifications when monitored devices go offline.
  • Provide REST and gRPC APIs for web, mobile, and service-to-service workflows.
  • Run locally with Docker-based infrastructure or in production on a K3s Kubernetes cluster.

Security Model

Device and service messages are designed around signed payloads rather than trusted plaintext messages:

  • MQTT sensor and presence messages include signed payloads with timestamp, nonce, and HMAC validation.
  • producer forwards MQTT messages into RabbitMQ, and consumer verifies RabbitMQ message HMACs before applying side effects.
  • consumer and online-receiver use Redis SET NX EX replay keys to reject reused signed nonces.
  • Public user-facing APIs use GitHub OAuth2 and JWT-backed sessions.
  • Profile device API tokens are stored hashed and encrypted in MongoDB, not as plaintext token fields.

Production deployments terminate public TLS at the Kubernetes ingress layer. Internal service traffic is expected to run inside the cluster network.

Firmware Types

The ESP32 firmware repository contains multiple device roles:

Type Purpose
sensors Read environmental values such as temperature, humidity, light, air quality, motion, and air pressure.
controllers Control devices such as air conditioners through supported IR protocols.
hybrid Combine sensing and control in one ESP32 device.
thermostat Coordinate temperature sensing and control-oriented behavior.

Supported controller work includes Beko RG52A9/BGEF and LG AKB74955603 style IR remotes, with firmware integration built on crankyoldgit/IRremoteESP8266.

Core Repositories

Repository Language Role
api-server Go Central REST API for homes, rooms, devices, profiles, auth, and web/mobile workflows.
api-devices Go gRPC service for device registration and MQTT value publishing.
admission Go REST and gRPC gateway for admitting/registering devices and sensors.
register Rust Sensor registration and sensor data retrieval backed by MongoDB.
producer Rust MQTT-to-RabbitMQ bridge for sensor/event ingestion.
consumer Rust RabbitMQ consumer that verifies and persists sensor messages into MongoDB.
online Rust REST API for device online state, Redis-backed presence, and FCM token management.
online-receiver Rust MQTT-to-Redis service that records signed device presence updates.
online-alarm Rust Offline-device monitor that sends Firebase Cloud Messaging notifications.
gui TypeScript / React Web dashboard for homes, rooms, devices, sensors, and account workflows.
app Kotlin / Android Android app with GitHub OAuth2, device management, and push notifications.
firmwares C++ / Arduino ESP32 firmware for sensors, controllers, thermostat, and hybrid devices.

Infrastructure And Tooling

Repository Purpose
docs Architecture diagrams, local setup guides, deployment docs, firmware install docs, and API collections.
deployer Helm chart for deploying the full platform to Kubernetes.
mosquitto Mosquitto MQTT broker image with a dynamic auth entrypoint.
sharded-mongodb-compose Docker Compose setup for the local sharded MongoDB cluster used by development and tests.
k8s-config-reloader Kubernetes sidecar that watches mounted ConfigMaps/Secrets and signals another process on change.
esp32-configurator Python CLI that generates ESP32 C header configuration from YAML.
mqtt-communication-checker Interactive local helper that publishes signed MQTT messages and checks MongoDB/Redis effects.

How The Data Flows

  1. An ESP32 publishes signed MQTT sensor or presence data to Mosquitto.
  2. producer receives sensor messages and writes them to RabbitMQ.
  3. consumer verifies message integrity and replay state, then stores sensor values in MongoDB.
  4. online-receiver receives presence messages, verifies them, and updates Redis.
  5. online exposes online state and FCM token APIs.
  6. online-alarm checks Redis for offline devices and sends mobile notifications.
  7. api-server, api-devices, and admission manage user-facing device, home, room, profile, and registration workflows.
  8. gui and app give users web and mobile access to the same backend.

Documentation

Guide Description
Local development setup Run the supporting infrastructure and services on a development machine.
Architecture diagrams Visual diagrams for registration, control, sensor ingestion, notifications, and the overall platform.
Firmware install Wire hardware, configure Arduino tooling, and flash ESP32 firmware.
Hetzner / K8s deployment Deploy the platform to a K3s cluster with ingress, TLS, and supporting infrastructure.
Bruno API collections Ready-to-run API requests for local and deployed environments.

For a full local checkout, see docs/download-full-project.sh, which clones the main service, app, firmware, and infrastructure repositories into one workspace.

Technology Snapshot

Layer Technologies
Edge devices ESP32, Arduino C++, MQTT
Backend services Go, Rust, REST, gRPC, Protobuf
Web and mobile React, Mantine, Redux Toolkit, Android, Kotlin, Jetpack Compose
Messaging Mosquitto MQTT, RabbitMQ
Data stores MongoDB, Redis
Infrastructure Docker, Helm, Kubernetes/K3s, NGINX Gateway Fabric, Cilium, cert-manager

Development Notes

Most repositories include their own README and service-specific development guidance. In general:

  • Go and Rust services use make build and make test where available.
  • The React dashboard uses npm, Vite, Nx, Vitest, React Testing Library, and MSW.
  • Android builds use Gradle and Jetpack Compose.
  • Firmware builds use arduino-cli and generated configuration headers.
  • Local integration testing depends on MongoDB, Redis, RabbitMQ, and Mosquitto running with the documented local settings.

Next Steps

The current roadmap is tracked in the public home-anthill project board. Use the board as the source of truth for planned work, active items, completed work, and priority changes across repositories.

Very High

Item Repository
if a poweroutage is registered, you should be able to remove it also from redis to prevent infinite offline notifications home-anthill/api-server
support real time notifications also from 'motion' sensors Draft item
controller features must be configurable from admission service with 'props' Draft item

High

Item Repository
add oled display to all firmwares home-anthill/firmwares
add sharing home options to invite other users to use your home Draft item

Medium

Item Repository
add online feature to all devices, instead of a specific power-outage device Draft item
add gas CH4 sensor home-anthill/firmwares

Low

Item Repository
find better names for all repos/services Draft item
improve accessibility of web app and android app Draft item

Pinned Loading

  1. docs docs Public

    Shell

Repositories

Showing 10 of 20 repositories

Top languages

Loading…

Most used topics

Loading…