From "works on my machine" to production
Your app lives on your laptop. For the world to use it, it needs to run on a machine that is on 24/7, accessible over the internet and resilient to failures. There are several ways to achieve this, and choosing well saves money and headaches.
PaaS (Platform as a Service)
The fastest option: you upload the code and the platform takes care of building, running and serving it. Vercel and Netlify shine for frontends and functions; Render, Railway or Fly.io run complete backends. You don't manage servers or operating systems.
# Deploying is usually as simple as connecting the repo and pushing
git push origin main # the platform detects the change and redeploys
- Pros: speed, zero server administration, automatic deployments from Git.
- Cons: less control and, at large scale, it can get expensive.
Containers in the cloud
A container (Docker) packages your app with its dependencies so it runs the same anywhere. You deploy it on services like Cloud Run or AWS Fargate (the provider launches and scales the containers for you) or on Kubernetes (an orchestrator that manages many containers, their health and their scaling; very powerful, but complex).
- Pros: portability ("same box" locally and in production) and fine control of the environment.
- Cons: more pieces to maintain; Kubernetes is only justified at a certain scale.
Serverless (on-demand functions)
You write functions that run only when a request arrives; the provider starts, scales and shuts them down for you. You pay per execution, not for keeping a machine on.
- Pros: scales to zero (you don't pay if no one uses it) and scales automatically under spikes.
- Cons: cold start (latency when waking up) and limits on duration and memory per invocation.
Static front + CDN
A SPA or a static site are files (HTML, CSS, JS). The ideal is to serve them from a CDN: a network of servers spread around the world that deliver the content from the node closest to the user. Result: very fast, very cheap and very hard to take down.
Rule of thumb: static front on CDN, API on PaaS, container or serverless depending on traffic, budget and the control you need.