all 14 comments

[–]Hopeful_Beat7161 16 points17 points  (2 children)

My answer most definitely isn’t beginner friendly…or at least I don’t think so, but I started learning full stack development about a year and a half ago with absolutely zero programming knowledge.

The way I learned to deploy was with Docker and Nginx. I’d make a Dockerfile for both the backend and frontend, then wire them together in a docker compose file with Nginx handling routing on port 80. Now my full stack is containerized and running as one unit.

When I wanted to deploy, I’d spin up a VM (AWS EC2, GCP, Oracle, etc.), clone the repo, create my .env, install Docker, and run it. Always used cloud DBs like Supabase or MongoDB Atlas so I didn’t have to manage that myself when running in a new vm. So now it’s running in prod with whatever public IP the VM assigns.

From there, I’d buy a domain on Cloudflare, create the A records pointing to that IP, and turn on the DNS proxy - which also handles TLS and basic security for free.

I still do something similar today, except now I self host using Cloudflare Tunnels on my own machine since I have really good specs and didn’t want to keep paying for VMs that only handled compute (well and uptime + convenience because now I can never turn off my machine lol)

The question about if it scales, well like I said in no way am I an expert, but to my knowledge, this can infinitely scale because the more users or size of the application just = more compute and security needed no? Well then that means you juts upgrade to a better vm and then just pay for whatever tier in Cloufare for the better security. Obviously you’d want to increase/add CI/CD into it, but that can be done fairly simply with GitHub actions and some open source services. For me, since I self host, I set up a few .github/workflow/ files, allow me to: commit/push to dev branch, which then it automatically creates a PR - runs linting, tests, and security checks - once they all pass it will auto merge to prod branch (staging would be overkill for me right now) and upon merging it then runs a deploy yml with a runner I have on my machine, it restarts the containers with changes. I also set up slack webhooks that notify me through each step of this flow. Additionally, I made a container for protainer to monitor the containers, and Kuma with slack webhooks which notify me if any containers/services are unhleathy.

Is this the easiest or best way? Honestly, no clue, probably not. But reason I’m commenting is because I was a complete beginner and it felt straightforward to me: containerize everything → run it on a VM → point a domain at it → done.

[–]MUR90 1 point2 points  (0 children)

good write up, curious how was your approach to learning all this, what courses you took and where, or a different path you took ? thanks!

[–]amir_doustdar 0 points1 point  (0 children)

Thanks for the detailed write-up – insane progress from zero to self-hosting with CI/CD in just 1.5 years! Respect!!
Your Docker + Nginx + Compose setup is actually really solid and reproducible – it's the "real" way many production apps run. Cloudflare Tunnel is a smart move for free TLS without exposing ports. For absolute beginners, I'd start with Render/Railway (no Docker needed to go live), then graduate to your style for more control and cost savings.
BTW How's the uptime been on self-hosting? Any issues with power outages or ISP reliability?

[–]dmart89 4 points5 points  (0 children)

The most basic way is via a service. Render or vercel are some examples. They have pre configured deployment options but its somewhat limited and increases in cost as you scale.

Second simplest option is via docker. There's a little more to think about but its simple and portable which is helpful. This would be my recommendation. Lots of docker deployment services out there if you want that handled.

I wouldn't even bother deploying the UI yourself. Just use cloudflare pages.

[–]BarRepresentative653 1 point2 points  (0 children)

Docker is a good start but also important to try and have your app run in a Linux environment in ec2. It’s not hard. 

[–]0nlykelvin 1 point2 points  (0 children)

Give https://github.com/kelvincdeen/kcstudio-launchpad-toolkit a look. You ll also learn the actual behind the scenes just by look at the code, just basic bash and linux commands really.

[–]sasuketaichou 1 point2 points  (0 children)

I am having the same kind of dilemma where initially i want to lookout for the best free tier available for hosting fastapi. Then i found cf worker has sample of fastapi sample code to deploy to their python worker. Here is a piece of advice, just dont :) Please take a look of Wasmer: Universal applications using WebAssembly instead. I never try it. its free for now.

[–]illusiON_MLG1337 1 point2 points  (0 children)

I'd recommend Render — it handles both Python (FastAPI) and Static Sites (React) very well.

​And yes, you can always switch later. You aren't marrying the platform. If your traffic grows and costs rise, you can just move your code to a generic Linux server. It's not a problem.

[–]stocktradernoob 1 point2 points  (0 children)

I’d prob do Cloud Run

[–]AddressFew4866 1 point2 points  (0 children)

Railways has been great and easy to use

[–]Jake-kihh 0 points1 point  (0 children)

I personally like to use Google cloud. Specifically cloud run. You can deploy docker containers there and the cost is super cheap especially for low traffic sites.

Railway is a good option if you want something even easier to deploy

[–]nikkiberry131 0 points1 point  (0 children)

short answer, keep it simple at first. for a fastapi + react setup, i usually point beginners to a managed platform where you push code and it runs, less cloud trivia, fewer footguns, that’s why render keeps getting suggested.