/fastapi-demo

Dockerized FastAPI with PostgreSQL

Primary LanguagePython

fastapi-demo

watch the demo on youtube

getting started

  1. build the docker containers:

    docker compose build
  2. run the containers in detached mode:

    docker compose up -d
  3. apply database migrations:

    docker compose exec api alembic upgrade head
  4. visit http://localhost:8000/docs to create and get movies

  5. stop the containers:

    docker compose down

database migrations

note: the application must be up and running before using the following commands

  1. create a new migration:

    docker compose exec api alembic revision --autogenerate -m "your comment here"
  2. apply migrations:

    docker compose exec api alembic upgrade head
  3. revert a migration:

    docker compose exec api alembic downgrade -1