Problem
The file src/climatevision/api/main.py has ~980 lines with all routes defined inline in create_app(). This makes maintenance, testing, and team collaboration difficult.
Proposed solution
Split routes into separate modules using FastAPI's APIRouter:
src/climatevision/api/
├── __init__.py
├── main.py # Clean create_app() with include_routers()
├── routes/
│ ├── __init__.py
│ ├── health.py # GET /api/health
│ ├── analysis.py # GET /api/analysis-types
│ ├── runs.py # CRUD /api/runs
│ ├── predict.py # POST /api/predict, /api/predict/upload
│ ├── organizations.py # CRUD /api/organizations
│ ├── subscriptions.py # /api/organizations/{id}/subscriptions
│ └── alerts.py # /api/organizations/{id}/alerts
Tasks
- [ ] Create
api/routes/ with __init__.py
- [ ] Move each route group to its own module with
APIRouter
- [ ] Clean
main.py to only use include_routers()
- [ ] Move specific schemas or keep in
schemas.py
- [ ] Verify all endpoints still work
- [ ] Update tests to reflect new structure
Problem
The file
src/climatevision/api/main.pyhas ~980 lines with all routes defined inline increate_app(). This makes maintenance, testing, and team collaboration difficult.Proposed solution
Split routes into separate modules using FastAPI's
APIRouter:Tasks
api/routes/with__init__.pyAPIRoutermain.pyto only useinclude_routers()schemas.py