A real-time IoT analytics platform built with Go, Apache Kafka, and React. This system simulates IoT devices, processes telemetry data using stream processing, and visualizes metrics through an interactive dashboard.
- Real-time Data Streaming: Apache Kafka message broker
- Stream Processing: 1-minute windowed aggregations
- REST API: Go-based API server
- Interactive Dashboard: React frontend with live charts
- Scalable Architecture: Microservices design
- Docker Support: Easy setup with Docker Compose
βββββββββββββββ ββββββββββββ ββββββββββββββ ββββββββββββ
β Producer β ββββΆ β Kafka β ββββΆ β Aggregator β ββββΆ β Kafka β
β (5 devices) β β (raw) β β (windows) β β (agg) β
βββββββββββββββ ββββββββββββ ββββββββββββββ ββββββββββββ
β
βΌ
ββββββββββββββββ
β API Server β
β (REST API) β
ββββββββββββββββ
β
βΌ
ββββββββββββββββ
β Frontend β
β (React) β
ββββββββββββββββ
# Complete setup (installs dependencies, starts Kafka)
./scripts/setup.sh# See all available commands
make help
# Install dependencies
make install
# Start Kafka
make kafka-up
# Run individual services
make producer # Terminal 1
make aggregator # Terminal 2
make api # Terminal 3
make frontend # Terminal 4
# Check service status
make status
# Run all backend services at once
make all
# Run tests
make test
# Stop Kafka
make kafka-down# Complete automated setup
./scripts/setup.sh
# Check all service status
./scripts/check-status.sh
# Test API endpoints
./scripts/test-api.sh
# Start all services (requires tmux)
./scripts/start-all.sh- Clone the repository
git clone https://github.com/berylm1/iot-analytics-dashboard.git
cd iot-analytics-dashboard- Start Kafka
docker-compose up -d- Install Go dependencies
go mod download- Install Frontend dependencies
cd frontend
npm install
cd ..Open 4 separate terminals:
Terminal 1 - Producer:
go run cmd/producer/main.goTerminal 2 - Aggregator:
go run cmd/aggregator/main.goTerminal 3 - API Server:
go run cmd/api/main.goTerminal 4 - Frontend:
cd frontend
npm startOpen your browser to: http://localhost:3000
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/api/aggregations |
GET | Get recent aggregations (query: ?limit=N) |
/api/aggregations/latest |
GET | Get most recent aggregation |
/api/stats |
GET | Get overall statistics |
# Health check
curl http://localhost:8080/health
# Get latest data
curl http://localhost:8080/api/aggregations/latest
# Get last 10 aggregations
curl "http://localhost:8080/api/aggregations?limit=10"
# Get statistics
curl http://localhost:8080/api/statsiot-analytics-dashboard/
βββ cmd/
β βββ producer/ # IoT device simulator
β βββ aggregator/ # Stream processor
β βββ api/ # REST API server
βββ internal/
β βββ models/ # Data models
β βββ api/ # HTTP handlers
β βββ storage/ # In-memory storage
βββ frontend/ # React dashboard
β βββ src/
β β βββ App.js # Main component
β β βββ App.css # Styles
β βββ package.json
βββ docker-compose.yml # Kafka infrastructure
βββ go.mod
βββ README.md
Default configuration (modify in source code):
| Component | Config | Default |
|---|---|---|
| Kafka Broker | Address | localhost:9092 |
| API Server | Port | 8080 |
| Producer | Devices | 5 |
| Producer | Interval | 2 seconds |
| Aggregator | Window | 1 minute |
| Frontend | Port | 3000 |
- Go - High-performance backend services
- Apache Kafka - Distributed event streaming
- segmentio/kafka-go - Kafka client library
- gorilla/mux - HTTP router
- rs/cors - CORS middleware
- React - UI framework
- Recharts - Data visualization
- Axios - HTTP client
- Docker - Containerization
- Zookeeper - Kafka coordination
- Producer generates simulated IoT telemetry (temperature, humidity)
- Kafka receives and distributes raw telemetry data
- Aggregator consumes raw data, computes 1-minute window statistics
- Kafka receives aggregated metrics
- API Server consumes aggregated data and exposes REST endpoints
- Frontend fetches and visualizes data every 30 seconds
# Run Go tests
go test ./...
# Test API endpoints
curl http://localhost:8080/health
curl http://localhost:8080/api/stats# Start Kafka and Zookeeper
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Remove volumes
docker-compose down -v- New API endpoint: Add handler in
internal/api/handlers.go - New data model: Update
internal/models/models.go - New chart: Modify
frontend/src/App.js
# Check Kafka topics
docker exec kafka kafka-topics --list --bootstrap-server localhost:9092
# View Kafka messages
docker exec kafka kafka-console-consumer \
--bootstrap-server localhost:9092 \
--topic iot-telemetry-raw \
--from-beginning- WebSocket support for real-time updates
- PostgreSQL/MongoDB for data persistence
- User authentication and authorization
- Alert system for threshold violations
- Device management dashboard
- Historical data analysis
- Kubernetes deployment
- Grafana integration
- Multi-tenant support
MIT License - feel free to use this project for learning or commercial purposes.
Beryl Malomo
- GitHub: @berylm1
- Apache Kafka for event streaming
- React community for excellent documentation
- Go community for great libraries
β Star this repo if you find it helpful!