Back-end service for APM.
This is a brief template that provides the basic setup to create the backend portion using FastAPI. The documentation of the API is done using SwaggerUI, and Pydantic is used for data validation and setting management.
- Python 3.12.3
Preparation:
- Setup a virtual environment (conda, venv, etc).
- Run
pip install -r requirements.txt
to install necessary packages. - Create an env file named
.env
in the project root path and add the following environment variables:ACCESS_TOKEN_SECRET_KEY ACCESS_TOKEN_VALIDITY_MINUTES DB_NAME DB_HOST DB_PORT DB_USERNAME DB_PASSWORD
Set up local PostgreSQL DB:
- Start container with
docker-compose -f cicd/docker-compose.yml up -d
. - Stop container with
docker-compose -f cicd/docker-compose.yml down -v
.
Running:
- Run service with
uvicorn app.main:app --host 0.0.0.0 --port 8888 --reload
. - Check code style with
flake8
. - Run tests and mypy check with
coverage run -m pytest --mypy -s
. - Check coverage with
coverage report
.