1. Project layout & entrypoint
forkrail automatically locates app in app.py, index.py, server.py, main.py, or asgi.py at the project root or under src/, app/, or api/ — or specify an explicit module in pyproject.toml:
from fastapi import FastAPIfrom fastapi.middleware.gzip import GZipMiddlewareapp = FastAPI()app.add_middleware(GZipMiddleware, minimum_size=1000)@app.get('/health')async def health(): return {'status': 'ok'}Pin your Python version in .python-version or requires-python (3.12, 3.13, or 3.14; defaults to 3.13). Dependencies install for Linux arm64 manylinux wheels inside the builder and cache between deploys.
2. Deploy & tail logs
# Deploy a previewforkrail deploy# Ship to productionforkrail deploy --prod# Stream requests, Python print/logging output, and outgoing HTTP callsforkrail logs billing-api --app --follow3. Concurrent compute & AWS connectivity
- Async I/O shines: Because uvicorn serves up to 10 concurrent streams per Lambda worker, FastAPI endpoints waiting on Postgres, Redis, or external APIs pay for one warm worker instead of ten.
- Need strict isolation? Set
"fluid": falseinvercel.json(orforkrail project billing-api --concurrent false) for one request per worker. - Keep startup fast: Run slow warm-up work in FastAPI lifespan background tasks rather than blocking import time.
- Private AWS services: Assign an IAM role (
--role) for boto3 without keys, or expose internal RDS/Postgres targets via--egress.
Related documentation
Ready to deploy your FastAPI project inside your own AWS account?
Quickstart