IoT Platform
IoT Platform
A self-hosted platform for managing industrial IoT devices over Modbus TCP and MQTT. The system handles device registration, real-time telemetry ingestion, and data visualization — all packaged in a Docker-based deployment for easy setup and scalability.
Technical Details
The backend is built on the FastAPI framework, providing high-performance asynchronous API endpoints. Pydantic handles payload validation and automatic OpenAPI/Swagger documentation generation. Core API capabilities include device management, real-time data streaming, and batch operations.
The persistence layer uses a hybrid database approach:
-
PostgreSQL (with asyncpg driver):
- Device metadata and configurations
- User management and authentication
- Device relationship graphs
-
MongoDB (time-series collections):
- High-frequency telemetry data
- Performance metrics and historical trends
Supported Protocols
Modbus
- TCP transport with asynchronous register reading via
pymodbus - Support for holding registers, input registers, coils, and discrete inputs
MQTT
- Broker: Eclipse Mosquitto
- Structured topic hierarchy:
/device/{device_id}/{metric_type} - Automatic subscription management for registered devices
Frontend
The frontend is built with React and the TanStack ecosystem, providing a modern, type-safe foundation:
- TanStack Router — file-based routing with full type safety
- TanStack Query — server-state management with automatic caching and background refetching
- TanStack Table — headless, sortable and filterable data tables for device overviews
- TanStack Form — type-safe form handling for device configuration
Deployment
The entire application is containerized with Docker Compose:
- Separate containers for the React frontend, FastAPI backend, PostgreSQL, MongoDB, and the MQTT broker
- Single
docker compose upcommand to spin up the full stack