HACKER Q&A
📣 techlover14159

Where to Host a FastAPI App


I am looking for something similar to pythonanywhere which is great for WSGI apps but it doesn't support ASGI apps which I need.


  👤 gpjt Accepted Answer ✓
PythonAnywhere founder here: your timing is impeccable! Literally today we started our beta-testing of our initial implementation of ASGI support. Features are limited right now but you can start and run a FastAPI site with a single request to the API -- no UI yet, but we decided to release the backend while we were working on the frontend so that people could give the tires a kick ASAP. If you're interested, drop us a line at the usual support address and I'm sure we can on-board you if it does what you need.

👤 vlod
Probably an unpopular opinion with everyone preferring to hand over money for convenience, but the advantage of learning to be able to do this yourself with nginx will bring a lifetime of self reliance/money saving.

Yes it will take time to learn it, but the ability to spin up a super cheap digital-ocean/linode/hetzner node is a valuable skill to have in your back pocket.


👤 Nezteb
Some options:

- https://fly.io/

- https://render.com/

Your best bet is probably to containerize your application instead of looking for services that natively support ASGI.


👤 mvkvc
Fly.io! Your instance auto-sleeps and saves you money compared to other static VPS. Also no vendor lock-in as it's based on Docker containers.

👤 aobdev
I think it depends on your goals. If this is a serious project and your first deployment, consider Platform-as-a-Service (PaaS) and a managed database (DBaaS). If it's a hobby project and you're interested in learning about infrastructure you could run your app, database, and reverse proxy on a single Linux VM, which any cloud will offer.

For PaaS, if you want a set-it and forget-it solution check out Render or DigitalOcean App Platform. If you want to dive a little bit deeper and learn about different offerings from the major cloud providers, compare the features of Google Cloud Run and App Engine, or AWS App Runner. All of these providers offer databases too.

Either way I recommend learning how to containerize your app because then you can run anything almost anywhere.


👤 ryantmulligan
You can fork Replit's FastAPI template and edit it and deploy from the online editor https://replit.com/@replit/FastAPI?v=1

It uses uvicorn as recommended by the FastAPI docs.


👤 sha-3
I have hosted FastAPI apps in the past using Vercel Serverless Functions [0]. The Python runtime is available in Beta on all plans.

[0]: https://vercel.com/docs/functions/serverless-functions/runti...



👤 hipadev23
Literally any $5/mo VPS provider?


👤 tdsone3

👤 Saphyel
If you want to try new options I highly recommend:

* encore.dev

* koyeb.com

They are not as popular as other services but they provide a good service very cheap/free.

I have no complains so far for my 4 pet projects (I use litestar with docker for all my projects)


👤 dkatz23238
I am very happy with gcp. You can setup a cloud build trigger to build and push to gcr then deploy to gke or cloud run. A bit more involved that pythonanywhere but more flexible and arguably more powerful.

👤 yawnxyz
I wrote a couple of toy FastAPI apps (not production) and I'm happy with Fly.io. Apparently they have lots of downtime issues, but I've never run into them (yet)

👤 begoon
https://deta.space is underrated.

👤 savrajsingh
Google App Engine. Most apps will live comfortably in the free / extremely cheap tier.

👤 segfault88
Google Cloud Run - tl;dr push a container that listens on PORT. Google Cloud runs it.

The quick start is even easier to get going since they have some hooks to quickly build the container: https://cloud.google.com/run/docs/quickstarts/build-and-depl...


👤 ydnaclementine
cheapest vps you can find plus dokku