A comprehensive tariff calculator and trade information system for the African Continental Free Trade Area (AfCFTA/ZLECAf).
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Simple health check |
/api/health/status |
GET | Detailed health status with system checks |
The health endpoints provide real-time monitoring of:
| Endpoint | Method | Description |
|---|---|---|
/api/ |
GET | API welcome message |
/api/countries |
GET | List all 54 ZLECAf member countries |
/api/country-profile/{country_code} |
GET | Get detailed country economic profile |
/api/calculate-tariff |
POST | Calculate tariffs between countries |
/api/rules-of-origin/{hs_code} |
GET | Get rules of origin for HS code |
/api/statistics |
GET | Get comprehensive ZLECAf statistics |
| Endpoint | Method | Description |
|---|---|---|
/api/trade-data/latest |
GET | Get latest trade data using smart source selection |
/api/trade-data/compare-sources |
GET | Compare all data sources for freshness |
/api/trade-data/wto/{reporter}/{partner} |
GET | Get WTO tariff and trade data directly |
| Endpoint | Method | Description |
|---|---|---|
/api/export/tariffs/csv |
GET | Export tariff data as CSV |
/api/export/tariffs/excel |
GET | Export tariff data as multi-sheet Excel |
/api/export/validation-report/json |
GET | Export validation report with quality metrics |
/api/export/comparison/csv |
GET | Compare tariffs between countries |
Get Latest Trade Data with Smart Selection:
GET /api/trade-data/latest?reporter=KEN&partner=GHA&hs_code=080300
Compare Data Sources:
GET /api/trade-data/compare-sources?countries=KEN&countries=GHA&countries=TZA
Direct WTO Access:
GET /api/trade-data/wto/KEN/GHA?product_code=080300
Export Tariffs as CSV:
GET /api/export/tariffs/csv?country=KE&latest=true
Export Multiple Countries as Excel:
GET /api/export/tariffs/excel?countries=KE,TZ,UG,RW
Get Validation Report:
GET /api/export/validation-report/json?min_score=90.0
Compare Tariffs Between Countries:
GET /api/export/comparison/csv?countries=KE,TZ&hs_codes=080300,080400
Endpoint: GET /api/health
{
"status": "healthy",
"service": "ZLECAf API",
"version": "2.0.0",
"timestamp": "2025-01-15T10:30:00.000Z"
}
Endpoint: GET /api/health/status
{
"status": "healthy",
"timestamp": "2025-01-15T10:30:00.000Z",
"service": "ZLECAf API",
"version": "2.0.0",
"checks": {
"database": {
"status": "healthy",
"message": "MongoDB connection active"
},
"api_endpoints": {
"status": "healthy",
"available_endpoints": [...]
},
"data": {
"status": "healthy",
"countries_count": 54,
"rules_of_origin_sectors": 97
}
}
}
The system supports real-time notifications via Email and Slack for:
Set up notifications using environment variables:
# Email Notifications
EMAIL_NOTIFICATIONS_ENABLED=true
EMAIL_SMTP_HOST=smtp.gmail.com
EMAIL_SMTP_PORT=587
EMAIL_SMTP_USER=your-email@gmail.com
EMAIL_SMTP_PASSWORD=your-app-password
EMAIL_FROM=noreply@afcfta.com
EMAIL_TO=admin@afcfta.com
# Slack Notifications
SLACK_NOTIFICATIONS_ENABLED=true
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
SLACK_CHANNEL=#afcfta-monitoring
See NOTIFICATIONS.md for detailed setup instructions.
The API automatically selects the best data source based on:
Priority order: OEC β World Bank β WTO
Data is automatically updated daily at 2:00 AM UTC via GitHub Actions. See docs/AUTO_UPDATE_DATA.md for details.
/api/health endpoint every 30 seconds/api/health/status for comprehensive diagnosticsDeploy the entire stack with Docker Compose:
# Clone the repository
git clone https://github.com/aouggad-web/afcfta-final-001.git
cd afcfta-final-001
# Copy and configure environment variables
cp .env.example .env
# Edit .env with your configuration
# Start services
docker-compose up -d
# Check logs
docker-compose logs -f backend
# Stop services
docker-compose down
The docker-compose setup includes:
See DEPLOYMENT.md for detailed deployment instructions.
curl https://your-domain.com/api/health
curl https://your-domain.com/api/countries
curl -X POST https://your-domain.com/api/calculate-tariff \
-H "Content-Type: application/json" \
-d '{
"origin_country": "KE",
"destination_country": "GH",
"hs_code": "080300",
"value": 10000
}'
The system automatically updates economic data daily from external sources:
For more information, see:
To manually trigger an update:
MIT License - See LICENSE file for details
Contributions are welcome! See CONTRIBUTING.md for step-by-step instructions on how to upload a new file or submit a Pull Request.
For issues and questions, please open an issue on GitHub.