A clean, production-ready FastAPI starter template featuring JWT authentication, customer management, SQLite database integration, and environment-based configuration — all managed with the modern uv package manager.
- FastAPI — High-performance async web framework
- JWT Authentication — Secure token-based auth via the
authmodule - Customer Module — Ready-to-extend CRUD resource example
- SQLite — Lightweight database with
db.pysetup out of the box config.py— Centralized settings powered by.envvariablesuv— Ultra-fast Python package manager for dependency managementpyproject.toml— Modern Python project metadata and dependency declaration
fastapi_bootstrap/
├── auth/ # JWT authentication logic (login, token, dependencies)
├── customer/ # Customer resource (routes, schemas, models)
├── main.py # FastAPI app entry point, router registration
├── db.py # Database engine and session setup
├── config.py # App settings loaded from .env
├── .env # Environment variables (not committed in production)
├── db.sqlite3 # SQLite database file
├── pyproject.toml # Project metadata and dependencies
└── uv.lock # Locked dependency versions
- Python 3.10+
uvinstalled
pip install uvgit clone https://github.com/abdulkuddusa4/fastapi_bootstrap.git
cd fastapi_bootstrapuv syncCopy the .env file and fill in your values:
cp .env .env.localExample .env:
SECRET_KEY=your-secret-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
DATABASE_URL=sqlite:///./db.sqlite3uv run uvicorn main:app --reloadThe API will be available at http://localhost:8000
FastAPI provides interactive docs automatically:
| Interface | URL |
|---|---|
| Swagger UI | http://localhost:8000/docs |
| ReDoc | http://localhost:8000/redoc |
The auth module handles user login and JWT token issuance. Protected routes use FastAPI dependency injection to verify tokens.
Login flow:
POST /auth/token
→ Returns: { access_token, token_type }
Include the token in subsequent requests:
Authorization: Bearer <access_token>
The customer module provides a base CRUD resource that can be extended to fit your domain model. It demonstrates the recommended pattern for organizing routes, schemas, and database operations.
| Tool | Purpose |
|---|---|
| FastAPI | Web framework |
| SQLAlchemy | ORM / DB layer |
| SQLite | Database |
| python-jose | JWT encoding/decoding |
| passlib | Password hashing |
| pydantic-settings | Env-based configuration |
| uv | Package management |
Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.
This project is open-source. See LICENSE for details.