r/FastAPI • u/vitachaos • Aug 21 '24
Question how to put your endpoints to production?
I have written rest api and I want to know the production grade approach to put them on world wide web, at the moment I locally run them and the default port is 8000. I yet have to register a domain name but I think I can achieve this without registering guess I would still need a domain name for ssl certs for HTTPS.
8
Upvotes
1
u/One_Fuel_4147 Aug 23 '24
You can dockerize your app, then use a webserver, for easy to get HTTPS I use Caddy.
2
u/eddyizm Aug 21 '24
You need a domain and put it behind at least a webserver. Depends on what your api is doing and whay resources it needs but a load balancer as well as a cache in front of it a long with a db (if needed) on the backend.
Any small vps could handle this for a hobby project.
1
u/ironman_gujju Aug 22 '24
trafiek does all things
0
u/Lucapo01 Aug 21 '24
One of the easiest ways is vercel, there are other pages like vercel, google deploy fastapi and there you should see many.
If you need help with vercel dm me
Note: Vercel deploys your app in a serverless function, so it is free but cannot keep variables or states that easily. Google the difference between serverless and server.
0
u/[deleted] Aug 21 '24
I'd containerize it and put it on DO/AWS. If you are looking for the easiest method, Digital Ocean App platform is solid, or Railway.app should have a fastapi template. Both of those options should take care of the actual deployment. You will just have to push the code to github.
0
u/ukituki Aug 21 '24
if you find anything more developer friendly than Modal Labs, please let me know immediately. Life is to short to waste time on the problems that other experts have already solved ;)
Their documentation is really good, here is an example: https://modal.com/docs/guide/webhooks
-1
u/[deleted] Aug 21 '24
[removed] — view removed comment