The backend library between Auth0 and the AAI portal front end. Technical design document for this project lives in this Google doc.
Ensure you have the following installed:
- python 3.13+
- uv (installation instructions)
Follow these steps to set up the project:
-
Clone the Repository:
git clone https://github.com/AustralianBioCommons/aai-backend.git cd aai-backend
-
Set Up a Virtual Environment: Create and activate a virtual environment:
uv venv source .venv/bin/activate
-
Install Dependencies:
uv sync
For dev:
uv sync --extra dev
-
Install pre-commit:
pre-commit install
Use uv
to run the FastAPI application:
uv run fastapi dev main.py
Execute the test suite using pytest
:
uv run pytest
This command will automatically fix issues where possible:
uv run -- ruff check . --fix
pre-commit run --all-files
The deployed service uses a Postgres database on AWS RDS. In order to generate migrations for the database locally, we use a Postgres docker container to generate migrations against.
After making any changes to the database models, run the
generate_migrations.py
script to create migrations:
python generate_migrations.py -m migration_name
and commit them to git. Once your updated code has been
deployed on AWS, you can connect to the container via
the AWS CLI.
Run aws sso login
first, then aws ecs execute-command
to access a shell in the container:
aws ecs execute-command \
--cluster <cluster-id> \
--task <task-id> \
--container FastAPIContainer \
--command "/bin/sh" \
--interactive
and run the migrations:
uv run alembic upgrade head
Currently the service is deployed to AWS via the CDK scripts in deploy/
,
and updated on each commit to main
.
Secrets/configuration variables for the deployment are stored in the GitHub Secrets for the repository.