A modern climate-aware Early Warning, Alert, and Response System with machine learning-powered outbreak prediction, real-time surveillance, and DHIS2 integration.
- Real-time Disease Surveillance - Track disease outbreaks across regions
- ML-Powered Predictions - Outbreak risk forecasting using logistic regression and anomaly detection
- DHIS2 Integration - Direct integration with DHIS2 health information systems
- Interactive Maps - Province-level visualization with Mapbox integration
- Climate Data Analysis - Weather and environmental risk factors
- Configurable Alerts - Automated outbreak detection and notifications
- Frontend: React 18, Vite, Tailwind CSS, Radix UI, Mapbox GL
- Backend: Node.js, Express, TypeScript, PostgreSQL
- ML Service: Python, Flask, scikit-learn, pandas
- Process Management: PM2
- Web Server: Nginx
See LIGHTSAIL_DEPLOYMENT.md for complete deployment guide.
Quick Start (30 minutes):
# 1. Create Ubuntu 22.04 Lightsail instance
# 2. SSH into instance
# 3. Clone repository
git clone https://github.com/your-org/slewars.git
cd slewars
# 4. Run automated setup
chmod +x lightsail-setup.sh
./lightsail-setup.sh
# 5. Configure .env with your DHIS2 database credentials
nano .env
# 6. Restart services
pm2 restart allDone! Access at http://your-lightsail-ip
For troubleshooting and technical details, see DEPLOYMENT_LEARNINGS.md.
- Node.js 18+
- PostgreSQL 14+
- Python 3.9+
- Git
# Install dependencies and setup
npm install
./setup.sh
# Start all services (frontend, backend, ML)
npm run dev:fullServices will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:4000
- ML Service: http://localhost:8000
-
Install dependencies:
npm install
-
Configure environment:
cp .env.example .env # Edit .env with your settings -
Setup ML service:
cd server/ml-service ./setup.sh cd ../..
-
Run application:
npm run dev:full
Create .env file with these settings:
# Server
NODE_ENV=development
PORT=4000
# Database
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=ewars_db
POSTGRES_USER=your_user
POSTGRES_PASSWORD=your_password
# Data Source
DASHBOARD_DATA_SOURCE=synthetic # or 'dhis2' or 'hybrid'
# DHIS2 (Optional)
DHIS2_BASE_URL=https://your-dhis2-instance.org
DHIS2_USERNAME=your_username
DHIS2_PASSWORD=your_password
# API Keys (Optional)
MAPBOX_TOKEN=your_mapbox_token
OPENWEATHER_API_KEY=your_api_key# Build both backend and frontend
npm run build:full
# Start in production mode
npm run production:start| Method | Endpoint | Description |
|---|---|---|
GET |
/api/config/countries |
Get country configurations |
GET |
/api/data/overview |
Get dashboard overview data |
GET |
/api/dhis2/analytics |
DHIS2 analytics proxy |
POST |
/api/ml/predict |
Outbreak risk prediction |
POST |
/api/ml/anomalies |
Anomaly detection |
- Best for: Production deployment, professional hosting
- Cost: $10-20/month
- Setup time: 30 minutes
- Guide: LIGHTSAIL_DEPLOYMENT.md
- Best for: Auto-scaling applications
- Cost: $50-100/month
- Requires: Docker configuration, 2 services
- Railway / Render: Easy deployment, built-in PostgreSQL
- AWS EC2: Full control, more complex setup
- Docker: Container-based deployment
.
├── src/ # Frontend React application
├── server/
│ ├── src/ # Backend Express server
│ ├── ml-service/ # Python ML service
│ ├── config/ # Configuration files
│ └── scripts/ # Database initialization
├── public/ # Static assets
├── dist/ # Built frontend (generated)
├── lightsail-setup.sh # AWS Lightsail deployment script
└── LIGHTSAIL_DEPLOYMENT.md # Detailed deployment guide
pm2 status # Check service status
pm2 logs # View logs
pm2 restart all # Restart all services
pm2 monit # Monitor resourcesnpm run dev # Frontend only
npm run server-dev # Backend only
npm run dev:full # All servicesnpm run db:init # Initialize database
psql -U ewars_user -d ewars_db # Connect to databaseApplication Logs:
pm2 logs ewars-backend
pm2 logs ewars-mlNginx Logs:
sudo tail -f /var/log/nginx/access.log
sudo tail -f /var/log/nginx/error.logSystem Resources:
pm2 monit
htop# Check PM2 status
pm2 status
pm2 logs
# Restart services
pm2 restart all# Check PostgreSQL status
sudo systemctl status postgresql
# Verify credentials
cat .env | grep POSTGRES# Find process using port
lsof -i :4000
# Kill process
kill -9 PIDProduction Recommendations:
- Enable HTTPS with Let's Encrypt SSL certificate
- Use strong database passwords
- Keep system packages updated
- Restrict SSH access to specific IPs
- Enable UFW firewall
- Use environment variables for secrets
- Enable automatic security updates
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
See LICENSE file for details.
For deployment issues, see LIGHTSAIL_DEPLOYMENT.md troubleshooting section.
For DHIS2 integration questions, ensure your credentials are correct in .env file.
Data Flow:
User Browser
↓
Nginx (Port 80) → Frontend (Static Files)
↓
→ Backend API (Port 4000)
↓
├─→ PostgreSQL Database
├─→ ML Service (Port 8000)
└─→ DHIS2 (Optional)
Services:
- Frontend: React SPA served by Nginx
- Backend: Express API server with PM2
- ML Service: Python Flask service with PM2
- Database: PostgreSQL for data storage
- Proxy: Nginx reverse proxy for routing
Recommended Instance Specs:
- Minimum: 2 GB RAM, 1 vCPU (Lightsail $10/month)
- Recommended: 4 GB RAM, 2 vCPU (Lightsail $20/month)
- Storage: 60 GB SSD minimum
Optimization Tips:
- Enable Nginx caching
- Use PM2 cluster mode for backend
- Add swap space if needed
- Monitor with PM2 and system tools
To update deployed application:
cd ~/your-repo
git pull origin main
npm install
npm run build:full
pm2 restart allReady to deploy? Follow the LIGHTSAIL_DEPLOYMENT.md guide!