This repository provides a simple FastAPI demo application with PostgreSQL as the relational database, Alembic for migrations, Pytest for testing, and Docker for containerization. It has a CRUD operation example with proper log set up.
-
Export the variable for Pipenv:
$ export PIPENV_VENV_IN_PROJECT=1
-
Activate the virtual environment:
$ pipenv shell
-
Install the required packages:
$ make install
-
Initiate Alembic:
$ make build
-
Create a revision for the initial table (e.g., 'book' table):
$ make makemigrations
-
Build the Docker images:
$ make build
-
Make migrations:
$ make makemigrations
-
Migrate the database:
$ make migrate
-
Run the application:
$ make run
Now, the project will be running on http://localhost:8000
To run tests using Pytest, execute the following command within the virtual environment:
$ make test
Navigate to http://localhost:5556 to view the dashboard. You should see one worker ready to go.
swagger - http://localhost:8000/docs
redoc - http://localhost:8000/redoc