A function is a small backend endpoint
Think of it as one route handler or job packaged separately from a server. You upload code, the platform runs it when an HTTP request, queue message, database event, cron schedule, or webhook arrives.
A serverless function is not a smaller server. It is a short-lived piece of backend code that runs only when something happens: a request, webhook, queue message, cron schedule, file upload, or database event. For full-stack developers, it is best understood as a route handler, job worker, and integration glue layer that you do not keep running all day.
Use functions for short, event-triggered work.
Do not use them as tiny always-on servers.
Keep state in databases, queues, KV, or object storage.
Think of it as one route handler or job packaged separately from a server. You upload code, the platform runs it when an HTTP request, queue message, database event, cron schedule, or webhook arrives.
A traditional server stays on. A function starts when needed, runs briefly, then disappears. This is why free tiers can be generous for low-volume automations and APIs.
Do not expect long-lived memory, local disk, background daemons, or stable TCP connections. Functions are best when each invocation can finish independently.
Edge functions run close to users and are great for fast request rewriting, auth checks, and lightweight APIs. Regional cloud functions are better for heavier jobs, integrations, and backend events.
Receive Stripe, GitHub, Slack, Notion, or payment-provider events without keeping a server online all day.
Add contact forms, newsletter signup, search proxying, signed uploads, AI calls, and database writes to static hosting.
Run sitemap refreshes, cache warmups, report emails, database cleanup, quota checks, and lightweight monitoring on a schedule.
Validate JWTs, rewrite URLs, route traffic, enrich headers, block abusive requests, or adapt APIs at the edge before hitting your origin.
Connect storage events to image processing, queues to email sending, database changes to notifications, and third-party APIs to internal workflows.
Useful for short AI moderation, embeddings calls, PDF parsing, metadata extraction, and one-off transforms, as long as timeouts and cost caps are respected.
Choose by trigger, runtime limits, and where the function lives relative to your frontend, database, and users.
Great for request middleware, edge APIs, redirects, lightweight auth, and CDN-adjacent logic with a generous daily request quota.
Strongest ecosystem for queues, storage events, cron, API Gateway, and backend automation, but setup complexity is higher.
Best when your app already uses Firebase Auth, Firestore, Storage, or FCM and you want event-driven backend glue.
Convenient for forms, small APIs, and frontend-adjacent endpoints, but commercial policy, timeout, and quota rules matter.
Use the table for quota scanning. The surrounding sections explain what those quotas mean in real full-stack architecture.
| PROVIDER | FREE STORAGE | MONTHLY BANDWIDTH | SPECS / COMPUTE | CONNECTION LIMITS | KEY CONSTRAINTS | ACTION |
|---|---|---|---|---|---|---|
Cloudflare WorkersV8 ISOLATE / EDGE | 100k Requests / Day | Unmetered Ingress | Max 10ms CPU time per request, Global Edge Network | Auto-Scaling | Hard 10ms CPU limit; strictly bursts on heavy algorithms | Go to Site ↗ |
AWS LambdaFAAS / EVENT-DRIVEN | 1M Requests / Month | 400k GB-Seconds free/mo | Supports x86 & ARM64 (Graviton2) | Auto-Scaling | Cold start latencies on infrequent hits | Go to Site ↗ |
Microsoft AzureAZURE FUNCTIONS | 1M Requests / Month | 400k GB-Seconds (Consumption Plan) | Requires companion storage account (micro-fees apply) | Auto-Scaling | Linux runtime v3 end-of-life; must target v4 architecture | Go to Site ↗ |
Cloud Functions for FirebaseEVENT-DRIVEN / SERVERLESS | No-Cost Quota Amounts | Triggers from Firebase, HTTPS, Admin SDK, and Cloud Scheduler jobs | Managed JavaScript, TypeScript, or Python functions with automatic scaling and Firebase/Google Cloud integration | Built for event-driven app backends that want zero server management | Deploying beyond free quota requires Blaze pay-as-you-go billing; not a permanently free production runtime | Go to Site ↗ |
Alibaba Cloud (Aliyun)FUNCTION COMPUTE | 1M Invocations / Mo | 400k CU-Seconds free quota | Excellent GPU/AI Inference scaling setup | Auto-Scaling | Strict bill-shock risk if under heavy web attack | Go to Site ↗ |
Alibaba Cloud (China)FUNCTION COMPUTE | 3-Month Free Trial Only | 1M Calls / 400k GB-Secs (Resets for 3 cycles) | GPU-accelerated runtime optimization available | Auto-Scaling | NOT Always Free; auto-switches to raw pay-as-you-go billing after 3 months | Go to Site ↗ |
Tencent Cloud (SCF)CLOUD FUNCTION | 3-Month Free Trial | 1M GBs + 2GB Outbound (Trial) | Switches to paid subscription packages after 3 months | Auto-Scaling | NOT Always Free; requires paid minimum monthly plan post-trial | Go to Site ↗ |
Tencent Cloud (China)CLOUD FUNCTION (SCF) | 3-Month Free Trial Only | 1M Calls / 1M GBs / 2GB Outbound (First 3 Mo) | Requires minimum subscription package (~9.9 RMB/mo) post-trial | Auto-Scaling | 0 free tier after 3 months; charges daily minimum subscription fee permanently | Go to Site ↗ |
Vercel FunctionsNEXT.JS API | 50k Requests / Day | Shared 100GB Bundle | 1024MB Default Memory allocation | Auto-Scaling | Max 10s timeout; strict Non-Commercial Hobby rule | Go to Site ↗ |
Netlify FunctionsJAMSTACK API | 125k Requests / Month | 100 Hours compute limit | AWS Lambda downstream encapsulation | Auto-Scaling | Monthly quota reset; hard site 502 error on exhaust | Go to Site ↗ |
HTTP request, cron schedule, queue message, file upload, database event, and auth callback are different shapes. Pick the function platform that naturally supports your trigger.
A 10-second API route, a 15-minute Lambda job, and a 10ms CPU edge worker are completely different tools. Timeout and CPU shape decide the architecture.
Use databases, queues, object storage, KV, or durable objects for state. Treat local memory and local files inside a function as disposable.
Functions auto-scale by design. Add rate limits, auth, budget alerts, idempotency, and retry controls before exposing them to the public Internet.
A public endpoint can scale under traffic, bots, retries, or attacks. Free tiers are useful, but a missing rate limit can turn them into paid traffic multipliers.
Cold starts are fine for cron jobs and async tasks. They are painful for login flows, payment callbacks, chat commands, and first-page API calls.
Many concurrent function instances can open too many database connections. Use connection pooling, HTTP database APIs, queues, or provider-specific serverless drivers.
Event systems retry failed functions. Without idempotency keys, one payment, email, webhook, or database update can happen more than once.
Use Pages for the frontend, Workers for edge middleware and lightweight APIs, and Supabase for durable Postgres/Auth state.
A classic first use case: static hosting serves the site, a serverless function validates input, sends email, and writes a small record.
A durable background pattern for image processing, document parsing, report generation, and webhook fan-out.
Functions often complement static sites by adding forms, APIs, auth checks, and backend glue.
Use VMs when the workload must run continuously, hold local state, or manage long-lived connections.
Use containers when the workload needs Docker, custom binaries, background workers, or a full runtime image.
They can handle webhooks, small APIs, form submissions, scheduled jobs, auth checks, file-processing events, queue consumers, AI API calls, and glue code between cloud services. They are best for short, event-triggered work.
Avoid them for long-running services, stable WebSocket servers, heavy CPU jobs, stateful processes, local-disk workloads, and systems that cannot tolerate cold starts or retries.
They overlap, but edge functions are optimized to run close to users with tighter runtime limits. Regional serverless functions usually support heavier runtimes, longer execution, and deeper cloud integrations.
They can replace parts of a backend: API routes, webhooks, jobs, and integration code. They do not replace durable state, database design, queues, auth strategy, or observability.
Try Cloudflare Workers first for edge middleware and lightweight APIs. Try AWS Lambda for event-driven cloud automation. Try Vercel or Netlify Functions when your functions are attached to a frontend project.