The short version
The name is misleading. There are still servers. You just don't manage them. With traditional hosting, you rent a server (or container) that runs 24/7 whether anyone is using it or not. With serverless, your code only runs when a request comes in. The platform handles scaling, and you pay per execution rather than per hour.
Vercel, Netlify, AWS Lambda, and Cloudflare Workers all offer serverless hosting. If you've deployed a Next.js app to Vercel, your API routes are already running as serverless functions.
How it works
In a traditional setup, you have a server running continuously. It boots your application, keeps it in memory, and handles every incoming request. You pay for the server's uptime regardless of traffic.
In a serverless setup:
- A request arrives (someone visits your page, an API call is made).
- The platform spins up your function. If it's a "cold start" (no recent execution), this takes a moment. If the function was recently active, the platform reuses the warm instance.
- Your code runs and returns a response.
- The platform idles the function after a period of inactivity. You stop paying.
Key characteristics:
- Scaling is automatic. 10 requests or 10,000 requests, the platform handles it. No capacity planning.
- Cold starts are the trade-off. The first request after a period of inactivity is slower because the runtime needs to initialise. This can be anywhere from 50ms to several seconds depending on the platform and your code size.
- Execution time limits exist. Most serverless platforms cap function execution at 10-60 seconds. Long-running tasks (video processing, large data imports) don't suit this model.
- Stateless by default. Each function execution is independent. You can't store data in memory between requests. Use a database or external storage instead.
Serverless vs containers: containers give you a persistent server that runs continuously. Better for long-running processes, WebSocket connections, or when cold starts are unacceptable. Serverless is better for APIs, webhooks, and request-response workloads where traffic is unpredictable.
Why it matters
Serverless has made deployment dramatically simpler for most web applications. You push code, and it runs. No server configuration, no uptime monitoring, no scaling decisions. For most projects, especially early ones, it's the fastest path from code to live. Understanding its limits (cold starts, execution time, statelessness) helps you choose the right model for your project.