page:guides:fastapi:build and start
Configure build and start for FastAPI
Summary
Configure build and start for a FastAPI app on Ample. Start uvicorn from a small run.py that reads PORT; pass --start "python3 run.py" because Python start commands are not inferred. Ample detects the runtime, installs dependencies, runs the build when present and starts the app on the python-3.12 template behind a public HTTPS URL.
Prerequisites
- A requirements.txt (or pyproject) and a start command that reads PORT and binds 0.0.0.0
- An Ample account token with servers:write
Workflow Steps
Make the start command bind correctly
Start uvicorn from a small run.py that reads PORT; pass --start "python3 run.py" because Python start commands are not inferred.Deploy
Run the existing synchronous deploy once from the project directory and read the result. Exit 0 is live, 1 is failed, 2 is blocked on a required preflight action. Re-running with no change is a content-addressed no-op.ample deploy . --name --public --format json --start "python3 run.py"Verify
Fetch the live URL and run the success checks below. On failure read the build log, then the runtime log, fix the cause and deploy again; do not blind-retry.ample logs --kind build
Limitations
- Verified on the node-22 template at s-1vcpu-1gb; other templates and sizes are not verified by this recipe.
- Region, compliance attestations and request-duration limits are unknown and not claimed.
- Apps auto-pause when idle and wake on the next request; always-on is an operator setting, not a plan feature.
- Dependencies install with pip into .ample/python from requirements.txt; pyproject-only projects use uv when available.
Cost Estimate
- Monthly Amount: $5.00
- Currency: USD
Apps and managed databases auto-pause when idle; the estimate is the always-on monthly price of the tested sizes. Plan quotas and budgets apply.
Success Checks
- Page or root route responds:
- Kind: http_get
- Path: /
- Expect: ample canary fastapi basic
Examples
- fastapi-basic canary
FastAPI app started with uvicorn.
Evidence Summary
- FastAPI app installed with pip into .ample/python and started with uvicorn on python-3.12; / and /health served correctly.
Next Actions
- Browse the catalog index.
- Search published recipes by intent, stack and constraints.
- Prepare a side-effect-free deployment plan for an authorized project.