A production-ready FastAPI starter template with async SQLAlchemy, PostgreSQL, Alembic migrations, and JWT authentication. Designed for scalability and maintainability.
- 🚀 FastAPI - Modern, fast (high-performance) web framework
- 🐘 PostgreSQL - Robust relational database support
- 🔐 JWT Authentication - Secure token-based authentication
- 🧩 Modular Architecture - Well-organized project structure
- 🛠️ Alembic Migrations - Database schema version control
- ⚡ Async SQLAlchemy - High-performance database operations
- 📄 Pagination - Built-in pagination with metadata
- 🔧 Environment Configuration - Easy environment management
- 🛡️ Security - Password hashing, CORS, and more
fastapi-async-starter/
├── app/
│ ├── core/ # Core configurations and utilities
│ ├── crud/ # Database operations
│ ├── db/ # Database models and session
│ ├── schemas/ # Pydantic models
│ ├── api/ # API endpoints
│ └── main.py # Application entry point
├── alembic/ # Database migrations
├── tests/ # Test cases
├── .env # Environment variables
├── requirements.txt # Project dependencies
├── alembic.ini # Alembic configuration
└── README.md # Project documentation
- Python 3.11+
- PostgreSQL
- pip
-
Clone the repository:
git clone https://github.com/yourusername/fastapi-async-starter.git cd fastapi-async-starter -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Copy the example.env to the .env file and update the variables
cp example.env .env
-
Set up PostgreSQL:
- Create a new database
- Update the
DB_URLin.envwith your credentials
-
Run migrations:
alembic upgrade head
Start the development server:
uvicorn app.main:app --reloadThe API will be available at http://localhost:8000
- Swagger UI:
http://localhost:8000/docs - Redoc:
http://localhost:8000/redoc
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a new branch
- Make your changes
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- FastAPI documentation
- SQLAlchemy documentation
- Alembic documentation
- LICENSE (MIT License):
MIT License
Copyright (c) [2025] [Sabbir Hosen]
Permission is hereby granted...