nadavof / fastapi-starter

A FastAPI based low code starter/boilerplate: SQLAlchemy 2.0 (async), Postgres, React-Admin, pytest and cypress

Home Page:https://demo-project-fastapi-starter.fly.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FastAPI-Starter

A FastAPI based starter that relies heavily on existing plugins/frameworks to create an almost no-code experience. The goal is to build a template that can be used as a starting point for any FastAPI based project.

How to use

You need Python 3 and pip installed locally. Run the cookiecutter command (at least 1.7) and you'll be asked a few prompts.

pip3 install cookiecutter
cookiecutter https://github.com/gaganpreet/fastapi-starter

If you want to keep up to date with upstream changes (i.e. changes in this template), then it's better to use Cruft, which is fully compatible with Cookiecutter.

pip3 install cruft
cruft create https://github.com/gaganpreet/fastapi-starter

Using cruft will generate a metadata file named .cruft.json (don't delete it). Later on you can update to the current version of this cookiecutter and import the changes to your generated project by running this command:

cruft update

Objectives

  • Sane defaults with few prompts
  • Secure
  • KISS principle

Preview

View live demo here.

Login page

Item page

Features

  • Uses best practices: Factory pattern and environment variables for configuration
  • User registration, models, authentication using FastAPI Users
  • Modern admin interface using React-Admin
  • Github Action for building docker images and running automated tests
  • Dependabot config to keep project dependencies up to date
  • Create Typescript bindings for front-end automatically from OpenAPI spec using OpenAPI-Generator, no need to write/update code when backend changes
  • Async-first codebase with SQLAlchemy 2.0 and Alembic for database migrations
  • pytest with example tests included
  • Integration tests with Cypress
  • Docker images for frontend and backend
  • Includes extra Dockerfile (backend serves frontend) for straightforward production deployment
  • Pre-commit hooks with Black, autoflake, isort, flake8, prettier, eslint for consistent code standards

Features not included

The following features were left out in favour of simplicity:

Things to do

  • Migrate to Ruff
  • Email templates

About

A FastAPI based low code starter/boilerplate: SQLAlchemy 2.0 (async), Postgres, React-Admin, pytest and cypress

https://demo-project-fastapi-starter.fly.dev

License:MIT License


Languages

Language:TypeScript 68.1%Language:Python 21.2%Language:JavaScript 4.0%Language:Shell 3.0%Language:HTML 1.3%Language:Dockerfile 1.3%Language:CSS 0.7%Language:Mako 0.4%