What Is Serverless?
Serverless is a cloud model where your backend code runs as on-demand functions — you don't provision or manage servers, and you pay per invocation rather than per idle server-hour.
The name is misleading. There are servers — you just don't manage them. Your code is packaged as a function, uploaded to a cloud platform, and runs when triggered. The platform handles scaling, redundancy, and uptime automatically.
How serverless functions work:
- A function is triggered by an HTTP request, a scheduled cron, a database event, or a queue message
- The platform allocates compute, runs the function, returns the response, and tears down
- If 1,000 requests arrive simultaneously, 1,000 function instances run in parallel
- You're billed for total execution time, not for idle capacity
Why serverless is the default for SaaS MVPs: Vercel deploys Next.js API routes as serverless functions automatically. Supabase Edge Functions run Deno code close to the database. You get a production-grade backend with zero server management and near-zero cost until you have real traffic.
Serverless trade-offs:
- Cold starts — the first invocation after idle takes longer (50–500ms depending on platform)
- Stateless — no persistent in-memory state; use Redis or a database for shared state
- Execution limits — most platforms cap function runtime at 10–60 seconds
When to use a traditional server instead: Long-running background jobs, persistent WebSocket connections, and CPU-heavy workloads are better suited to a dedicated server or container.