Loading IconFastLaunchAPI

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

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 uv

Key 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 AsyncSessionLocal with await for database operations
  • Celery tasks: Use SyncSessionLocal without await for background processing
  • Modern syntax: All queries use select(), execute(), update(), delete()

Dynamic OAuth System

Adding OAuth providers is simple:

  1. Add {PROVIDER}_CLIENT_ID and {PROVIDER}_CLIENT_SECRET to .env
  2. Register provider in oauth_providers.py
  3. 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:

  1. Quick Start - Get up and running in 5 minutes
  2. Getting Started - Complete setup and configuration guide
  3. Authentication - Configure OAuth providers and user management
  4. Background Tasks - Learn Celery patterns and best practices
  5. Database - Work with async SQLAlchemy 2.0
  6. 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!