FastAPI hosting with a public address, from GitHub
Push the repository, set the start command to uvicorn, give the app an address. Python is detected from requirements.txt, the app runs in its own sandbox, and every push redeploys it.
What the repository needs
- requirements.txt with
fastapianduvicorn. - A start command on the app's page:
uvicorn main:app --host 0.0.0.0 --port $PORT, wheremain:appnames your module and app object. - Secrets in environment variables, read with
os.environ.
That is the whole deployment. Pydantic models, dependency injection and async routes need nothing from the host.
Workers and memory
One uvicorn worker serves a small API comfortably in 256 MB. For CPU-bound routes add --workers 2 on a Starter app with 1 GB; async I/O-bound routes rarely need more than one worker. The panel shows live memory and the crash doctor names an out-of-memory exit for what it is.
The docs page and the address
FastAPI's /docs and /redoc pages work at the app's address as they do locally. Put the address behind your own domain from the app's page when you have one; the certificate is handled for you.
Frequently asked questions
Can I run gunicorn with uvicorn workers?
Yes: gunicorn -k uvicorn.workers.UvicornWorker -b 0.0.0.0:$PORT main:app as the start command, with gunicorn in requirements.txt.
Which port does the app listen on?
The PORT environment variable, 8080 by default, on 0.0.0.0. A server bound to 127.0.0.1 answers only itself and the web address gets nothing.
How does the public address work?
Give the app a web address in the panel and it is served at https://name.fadehost.app behind the Cloudflare proxy with a certificate. It comes with the plan on every tier. On the free tier the address sleeps when nobody has used it for a while and wakes on the next request; on a paid tier it stays awake. Your own domain can point at it.
What happens on a deploy?
The repository is cloned at your branch, dependencies install, the build runs when there is one, the app starts. With auto-deploy on, every push does the same. The live console shows each step; a failed one is explained in plain words.
Where do files and databases live?
Files written under /data survive redeploys; everything else is rebuilt from the repository. Every paid app includes a one-click MySQL database; PostgreSQL, MongoDB and Redis are managed databases on the same private network, never on the public internet.