FastAPI Vercel Template, UV for dependency management
- Python 3.12 or higher
- UV package manager (Install UV)
git clone <your-repo-url>
cd fast-api-vercel-template# Create a virtual environment
uv venv
source .venv/bin/activate
uv sync
pre-commit install
cp .env.example .envvercel devThe API will be available at http://localhost:8000
# Install all dependencies from pyproject.toml
uv sync
# Install a new dependency
uv add package-name
# Install a development dependency
uv add --dev package-name
# Update dependencies
uv sync --upgrade
# Generate requirements.txt (needed for vercel deploy)
uv pip compile pyproject.toml -o requirements.tx# Run a command in the virtual environment
uv run python script.py
# Run with specific Python version
uv run --python 3.12 python script.py
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=api --cov-report=term-missing --cov-report=html:htmlcov
# Run linting
uv run ruff check .npm install -g vercel# Login to Vercel (first time only)
vercel login
# Make requirements file (todo, automate)
uv pip compile pyproject.toml -o requirements.txt
# Deploy to production
vercel deploy --prod
Set environment variables in your Vercel dashboard or using the CLI:
vercel env add VARIABLE_NAME