Fastapi Boilerplate

screenshot of Fastapi Boilerplate

Fastapi Boilerplate

FastAPI boilerplate for real world production

Overview

The FastAPI Boilerplate is a powerful framework for quickly creating web applications using FastAPI. It provides a range of features and functionalities to streamline the development process.

Features

  • Async SQLAlchemy session: Allows for asynchronous database queries using SQLAlchemy.
  • Custom user class: Provides a customizable user class for authentication and authorization.
  • Top-level dependency: Supports setting a callable function for initializing the FastAPI application.
  • Dependencies for specific permissions: Includes pre-implemented permission dependencies such as IsAdmin, IsAuthenticated, and AllowAll.
  • Celery integration: Supports running background tasks using Celery.
  • Dockerize (Hot reload): Enables Dockerization of the application with hot reload functionality.
  • Event dispatcher: Allows for event dispatching to handle specific actions or triggers.
  • Cache: Provides caching functionality by prefix or tag, with support for custom key builders and backends.
  • Multiple databases: Supports multiple databases with configuration options in the core/config.py file.

Installation

To install the FastAPI Boilerplate, follow these steps:

  1. Clone the repository:
git clone <repository_url>
  1. Navigate to the project directory:
cd fastapi-boilerplate
  1. Install the project dependencies:
pip install -r requirements.txt
  1. Update the database URLs in the core/config.py file under the config class.
  2. Customize the custom user class by modifying the current_user.py and authentication.py files in the core/fastapi/schemas and core/fastapi/middlewares directories, respectively.

Summary

The FastAPI Boilerplate is a comprehensive framework for building web applications using FastAPI. It offers features such as async SQLAlchemy session, custom user class, top-level dependencies, specific permissions, Celery integration, Dockerize, event dispatcher, cache, and support for multiple databases. With its ease of installation and extensive feature set, the FastAPI Boilerplate is an ideal choice for developers looking to accelerate their web application development process.