Getting Started¶
Welcome to the FastAPI Boilerplate! This guide will have you up and running in just a few minutes.
Quick Start (5 minutes)¶
Pick whichever workflow fits you:
Prerequisites¶
- uv (0.4+)
- PostgreSQL and Redis running locally (or use the Docker tab)
1. Get the Template¶
- Click "Use this template" on the GitHub repository
- Create a new repository with your project name
- Clone your new repository and
cdinto the backend:
2. Install Dependencies¶
3. Environment Setup¶
SECRET_KEY
Generate a secure key with python -c "import secrets; print(secrets.token_urlsafe(64))" and replace the default value in .env.
4. Run the Server¶
Verify It's Running¶
Visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health Check: http://localhost:8000/health
You're Ready!¶
You now have a working FastAPI app with:
- REST API with automatic OpenAPI docs
- PostgreSQL database with Alembic migrations
- Redis-backed cache and rate limiting
- Session-based authentication with optional OAuth (Google, GitHub)
- API keys with per-key permissions
- SQLAdmin admin interface at
/admin - Async background task support via Taskiq
Test Your API¶
1. Health Check¶
2. Create a User¶
curl -X POST "http://localhost:8000/api/v1/users/" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"username": "johndoe",
"email": "john@example.com",
"password": "securepassword"
}'
3. Log In (Session Cookie)¶
curl -X POST "http://localhost:8000/api/v1/auth/login" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=johndoe&password=securepassword" \
-c cookies.txt
The response sets an HTTP-only session cookie and returns a CSRF token. Use -b cookies.txt on subsequent requests to send the session along.
4. Get the Current User¶
Next Steps¶
Essential Reading¶
- Configuration Guide - Environment variables and settings
- Project Structure - How the code is organized
- Authentication - Sessions, OAuth, and API keys
Popular Features¶
- Database Operations - Models, schemas, and CRUD
- Caching - Redis-backed caching
- Background Tasks - Async jobs with Taskiq
- Rate Limiting - Protect your API from abuse
Development & Deployment¶
- Development Guide - Extend and customize
- Testing - Write tests for your API
- Production Deployment - Deploy to production
Alternative Setup Methods¶
- Manual Installation - Step-by-step setup details
Need Help?¶
- Join our Discord Community - Get help from other developers
- Report issues on GitHub
Ready to dive deeper? Continue with the installation guide or jump to the user guide.