Skip to content

Dockerized FastAPI boiler plate similar to Django code structure with views, serializers(pydantic) and model( Sqlalchemy ORM) with dockerized database(PostgresSQL) and PgAdmin. πŸš€

Notifications You must be signed in to change notification settings

rawheel/fastapi-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍲 FastAPI Boilerplate

The simplest production ready Django like FastAPI boilerplate 🐍

fastapi boilerplate


πŸ’Ž Features

βœ… Production ready with one docker-compose command.
βœ… Similar to Django Code Structure.
βœ… Local dockerized db.
βœ… Dockerized PgAdmin to check the db records.
βœ… Migrations, Serializers and ORM configured.
βœ… CRUD APIs (Sneaker App).
βœ… Token Authentication.
βœ… Logging Mechanism.
βœ… Testcases TDD with Pytest.
βœ… Seperate Database(Sqlite) and mock session configured for test cases.
βœ… Poetry dependency management and packaging made easy. (Better than pip)

βš’οΈ Techologies Used

  • Alembic: For Database Migrations.
  • SQLAlchemy: For ORM.
  • Pydantic: For Typing or Serialization.
  • Pytests: For TDD or Unit Testing.
  • Poetry: Python dependency management and packaging made easy. (Better than pip)
  • Docker & docker-compose : For Virtualization.
  • postgresSQL: Database.
  • PgAdmin: To interact with the Postgres database sessions.
  • Loguru: Easiest logging ever done.

πŸš€ Up and run in 5 mins πŸ•™

Make sure you have docker and docker-compose installed docker installation guide

Step 1

create .env file in root folder fastapi-boilerplate/.env

DATABASE_URL=postgresql+psycopg://postgres:password@db:5432/boiler_plate_db
DB_USER=postgres
DB_PASSWORD=password
DB_NAME=boiler_plate_db 
[email protected]
PGADMIN_PASSWORD=admin
X_TOKEN=12345678910

Step 2

docker-compose up

πŸŽ‰ Your Production Ready FastAPI CRUD backend app is up and running on localhost:8000

  • Swagger docs on localhost:8000/docs

fastapi boilerplate

  • GET request example

fastapi boilerplate

  • PgAdmin on localhost:5050

fastapi boilerplate