Introduction
Learn about FastLaunchAPI - a production-ready backend solution with authentication, payments, and modern tooling
FastLaunchAPI Premium
A production-ready FastAPI backend template that eliminates weeks of boilerplate setup. Built with modern Python practices, async SQLAlchemy 2.0, and designed for startups, MVPs, and enterprise applications that need to move fast without compromising on code quality or security.
Why This Template?
Building a production-ready API from scratch is time-consuming and error-prone. This template provides a solid foundation with all the essential components you need:
- Save Development Time: Skip the tedious setup and focus on building your unique features
- Production-Ready: Built with best practices, security, and scalability in mind
- Modern Stack: Async SQLAlchemy 2.0, OAuth2, uv package manager, background tasks with proper session management
- Comprehensive: Authentication with OAuth, payments, AI integration, and more
- Easy to Extend: Dynamic OAuth providers, modular architecture, clean separation of concerns
Key Difference from Other Templates: This template uses async SQLAlchemy 2.0 throughout with proper dual session management for Celery tasks. No mixing async/sync patterns incorrectly!
What's Included
๐ Authentication System
JWT authentication with OAuth2 (Google+), dynamic provider support, email verification, password reset, and session management
๐ณ Payment Processing
Stripe integration with webhooks, subscriptions, one-time payments, and customer management
๐ง Email Infrastructure
SendGrid integration with HTML templates, async email sending via Celery, and transactional support
๐๏ธ Database Management
Async SQLAlchemy 2.0 with asyncpg, Alembic migrations, dual session support (async/sync), and connection pooling
โก Background Tasks
Celery integration with Redis broker, Celery Beat scheduler, proper sync session management, and Flower monitoring
๐ค AI Integrations
OpenAI and Groq integration with LangChain. Build AI-powered features with proper async handling.
๐งช Testing Setup
Comprehensive pytest setup with fixtures, database isolation, and test coverage without unnecessary complexity.
๐ณ Docker Setup
Complete Docker Compose with PostgreSQL, Redis, Celery workers, Beat scheduler, pgAdmin, and Flower monitoring
Architecture Overview
The template follows a clean, modular architecture designed for scalability:
fastlaunchapi-premium/
โโโ backend/
โ โโโ app/
โ โ โโโ routers/ # API endpoints organized by feature
โ โ โ โโโ auth/ # Authentication & OAuth (auth.py, oauth_providers.py)
โ โ โ โโโ payments/ # Stripe integration (payments.py, webhooks)
โ โ โ โโโ core/ # Core system routes (health, middleware)
โ โ โโโ db/ # Database setup (async & sync sessions)
โ โ โโโ email/ # SendGrid templates and sending logic
โ โ โโโ config/ # Settings with Pydantic validation
โ โโโ alembic/ # Database migrations (Alembic)
โ โโโ celery_setup.py # Celery configuration & Beat schedule
โ โโโ pyproject.toml # Dependencies managed by uv
โ โโโ uv.lock # Locked dependencies
โ โโโ main.py # FastAPI application entry point
โโโ docker-compose.yaml # All services (PostgreSQL, Redis, Celery, etc.)
โโโ Dockerfile # Application container with uvKey Design Principles
- Async-First Architecture: Built with async SQLAlchemy 2.0 and asyncpg for high-performance database operations
- Dual Session Support: Async sessions (
AsyncSessionLocal) for FastAPI endpoints, sync sessions (SyncSessionLocal) for Celery tasks - Modern Package Management: uv for 10-100x faster dependency installation and management
- Modular Structure: Each feature is self-contained with its own routes, models, services, and background tasks
- Dynamic OAuth Providers: Automatic provider detection and credential injection from environment variables - no hardcoded redirect URIs
- Modern SQLAlchemy: Using 2.0 syntax with
select(),execute(),update(),delete()throughout - Configuration-Driven: Centralized Pydantic settings with environment-based configuration and validation
- Background Processing: Celery with Redis for heavy tasks, proper sync session management in tasks
- Test-Ready: Comprehensive pytest setup with fixtures, database isolation, and async test support
- Docker-First: Complete Docker Compose setup for local development and production deployment
Technology Stack
This template uses modern, production-proven technologies:
Core Framework
- FastAPI - High-performance async web framework
- Uvicorn - ASGI server with WebSocket support
- Pydantic 2.x - Data validation and settings management
- uv - Ultra-fast Python package manager (10-100x faster than pip)
Database & ORM
- PostgreSQL - Production database
- SQLAlchemy 2.0 - Async ORM with modern syntax
- asyncpg - High-performance async PostgreSQL driver
- psycopg2-binary - Sync PostgreSQL driver for Celery tasks
- Alembic - Database migration tool
Authentication & Security
- Authlib - OAuth2 client implementation
- python-jose - JWT token handling
- passlib[bcrypt] - Password hashing
- Session Middleware - OAuth state management
Background Processing
- Celery - Distributed task queue
- Celery Beat - Scheduled task scheduler
- Redis - Message broker and result backend
- Flower - Celery monitoring web UI
Integrations
- Stripe - Payment processing with webhooks
- SendGrid - Transactional email service
- OpenAI - AI/LLM integration
- Groq - Fast LLM inference
- LangChain - LLM orchestration framework
Development & Testing
- Pytest - Testing framework with async support
- Black - Code formatter
- Ruff - Fast Python linter
- Mypy - Static type checker
- Docker & Docker Compose - Containerization
- pgAdmin - PostgreSQL management UI
Key Features Explained
Modern Package Management with uv
The template uses uv for dependency management:
- 10-100x faster than pip for package installation
- pyproject.toml - Modern Python project configuration
- uv.lock - Reproducible builds across environments
- Simple commands:
uv add package,uv run pytest,uv sync
Async SQLAlchemy 2.0
The template uses the latest SQLAlchemy with full async support:
- FastAPI endpoints: Use
AsyncSessionLocalwithawaitfor database operations - Celery tasks: Use
SyncSessionLocalwithoutawaitfor background processing - Modern syntax: All queries use
select(),execute(),update(),delete()
Dynamic OAuth System
Adding OAuth providers is simple:
- Add
{PROVIDER}_CLIENT_IDand{PROVIDER}_CLIENT_SECRETto.env - Register provider in
oauth_providers.py - Redirect URI auto-generated:
{BACKEND_URL}/auth/callback/{provider}
No hardcoded redirect URIs needed!
Proper Background Task Architecture
Celery tasks use sync database sessions for reliability:
from app.db.database import SyncSessionLocal
@celery_app.task()
def process_data(user_id: int):
db = SyncSessionLocal()
try:
# Sync database operations
db.commit()
finally:
db.close()Docker Compose Everything
All services run in containers:
- PostgreSQL with pgAdmin for database management
- Redis for Celery message broker
- Celery worker and Beat scheduler
- Flower for real-time task monitoring
Getting Started
Ready to build? Here's your path forward:
- Quick Start - Get up and running in 5 minutes
- Getting Started - Complete setup and configuration guide
- Authentication - Configure OAuth providers and user management
- Background Tasks - Learn Celery patterns and best practices
- Database - Work with async SQLAlchemy 2.0
- Deployment - Deploy to production
New to FastAPI or async SQLAlchemy? This template is designed to be beginner-friendly while maintaining professional standards. Start with the Quick Start guide to get running immediately.
What Makes This Different?
Unlike other FastAPI templates, FastLaunchAPI Premium includes:
Proper async/sync separation
Correct session management for API and background tasks - no mixing patterns incorrectly
Dynamic OAuth providers
Add new providers without changing redirect URIs - environment-based configuration
Modern SQLAlchemy 2.0
No legacy query patterns, all modern syntax throughout the codebase
Modern package management
uv for ultra-fast dependency installation and reproducible builds
Production-ready from day one
Docker Compose with all monitoring tools included (pgAdmin, Flower, Redis)
Comprehensive documentation
Every feature explained with examples, best practices, and troubleshooting guides
No over-engineering
Clean, maintainable code without unnecessary abstractions or complexity
Whether you're building a simple API or a complex application, this template provides the foundation you need to succeed. Let's get started!