Skip to content

A web application template of FastAPI with best practice.

License

Notifications You must be signed in to change notification settings

keakon/fastapi-skeleton

Repository files navigation

FastAPI-Skeleton

Build Status Coverage

FastAPI-Skeleton is a web application template of FastAPI with best practice.

Requirements

  1. Python 3.10 or later, tested on the latest CPython version.
  2. Redis.
  3. MySQL 8.0 or later.

Prepare database

$ redis-server &
$ sudo systemctl start mysql  # or "brew services run mysql" in macOS
$ mysql -u root -e "CREATE DATABASE IF NOT EXISTS test"
$ mysql -u root test < db/db.sql

Run locally

$ pip install -r requirements.txt
$ python create_admin.py admin  # or change "admin" to your password
$ uvicorn app.main:app 

Test

$ mysql -u root test < db/test.sql
$ pip install -r requirements-test.txt
$ pytest --ruff app --cov=app tests
$ coverage html

Build and run with docker

$ docker compose build
$ docker compose up -d

Try API docs.

Open http://127.0.0.1:8000/docs.

About

A web application template of FastAPI with best practice.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages