Skip to content

Latest commit

 

History

History
38 lines (26 loc) · 1.29 KB

README.md

File metadata and controls

38 lines (26 loc) · 1.29 KB

FastAPI + SQLModel + Alembic

Sample FastAPI project that uses async SQLAlchemy, SQLModel, Postgres, Alembic, and Docker.

Want to learn how to build this?

Check out the post.

Want to use this project?

$ docker-compose up -d --build
$ docker-compose exec web alembic upgrade head

Sanity check: http://localhost:8004/ping

Add a hero:

$ curl -d '{"name":"Midnight Fit", "secret_name":"Mogwai", "age":"30"}' -H "Content-Type: application/json" -X POST http://localhost:8004/heroes

Get all songs: http://localhost:8004/heroes

Changelog for my fork of original FastAPI + SQLModel + Alembic boilerplate:

  • Used test model from sqlmodel example
  • Updated packages
  • Updated codebase to use new Model, stop using deprecated code (async engine in sqlmodel is not available now, used alchemy instead)
  • Updated postgresql image version
  • Renamed source folder to backend (for cases if someone uses monorepo for front-end and backend)

Plan to update this repo from time to time.

Features to implement:

  • Separate DB queries from routers methods (start using db repository classes)
  • add testing folder and settings
  • add visual docs folder with auto-generation of uml class models