This repository contains a functional prototype of a microgrid monitoring system per product_spec.md.
- Python 3.10+
- Docker Desktop
- Flutter SDK (for the mobile app)
# Create and activate virtual environment
py -3 -m venv venv
.\venv\Scripts\Activate.ps1
# Install dependencies
pip install -r requirements.txt# Start InfluxDB and Mosquitto
docker compose up -d
# Start backend API
uvicorn backend.main:app --reload
# Start data simulator (in new terminal)
python .\simulator\data_simulator.pycd mobile
flutter pub get
flutter run# Run verification tests
python test_verification.py- URL: http://localhost:8000
- Docs: http://localhost:8000/docs
- Endpoints:
POST /api/login- AuthenticationGET /api/dashboard/realtime- Live KPIsGET /api/dashboard/alerts- Active alertsGET /api/dashboard/historical- Historical data
- InfluxDB: http://localhost:8086 (admin/adminpassword)
- Mosquitto MQTT: tcp://localhost:1883
Create .env file (optional, defaults work for local development):
INFLUX_URL=http://localhost:8086
INFLUX_ORG=solnova
INFLUX_BUCKET=solnova
INFLUX_TOKEN=your-token-here
MQTT_BROKER_HOST=localhost
MQTT_BROKER_PORT=1883
SIMULATOR_INTERVAL_SECONDS=5backend/— FastAPI service with MQTT ingest and InfluxDBsimulator/— Data simulator scriptmobile/— Flutter app with login and dashboardtest_verification.py— Verification tests
- Input validation on all endpoints
- Token-based authentication
- CORS configuration for mobile app
- Environment variable configuration
- No hardcoded secrets in code
- Backend won't start: Check if InfluxDB is running (
docker compose up -d) - No data in dashboard: Ensure simulator is running
- Flutter build errors: Run
flutter clean && flutter pub get - API connection issues: Check CORS settings and network connectivity
- Follow
rules.md. The spec is the single source of truth. - Never commit secrets. Use
.envfor local configuration. - This is a prototype - not production-ready.