6 ms·
Ask HN: 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.
- begoon 3y agohttps://deta.space https://deta.space is underrated.
- Saphyel 3y agoIf 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)
- eandre 3y agoThanks for the shoutout, happy to answer any questions about Encore if anyone's curious. (I'm the founder.)
- sha-3 3y agoI 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/runtimes/python https://vercel.com/docs/functions/serverless-functions/runti...
- yawnxyz 3y agoI 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)
- Nezteb 3y agoSome options: - https://fly.io/ https://fly.io/ - https://render.com/ https://render.com/ Your best bet is probably to containerize your application instead of looking for services that natively support ASGI.
- dkatz23238 3y agoI 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.
- vlod 3y agoProbably 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.
- dkatz23238 3y agoGreat choice. Setting up https from scratch using nginx is something you should definitely do ONCE in your life but then use automated tools such as nginx-proxy/acme-companion.
- imran-iq 3y agoOr you could use caddy from the get go
- djbusby 3y agoThe Apache stuff I learned like 20 years ago still works - especially for not-huge sites (<600RPS). Point being, once you get this sys-admin task done it's super repeatable (regardless of server). And from one, moving between isn't that hard either. Dozens of personal services can run on a $5/mo VPS. One I have now is nginx to SSL terminate to 8 backend docker-things
- lsferreira42 3y agoStill running apache for my side projects too, it's very convenient and easy to deal.
- zoom6628 3y agoGood pun +1 for that. I recommend nginx or Apache for the learning exercise. Then go with whatever best suits your use case. My rule is choose that which fits the objective and which doesn't overburden with cognitive load. So I don't use Apache for anything and sometimes just use python's built in. suitability for purpose and usability is what counts for me.
- tdsone3 3y agomodal.com feels the easiest https://modal.com/docs/guide/webhooks#serving-asgi-and-wsgi-apps https://modal.com/docs/guide/webhooks#serving-asgi-and-wsgi-...
- aobdev 3y agoI 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.
- dimmke 3y ago>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. So, I'm currently dealing with this (like, today.) I containerized my web app. I started out with a $4 Droplet on DO. SSH'd into it, installed all the Docker stuff and cloned my repo. Could not even run npm ci with the resources available. I kept having to resize the VM. First up to the $6 then I was running into different stuff. I ended up going up to the $24 / mo option just to get the image building. I didn't step up to every price point, because I just wanted to get the thing working, but I was really surprised at this. I don't think my Docker container is particularly resource intensive. I dialed it back to the $12 / mo option and will see how it goes. But at least I have my whole app in a Dockerfile and the remaining infrastructure in a Docker Compose file. I like having that level of control. Personally, my issue with PaaS is on top of being more expensive and potential vendor lock in, it often has its own little gotchas that end up not making it more convenient than the "hard way." I tried to use Digital Ocean's App Platform to build my image instead before and it was giving me Vite issues. It literally wouldn't compile even though it was compiling just fine locally and on the VM. I think about other services like Cloudinary too. Compared to just using Sharp to do things like image transcoding. I just don't see the value there. Overall, devops is not my area. I used to consider myself a front-end developer. But I'm glad I have been learning these skills. I don't think these "value added" services are worth the squeeze.
- segfault88 3y agoGoogle 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-deploy/deploy-python-service https://cloud.google.com/run/docs/quickstarts/build-and-depl...
- gpjt 3y agoPythonAnywhere 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.
- djbusby 3y agoThat was fast. Are CEOs just smashing refresh on HN looking for their names? (jk, I know it's some API driven thing)
- badrequest 3y agoCoincidences can happen. :)
- deleted 3y ago[deleted]
- gpjt 3y agoLOL! I was just scrolling through HN before bed and spotted a headline about FastAPI, which was very much top of my mind after the go-live on the beta today. Clicked through and saw it mentioned us, so posted right away.
- flybayer 3y agohttps://www.flightcontrol.dev https://www.flightcontrol.dev, easy deployment to AWS (I'm cofounder) https://www.flightcontrol.dev/docs/getting-started/python https://www.flightcontrol.dev/docs/getting-started/python
- hipadev23 3y agoLiterally any $5/mo VPS provider?
- Thaxll 3y agoOracle cloud: https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier.htm https://docs.oracle.com/en-us/iaas/Content/FreeTier/freetier...
- ydnaclementine 3y agocheapest vps you can find plus dokku
- mvkvc 3y agoFly.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.
- ryantmulligan 3y agoYou can fork Replit's FastAPI template and edit it and deploy from the online editor https://replit.com/@replit/FastAPI?v=1 https://replit.com/@replit/FastAPI?v=1 It uses uvicorn as recommended by the FastAPI docs.
- hbcondo714 3y agoI switched[1] to Hypercorn[2] because Uvicorn currently supports HTTP/1.1[3] and WebSockets [1] https://github.com/hbcondo/revenut-api/blob/main/Procfile https://github.com/hbcondo/revenut-api/blob/main/Procfile [2] https://github.com/pgjones/hypercorn https://github.com/pgjones/hypercorn [3] https://www.uvicorn.org https://www.uvicorn.org
- savrajsingh 3y agoGoogle App Engine. Most apps will live comfortably in the free / extremely cheap tier.