Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.03 KB

File metadata and controls

59 lines (42 loc) · 1.03 KB

FastAPI Boilerplate

A template for building server-side applications with FastAPI.

Development environment

  • Python 3.13: to run the app
  • PDM: the package and dependency manager
  • Docker: to run database setup scripts
  • bash: to run some scripts

How to run for development

# start database
$ pdm run db-up

# set configurations
$ cp .env.example .env
# edit the variables in `.env` if you want

# restore dependencies
$ pdm install

# migrate database for a fresh local database
$ pdm run migrate-deploy

# run lint & format
$ pdm run lint

# run tests
$ pdm run test

# run test with coverage
$ pdm run test-cov

# start application
# watch mode
$ pdm run dev
# or
# production mode
$ pdm run start

# stop database
$ pdm run db-down

How to change database schema

# update the SQLAlchemy record in code

# generate migration script
$ pdm run migrate-dev-create -- -m "describe_the_change"
# adjust the migration script in `src/app/migrations/versions/`

# apply the migration scripts
$ pdm run migrate-deploy