Serverless Edge Functions
Event-driven, lightweight serverless functions with sub-5ms cold starts, zero ports to manage, and automatic scaling.
Supported:TypeScriptJavaScript (ES Modules)Web Standards API (Request / Response)
When to Use This Service
Ideal Use Cases
- Third-party webhook handlers (Stripe payments, GitHub events, Shopify webhooks, Slack interactions)
- Authentication hooks, token validation, and custom header transformations
- Lightweight database mutations, user signups, and email notifications
- Micro-endpoints and utility APIs where keeping a 24/7 server running is inefficient
- Event-driven compute dispatched on demand with zero baseline memory overhead
When to Choose Another Workload
- Heavy compute jobs running longer than 30 seconds
- Applications requiring native filesystem persistence or background daemon threads
- Full web frameworks requiring extensive server middleware
How to Use & Deploy
Option 1Deploy via Web Console
- 1In the console, click 'Create Edge Function' or navigate to Edge Functions.
- 2Enter a unique service name and choose your runtime (TypeScript / JavaScript).
- 3Write or paste your function handler in the interactive editor or deploy from your local workspace.
- 4Configure endpoint security: toggle 'Public Webhook' for third-party hooks, or keep 'Protected' to enforce API Key verification.
- 5Click 'Deploy Function'. Your endpoint is immediately accessible worldwide.
Option 2Deploy via CLI & Terminal
Deploy instantly from your local workspace terminal using the global Whizan CLI:
$ whizan function deploy --name payments-webhookOr prompt your AI Coding Assistant (Cursor / Antigravity MCP):
“Create and deploy a serverless edge function for Stripe webhook handling”
Practical Project Example
handler.ts
// Standard Web Request/Response handler
export default async function handler(request: Request): Promise<Response> {
if (request.method === "GET") {
return Response.json({ status: "active", time: new Date().toISOString() });
}
if (request.method === "POST") {
const payload = await request.json().catch(() => ({}));
// Process webhook event
console.log("Received event:", payload.event);
return Response.json({ success: true, processedAt: Date.now() }, { status: 200 });
}
return new Response("Method Not Allowed", { status: 405 });
}Configuration Reference
| Parameter / Setting | Description | Default / Recommended |
|---|---|---|
| isPublic | Whether the endpoint can be invoked without an API key (ideal for Stripe/GitHub webhooks) | false (Protected) |
| Runtime | Language runtime environment | TYPESCRIPT_V8 |
| API Key | Function-specific authorization key (whz_fn_live_...) required when isPublic is false | Auto-generated |
| Route Path | Subpath for this function endpoint (e.g. /webhook, /subscribe) | /* |
Best Practices & Pro Tips
Tip 1Use 'isPublic: true' strictly for third-party webhook receivers that cannot send custom authorization headers.
Tip 2Use 'isPublic: false' with dedicated Function API keys for user data, database mutations, and internal business logic.
Tip 3Edge functions use the standard Web fetch API and Response object — no proprietary vendor wrapper required.
