This repository contains a gateway application used to orchestrate communication in Be Part Of the Event application.
- FastAPI gateway with Starlette middleware (sessions, CORS) and Auth0 authentication helpers.
- Python 3.12 managed via Poetry (production + dev dependency groups).
- Sentry SDK for error monitoring, tracing, and profiling.
- Docker Compose setup for local orchestration of dependencies and the API gateway.
- Postman collection (
FAstAPI with Aoth0.postman_collection.json) and static frontend (index.html) for manual auth flows. The HTML file is a developer helper only; production SPA/clients should replicate the PKCE/state flow on their side instead of referencing this file directly.
The purpose of this project is to build frame for the microservices.
- 2 kinds of frontends communication (web, mobile),
- Auth0 authorisation,
- gateway for:
- OCR,
- events service,
- receipt service,
- statement/reports service.
- Python >=3.12.7 with poetry package manager
- Docker Desktop / Docker + Compose
Tip: before running any command copy
docker/.env.templatetodocker/.env(and to the project root if you alterconfig.search_path). Fill in the Auth0 credentials, session secret, CORS allow-list, and optional Sentry values directly in that file—the inline comments explain every variable.
- Clone the repository:
git clone https://github.com/Cybernetic-Ransomware/bpoe-api-gateway.git
- Configure environment variables:
cp docker/.env.template docker/.envand update the values. - Run using Docker:
docker-compose -f ./docker/docker-compose.yml up --build
- Clone the repository:
git clone https://github.com/Cybernetic-Ransomware/bpoe-api-gateway.git
- Configure environment variables:
cp docker/.env.template docker/.envand update the values (they are required even for local dev). - Install poetry:
pip install poetry
- Install dependencies:
poetry install --with dev - Install pre-commit hooks:
poetry run pre-commit install poetry run pre-commit autoupdate poetry run pre-commit run --all-files
- Run the application locally:
poetry run uvicorn src.main:app --host 0.0.0.0 --port 8080 --reload
- Daily Commits: Stage your changes and create commits through Commitizen to keep messages consistent:
git add . poetry run cz commit
- The repository includes a Postman collection with ready-to-import webhook mockers located under
tests/resources/FAstAPI with Aoth0.postman_collection.json.
poetry install --with dev
poetry run pytest- Tests automatically load configuration from
tests/.env.test(seetests/conftest.py). Adjust this file to point at staging tenants or fake credentials when needed.
poetry install --with dev
poetry run ruff checkpoetry install --with dev
poetry run mypy .\src\poetry install --with dev
poetry run codespellpython -m http.server 8070- The project ships with a MkDocs Material site under
doc/that renders API reference straight from the Python docstrings viamkdocstrings. - Edit navigation/content in
mkdocs.ymland thedoc/directory; auto-generated reference pages live indoc/api/. - The
mkdocs.ymlconfig embeds Mermaid fences via!!python/nametags; becausecheck-yamlcannot parse those safely, this file is excluded from the pre-commit hook (see.pre-commit-config.yamlcomment for details). - Serve docs locally while coding:
poetry run mkdocs serve
- Produce a static site (generated into
site/) ready for hosting:poetry run mkdocs build
- The gateway is instrumented with
sentry_sdkinsidesrc/main.py. SetSENTRY_DSN(and the sampling rates) in your environment before starting the service so every exception, trace, and profile is captured in the proper project. - Telemetry is activated only when
SENTRY_DSNis provided; when left blank no events are sent, which is useful for local development. send_default_piiis disabled by default to avoid leaking user metadata. Enable it only if your compliance requirements allow attaching identities to errors.- For local development you can either omit
SENTRY_DSNor guard the initialization call to avoid noisy events. For CI/staging, consider reducingtraces_sample_rate/profiles_sample_rateto avoid unnecessary volume. - Consult the official Sentry FastAPI documentation for advanced configuration such as custom scrubbers or sampling rules.