Loading pattern...

What is Serverless?

Serverless lets you run code without managing servers—you write functions, cloud provider runs them. AWS Lambda, Vercel Functions, Cloudflare Workers. Pay per execution, auto-scales to zero (no cost when idle), scales infinitely. Perfect for event-driven workloads (process uploaded file, send email, webhook handler). Not actually "serverless"—servers exist, you just don't manage them. Great for startups, avoid DevOps complexity.

When Should You Use This?

Use serverless for event-driven tasks (image processing, scheduled jobs, webhooks), APIs with unpredictable traffic (auto-scales), background jobs (queue processing), or when you want zero DevOps. Great for startups with limited eng resources. Don't use for long-running tasks (15-min timeout), high-frequency low-latency (cold starts), or stateful workloads (functions are ephemeral).

Common Mistakes to Avoid

  • Cold starts—first request slow (100-500ms), pre-warm functions or use Cloudflare Workers
  • Vendor lock-in—Lambda code hard to move off AWS
  • Cost at scale—serverless cheap at low volume, expensive at high volume vs dedicated servers
  • No local dev parity—local serverless simulation doesn't match cloud perfectly
  • Stateful logic—functions are stateless, use external storage (DB, S3)

Real-World Examples

  • Image processing—user uploads photo, Lambda resizes it
  • Webhook handlers—Stripe webhook triggers serverless function
  • Scheduled jobs—Daily report generation via cron-triggered Lambda
  • API backends—Vercel Functions power Next.js API routes

Category

System Design Patterns

Tags

serverlesslambdafaascloud-functionsaws-lambda

Permalink