Framework
FastAPI
FastAPI applications served by Uvicorn.
8000Requirements
requirements.txt with fastapi and uvicorn
DropDeploy runs pip install -r requirements.txt then starts uvicorn.
main.py in the repo root with app = FastAPI()
DropDeploy runs uvicorn main:app. Module = main, instance = app.
Demo app
A minimal app that is ready to push and deploy. Copy the files below into a new repository, commit, and deploy — it should go live without any changes.
fastapi uvicorn[standard]
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.get("/", response_class=HTMLResponse)
def root():
return """
<html>
<body style="font-family:system-ui;display:flex;justify-content:center;
align-items:center;min-height:100vh;margin:0;
background:#0f172a;color:#f1f5f9">
<div style="text-align:center">
<h1 style="color:#0d9488">Hello from DropDeploy!</h1>
<p style="color:#94a3b8">FastAPI app is live.</p>
</div>
</body>
</html>
"""
@app.get("/api/health")
def health():
return {"status": "ok"}Build & start commands
DropDeploy runs these steps inside the container when you click Deploy.
pip install -r requirements.txt uvicorn main:app --host 0.0.0.0 --port 8000
Environment variables
Set these in Project → Env Vars in the dashboard. Never commit secrets.
| Variable | Required | Description |
|---|---|---|
| DATABASE_URL | No | Pass to SQLAlchemy or databases for DB connections. |
| SECRET_KEY | No | For JWT or session signing. |
Common issues
App object not at main:app
If your FastAPI instance is in a different file or named differently, you need a custom Dockerfile.
Missing uvicorn in requirements.txt
Add uvicorn[standard]. Without it the container fails to start.