The backend for Portal created using FastAPI! The frontend can be found here.
This project uses uv for fast, modern Python package management.
- Install uv (if not already installed):
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Or via pip
pip install uv
- Install dependencies and create virtual environment:
uv sync
- Set up pre-commit hooks:
uv run pre-commit install
- Copy
.env.example
to.env
and set all the environment variables as mentioned indocs/ENV.md
.
Simply run:
uv run uvicorn app.main:app --reload
You should see a message like:
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [98098] using watchgod
INFO: Started server process [98100]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: 127.0.0.1:58550 - "GET /docs HTTP/1.1" 200 OK
INFO: 127.0.0.1:58550 - "GET /openapi.json HTTP/1.1" 200 OK
Use http://127.0.0.1:8000
as the base URL of the endpoints and navigate to http://127.0.0.1:8000/docs
to see the auto-generated docs! 💃
We are deploying our FastAPI instance on AWS Lambda which is triggered via an API Gateway. In order to automate the process, we are using AWS SAM, which creates the stack required for the deployment and updates it as needed with just a couple of commands and without having to do anything manually on the AWS GUI. Refer to this blog post for more details.
The actual deployment happens through Github Actions. Look at .github/workflows/deploy_to_staging.yml
for understanding the deployment to Staging
and .github/workflows/deploy_to_prod.yml
for Production
. Make sure to set all the environment variables mentioned in docs/ENV.md
in the Production
and Staging
environments in your Github repository.