This directory contains the backend API app. It is built with FastAPI.
The project uses poetry to manage dependencies. You can use your own environment, or use poetry to manage the virtuel env and the project depencencies.
If using poetry, for convenience, run poetry config virtualenvs.in-project true
before installing depencies. This will install the dependencies in the project directory and make it easier to manage in vscode.
You can then install the dependencies with poetry install --with dev
.
To activate the virtual env, use poetry shell
.
Run this command to start a development server :
uvicorn app.main:app --reload
This will start a server running on http://127.0.0.1:8000
. The API will be available on the API's base prefix, which by default is /api/v1
.
Navigate to http://localhost:8000/api/v1/
to access the root API path.
Navigate to http://localhost:8000/docs
to access the API's documentation.
Navigate to http://localhost:8000/redoc
to access the API's alternative doc built with ReDoc.
Run
pytest
to run the unit test for the backend app.
The project uses Pydantic's settings management through FastAPI. Documentation on how the settings work is availabe here.
The configuration file is located in config/config.py. This file defines the setting properties, there types, and default values. The Config
class specifies where these properties are from, i.e. the .env.dev file. Modify the values in the .env.dev file to change the configuration.
Note that when the backend application is run with Docker, the values in the .env.dev are overriden with environment variables set in the Docker configuration.