Live data from Hacker News

Ask HN: Where to Host a FastAPI App

news.ycombinator.com

21–30 of 35 posts

Re: Ask HN: Where to Host a FastAPI App

#21
post #12

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…

That was fast.

Are CEOs just smashing refresh on HN looking for their names? (jk, I know it's some API driven thing)

Re: Ask HN: Where to Host a FastAPI App

#23
post #8

Earlier quoted context omitted.

Great 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.

Or you could use caddy from the get go

The 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

Re: Ask HN: Where to Host a FastAPI App

#24
post #18
post #9

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 Digit…

>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 o…

> 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.

This makes very little sense to me. I’ve been using $4 droplets to host a variety of projects (much of the time on the same server) and have rarely hit such issues.

How inefficient is the code for it to need the $24 droplet?

You probably shouldn’t be building the image on the droplet though, maybe build locally, release to docker registry, and only pull the image from the server.

Re: Ask HN: Where to Host a FastAPI App

#25
post #21
post #12

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…

That was fast. Are CEOs just smashing refresh on HN looking for their names? (jk, I know it's some API driven thing)

Coincidences can happen. :)

Re: Ask HN: Where to Host a FastAPI App

#26
post #24
post #18

Earlier quoted context omitted.

>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 o…

> 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. This makes very little sense to me. I’ve been using $4 droplets to host a variety of projects (much of the time on the same server) and have rarely hit such issues. How inefficient is the code fo…

That's what I'm going to move to. It's part of the learning process for me. I want to set the image to build when I push to my repository.

I also think moving from npm to pnpm and leveraging caching will help. But the dockerfile itself is very very simple.

Re: Ask HN: Where to Host a FastAPI App

#27

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.

I 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

[2] https://github.com/pgjones/hypercorn

[3] https://www.uvicorn.org

Re: Ask HN: Where to Host a FastAPI App

#28
post #8

Earlier quoted context omitted.

Great 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.

Or you could use caddy from the get go

Good 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.

Re: Ask HN: Where to Host a FastAPI App

#30
post #21

Earlier quoted context omitted.

That was fast. Are CEOs just smashing refresh on HN looking for their names? (jk, I know it's some API driven thing)

Coincidences can happen. :)

LOL! 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.
Post reply on HN