Real-time power plant telemetry dashboard built with:
| Layer | Stack |
|---|---|
| Backend API | Python 3.12 + FastAPI + SQLAlchemy (async) |
| Database | PostgreSQL 16 |
| MQTT Broker | Eclipse Mosquitto 2.0 |
| Ingestion | Python async service (paho-mqtt + asyncpg) |
| Frontend | React 18 + Vite + Tailwind CSS + Recharts |
| Deployment | Docker Compose + Nginx |
cp .env.example .env
# Edit .env — set POSTGRES_PASSWORD at minimum
docker compose up --build- Dashboard: http://localhost
- API docs: http://localhost:8000/docs
- Health check: http://localhost/health
- MQTT broker: localhost:1883
The simulator starts automatically and publishes test data every 5 seconds.
SOL/
├── backend/ FastAPI application
│ └── app/
│ ├── core/ Settings (pydantic-settings)
│ ├── db/ SQLAlchemy engine + session
│ ├── models/ ORM models
│ ├── schemas/ Pydantic request/response schemas
│ └── api/routes/ REST endpoints
├── mqtt-ingestion/ MQTT subscriber → PostgreSQL writer
├── simulator/ Fake telemetry publisher (dev/testing)
├── database/ init.sql (schema + seed data)
├── frontend/ React + Vite SPA
│ └── src/
│ ├── api/ Axios client helpers
│ └── components/ Dashboard, charts, alarms
├── mosquitto/config/ Mosquitto broker config
├── docs/ Deployment guide
├── docker-compose.yml All services
├── .env.example Environment variable template
└── .gitignore
powerplant/{plant_id}/{device_type}/{device_id}
Payload (JSON):
{
"metrics": {
"power_output_mw": 145.3,
"frequency_hz": 50.01
},
"timestamp": "2024-01-15T10:30:00Z"
}The ingestion service auto-creates plant and device records on first message.
| Method | Path | Description |
|---|---|---|
| GET | /health | Health + DB check |
| GET | /api/plants | List plants |
| POST | /api/plants | Create plant |
| GET | /api/devices?plant_id= | List devices |
| GET | /api/readings?device_id=&metric=&since_minutes= | Time-series |
| GET | /api/readings/latest?plant_id= | Latest reading per metric |
| GET | /api/alarms?plant_id=&acknowledged= | List alarms |
| PATCH | /api/alarms/{id}/acknowledge | Acknowledge alarm |
Full interactive docs: http://localhost:8000/docs
See docs/deployment.md for step-by-step GoDaddy VPS instructions.