What problem does it solve?
This skill provides a structured approach to organizing FastAPI routing by promoting a modular router pattern and a file-based routing option, helping teams scale complex APIs with maintainable code.
Core Features & Use Cases
- Modular Router Pattern: Define routers in src/api/v1/endpoints and compose them in an aggregator to keep routes organized and versioned.
- File-Based Routing (optional): Enable URL structures that mirror the filesystem for quick navigation in smaller projects or rapid prototyping.
- Versioned API Architecture: Promote consistent versioning and clear separation of concerns across API surfaces.
- Best Practices: Use tags, prefixes, and dependencies at the router level to simplify OpenAPI docs and reuse.
Quick Start
Create a modular router setup under src/api/v1/endpoints with users.py, items.py, and auth.py, then create src/api/v1/api.py to aggregate routers with appropriate prefixes and tags. Update your project’s startup to include the v1 router and test with a few sample requests to verify routing behavior.