Skip to content

synthpop123/fly-fastapi

Repository files navigation

FastAPI on Fly.io

FastAPI Badge Swagger Badge Ruff Badge pre-commit Badge GitHub Actions Badge

Clone GitHub repo

git clone [email protected]:synthpop123/fly-fastapi.git
cd fly-fastapi

Install dependencies

uv venv
source .venv/bin/activate
uv pip install -r requirements.txt
uv pip install -r requirements-dev.txt

# Install pre-commit
pre-commit install

# Test pre-commit function
pre-commit run --all-files

Run locally

# Dev mode
fastapi dev

# Prod mode
fastapi run

Launching on Fly.io

# Launch on fly.io
fly launch

# Deploy on fly.io
fly deploy

GitHub Actions

Create a repository secret FLY_API_TOKEN, the value should be the deploy token generated from the fly.io dashboard.

Once git push is triggered, GitHub Actions will automatically run fly deploy.