You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A production-grade weather API built with FastAPI, featuring real-time weather data, intelligent caching, user authentication, rate limiting, and horizontal scaling support. Designed as a modern competitor to AccuWeather.
β¨ Features
Phase 1 - Core Features
Weather Data
Real-time Weather - Current temperature, humidity, wind speed, UV index, and more
# Build and run with Docker Compose
docker-compose up -d
# Scale to multiple replicas
docker-compose up -d --scale app=3
# View logs
docker-compose logs -f
π‘ API Endpoints
Phase 1 - Weather Endpoints
Endpoint
Method
Description
/weather?lat={lat}&lon={lon}
GET
Current weather
/hourly?lat={lat}&lon={lon}
GET
24-hour forecast
/forecast?lat={lat}&lon={lon}
GET
7-day forecast
/aqi-alerts?lat={lat}&lon={lon}
GET
Air quality & alerts
Phase 2 - Enhanced Weather
Endpoint
Method
Description
/weather/hourly?lat=&lon=&hours=
GET
Hourly forecast (24/48/72h)
/weather/daily?lat=&lon=&days=
GET
Daily forecast (7/14 days)
/weather/historical?lat=&lon=&start=&end=
GET
Historical data
/weather/download?lat=&lon=&type=pdf
GET
Download report
Phase 2 - Geocoding
Endpoint
Method
Description
/geocode/search?q={query}
GET
Search locations
/geocode/reverse?lat=&lon=
GET
Reverse geocode
Phase 2 - Alerts & Prediction
Endpoint
Method
Description
/alerts?lat=&lon=
GET
Weather alerts
/predict/nextday?lat=&lon=
GET
Next-day prediction
Phase 2 - API Keys & i18n
Endpoint
Method
Description
/apikeys
POST
Create API key
/apikeys
GET
List API keys
/apikeys/{id}
DELETE
Revoke API key
/i18n/translations?lang=
GET
Get translations
Authentication
Endpoint
Method
Description
/auth/signup
POST
Create account
/auth/login
POST
Login
/auth/logout
POST
Logout
/auth/me
GET
Get current user
Admin & System
Endpoint
Method
Description
/admin/dashboard
GET
Admin dashboard
/admin/api/stats
GET
Dashboard stats
/healthz
GET
Health check
/metrics
GET
Application metrics
Example Requests
# Current weather
curl "http://localhost:8000/weather?lat=40.7128&lon=-74.0060"# Hourly forecast with CSV export
curl "http://localhost:8000/weather/hourly?lat=40.7128&lon=-74.0060&hours=48&format=csv" -o forecast.csv
# Search for a city
curl "http://localhost:8000/geocode/search?q=London&limit=5"# Get weather alerts
curl "http://localhost:8000/alerts?lat=40.7128&lon=-74.0060"# Next-day temperature prediction
curl "http://localhost:8000/predict/nextday?lat=40.7128&lon=-74.0060"# Download PDF report
curl "http://localhost:8000/weather/download?lat=40.7128&lon=-74.0060&type=pdf" -o report.pdf
# Get Hindi translations
curl "http://localhost:8000/i18n/translations?lang=hi"
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=. --cov-report=html
# Run Phase 2 specific tests
pytest tests/test_phase2.py -v