Generar una secret key (usa la misma con el gateway):
openssl rand -hex 32Install it by running:
curl -LsSf https://astral.sh/uv/install.sh | shOnce installed, you can run to sync & install dependencies:
uv syncYou can activate the virtual environment with:
source .venv/bin/activateFinally, activate pre-commit:
pre-commit installRun API with:
fastapi dev --reload app/main.pyCreate tpii-network if not already created
docker network create tpii-networkStart the local stack with Docker Compose (API + Postgres):
docker compose watch-
JSON based web API based on OpenAPI: http://localhost:8000
-
Automatic interactive documentation with Swagger UI: http://localhost:8000/docs
-
Postgres db: http://localhost:5440
docker compose logsThe .env file contains all the configuration data.
Each environment variable is set up in the .env file for dev, but to let it prepared for our CI/CD system, the docker-compose.yml file is set up to read each specific env var instead of reading the .env file.
We are using a tool called pre-commit for code linting and formatting.
It runs right before making a commit in git. This way it ensures that the code is consistent and formatted even before it is committed.
You can find a file .pre-commit-config.yaml with configurations at the root of the project.
To lint manually:
bash scripts/lint.shTo format code manually:
bash scripts/format.shWhen the tests are run, a file htmlcov/index.html is generated, you can open it in your browser to see the coverage of the tests.
To run test manually:
bash scripts/test.shRefer to Seeds README.md .
There are already configurations in place to run the backend through the VS Code debugger, so that you can use breakpoints, pause and explore variables, etc. File with config located at .vscode/launch.json. If this repo is in within a workspace, move this config to the workspace root.
The setup is also already configured at .vscode/settings.json so you can run the tests through the VS Code Python tests tab.