-
Notifications
You must be signed in to change notification settings - Fork 0
configuration
sahilnyk edited this page May 1, 2026
·
1 revision
Minimal structure for small APIs or learning FastAPI.
Generated files:
-
main.py- Application entry point -
routers/health.py- Health check endpoint -
schemas/base.py- Base Pydantic schema -
core/config.py- Configuration settings -
requirements.txt- Dependencies
Production-ready structure with all components.
Additional files in full mode:
-
models/user.py- SQLAlchemy user model -
schemas/user.py- User Pydantic schemas -
crud/user.py- Database operations -
routers/users.py- User endpoints -
db/session.py- Database connection -
deps.py- Dependency injection -
tests/test_main.py- Test placeholder
No database configuration. Suitable for simple APIs that don't need persistence.
Embedded database, good for development and small applications.
- File-based, no server required
- Zero configuration
- Single-user only
Production-grade relational database.
- Concurrent connections
- Advanced features (JSON, arrays, etc.)
- Industry standard for web applications
Popular open-source database.
- Widely supported
- Good performance
- Common in shared hosting environments
No authentication system. All endpoints are public.
JSON Web Token authentication using OAuth2.
Features included:
- Password hashing with bcrypt
- Token creation and verification
- OAuth2 password flow
- Protected route dependency
To use authentication in your routes:
from fastapi import Depends, APIRouter
from deps import get_current_user
router = APIRouter()
@router.get("/protected")
def protected_route(user = Depends(get_current_user)):
return {"message": f"Hello {user}"}When enabled, generates:
- Python 3.11 slim base image
- Installs dependencies
- Runs uvicorn
- App service configuration
- PostgreSQL database service (if selected)
- Volume persistence
- Environment variable support
To use Docker:
docker-compose up --buildYour API will be available at http://localhost:8000