6e6c2cc42ea837c0f677d40a478070fc13235830
Bakery Forecasting Platform - Microservices
Overview
AI-powered demand forecasting platform for bakeries in Madrid, Spain using microservices architecture.
Architecture
- API Gateway: Central entry point for all client requests
- Auth Service: User authentication and authorization
- Training Service: ML model training for demand forecasting
- Forecasting Service: Generate predictions using trained models
- Data Service: External data integration (weather, traffic, events)
- Tenant Service: Multi-tenant management
- Notification Service: Email and WhatsApp notifications
Quick Start
Prerequisites
- Docker and Docker Compose
- Python 3.11+
- Node.js 18+
Setup
# Run setup script (this script!)
./scripts/setup.sh
# Start services
docker-compose up -d
# Check service health
curl http://localhost:8000/health
Services
- Gateway: http://localhost:8000
- API Docs: http://localhost:8000/docs
- Grafana: http://localhost:3002
- Prometheus: http://localhost:9090
- RabbitMQ Management: http://localhost:15672
Development
Running Tests
./scripts/test.sh
Building Services
docker-compose build
Viewing Logs
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f auth-service
Service URLs (Development)
- Gateway: http://localhost:8000
- Auth Service: http://localhost:8001
- Training Service: http://localhost:8002
- Forecasting Service: http://localhost:8003
- Data Service: http://localhost:8004
- Tenant Service: http://localhost:8005
- Notification Service: http://localhost:8006
Environment Variables
Copy .env.example to .env and update the following:
# External API Keys
AEMET_API_KEY=your-aemet-api-key
MADRID_OPENDATA_API_KEY=your-madrid-opendata-key
# Email Configuration
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-email-password
# WhatsApp API
WHATSAPP_API_KEY=your-whatsapp-api-key
# JWT Secret (change in production!)
JWT_SECRET_KEY=your-super-secret-jwt-key-change-in-production
Troubleshooting
Services won't start
# Check if ports are available
docker-compose ps
netstat -tulpn | grep :8000
# Restart services
docker-compose down
docker-compose up -d
Database connection issues
# Check database containers
docker-compose logs auth-db
docker-compose logs training-db
# Reset databases
docker-compose down -v
docker-compose up -d
Service communication issues
# Check service health
curl http://localhost:8000/health
curl http://localhost:8001/health
curl http://localhost:8002/health
# Check RabbitMQ
open http://localhost:15672
# User: bakery, Password: forecast123
Next Steps
- Configure External APIs: Add your AEMET and Madrid Open Data API keys
- Test Authentication: Register a user and test login
- Upload Sales Data: Import historical sales data
- Train Models: Start your first training job
- Generate Forecasts: Create demand predictions
License
MIT License
Description
Languages
Python
56.3%
TypeScript
39.6%
Shell
2.9%
CSS
0.4%
Starlark
0.3%
Other
0.3%