Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Boilerplate

Dockerized FastAPI boilerplate for a quick environment setup with some (opinionated) sane defaults.

Build with:

Getting started

1. Clone the repo

$ git clone git@github.com:villeristi/fastapi-boilerplate.git

2. Create the .env-file

$ cp .env.example .env

3. Start the containers

$ docker-compose up -d

4. Get to tha choppa container

$ docker exec -it fabp_app

5. Initialize base DB-schema

$ aerich init-db # inside the container

6. Create superuser

$ ./bin/createsuperuser  # inside the container

(6.5 Optional: Generate fake data)

$ ./bin/fakedata  # inside the container

7. Logging

Default logging is configured in src/util/logger.py and logs everything to stdout. To actually see what's going on in your application, just grab the logs from the container using

$ docker logs fabp_app -f

Uvicorn is watching the src directory by default and reloads application accordingly.

8. Done!

Now everything's set up and one can start building something useful!

Migrations

  1. Create migrations after initializing new models / changing existing models
aerich migrate # inside the container
  1. Apply migrations
aerich upgrade  # inside the container

TODO:

  • Fake data
  • Sample CRUD-applicaiton (Items)
  • Testing
  • Production

About

Boilerplate for FastAPI

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages