Contributing
Development Setup
1. Clone and configure
2. Start services
3. Apply migrations and seed
4. Verify
Code Style
Layered architecture — respect the layer boundaries:
| Layer | Allowed to call | Not allowed to call |
|---|---|---|
| Router | Service, Schema | Repository, Model |
| Service | Repository | Router |
| Repository | Model | Service, Router |
Naming conventions
- Files:
snake_case.py - Classes:
PascalCase - Constants:
UPPER_CASE - Private methods:
_leading_underscore
Schemas — always use dedicated schemas per operation:
UserCreate # POST — input
UserUpdate # PATCH — input (all fields optional)
UserResponse # output — never expose password_hash
UserSummary # list output — compact version
Adding a New Resource
Follow this checklist when adding a new resource to the API:
□ Migration — new table in migrations/versions/
□ Model — app/models/your_model.py
□ Schema — app/schemas/your_schema.py (Create, Update, Response, Summary)
□ Repository — app/repositories/your_repository.py
□ Service — app/services/your_service.py
□ Router — app/api/v1/your_router.py
□ Register router — app/api/v1/router.py
□ Permissions — add to seed.py and assign to appropriate roles
□ Documentation — docs/api/your_resource.md
Environment Variables
Never hardcode configuration values. Always use settings from app.core.config:
from app.core.config import settings
# Good
expire = settings.ACCESS_TOKEN_EXPIRE_MINUTES
# Bad
expire = 15
Git Workflow
main — stable, production-ready
develop — integration branch
feature/* — new features
fix/* — bug fixes
Commit message format: