Deploy FastAPI API
A containerized FastAPI service with an explicit health route and optional PostgreSQL-backed state.
Publish a typed HTTP API with interactive docs, predictable container startup and a database only when the service keeps records.
Build plan
- Build from an official Python image, install locked dependencies first and copy the application second.
- Run one FastAPI process on 0.0.0.0:8000 and add a lightweight GET /health route.
- Create managed PostgreSQL only when the API keeps records, then run and verify its migrations before sharing the address.
Resources and values
1 ServicePostgreSQL when statefulDATABASE_URL when statefulApplication secret namesThe old tiangolo/uvicorn-gunicorn-fastapi base image is deprecated. Build the application image from an official Python base instead.
Ask your coding agent
Prepare this FastAPI repository for aidrop. Add a production Dockerfile based on an official Python image, install the locked dependencies before copying the application and run one FastAPI process on 0.0.0.0:8000. Add GET /health without changing existing API behaviour. If the service keeps records, create managed PostgreSQL, store DATABASE_URL as a Project value and run the existing migrations; otherwise do not add a database. Deploy, verify /health and /docs, then return the public address without printing secrets.
Put FastAPI API online
Connect your coding agent, paste the quickstart and keep the build, runtime and public address in one aidrop Project.
7 days free · No credit card required