Serverless & edge

Background jobs for serverless and edge.

Run reliable background work on Vercel, AWS Lambda, Cloudflare Workers, and Supabase — without an always-on worker. SimpleQ delivers each job to a function you already have.

Run background jobs on serverless without an always-on worker. SimpleQ is a managed queue that durably stores each job and POSTs it to a function you already have — a Vercel route, an AWS Lambda, a Cloudflare Worker, or a Supabase Edge Function — with retries, per-queue rate limiting, and backpressure that defers on 429s instead of burning your retry budget. Your function verifies the signature and runs the work; SimpleQ owns the durable queue and guarantees delivery. The things serverless makes worse — short-lived functions, no process to host a queue, a crash mid-request losing the job — are exactly what it removes.

publish-a-job.sh
bash
1# Publish a job from anywhere SimpleQ delivers it to your function.
2curl -X POST https://api.simpleq.io/v1/queues/reports/jobs \
3 -H "Authorization: Bearer sq_live_..." \
4 -H "Content-Type: application/json" \
5 -d '{
6 "payload": { "userId": "u_123", "task": "generate-report" },
7 "idempotencyKey": "report_u_123"
8 }'
9 
10# Or with the TypeScript SDK:
11# await sq.publish("reports", { payload: { userId: "u_123" }, idempotencyKey: "report_u_123" });
PlatformYour worker isHow SimpleQ fits
Vercel / Next.jsa Route Handler (app/api/…)POSTs each job to your route
AWS Lambdaa Function URL / API Gatewayinvokes your Lambda per job, HMAC-signed
Cloudflare Workersa fetch handlerdelivers each job over HTTP
Supabasean Edge Function (Deno)POSTs each job to your Edge Function

Dig deeper: backpressure, ack mode, how SimpleQ compares, and pricing. Full API docs at docs.simpleq.io.

Vercel & Next.js

How do I run background jobs on Vercel and Next.js?

Deploy a normal Next.js Route Handler as your worker and point a SimpleQ queue's webhookUrl at it. SimpleQ durably stores each job and POSTs it to your route; you verify the signature, do the work, and return 200. Publish from a server action, an API route, or the TypeScript SDK. For jobs longer than the function's response window, finish in Vercel's waitUntil or switch the queue to ack mode and call /ack when done.

app/api/jobs/route.ts
ts
1// app/api/jobs/route.ts — your serverless worker on Vercel
2import { verifyWebhook } from "@simpleq/sdk";
3 
4export async function POST(req: Request) {
5 const raw = await req.text();
6 // Throws if the signature doesn't match the queue's signing secret.
7 const job = verifyWebhook(
8 raw,
9 req.headers.get("x-simpleq-signature"),
10 process.env.SQ_SIGNING_SECRET!,
11 );
12 
13 await handle(job.payload); // your code — runs on Vercel, unchanged
14 
15 return new Response("ok", { status: 200 });
16}
AWS Lambda

How do I run background jobs on AWS Lambda?

Expose a Lambda behind a Function URL (or API Gateway) and set it as the queue's webhookUrl. SimpleQ invokes it once per job with an HMAC-signed body; you verify, process, and return 200. Because SimpleQ owns the queue, retries, and backpressure, the Lambda stays a plain request/response function — no SQS polling, no visibility-timeout bookkeeping.

handler.ts
ts
1// handler.ts — Lambda Function URL worker
2import { verifyWebhook } from "@simpleq/sdk";
3 
4export const handler = async (event) => {
5 // Function URLs / API Gateway can base64-encode the body; decode to the
6 // raw bytes the signature was computed over.
7 const rawBody = event.isBase64Encoded
8 ? Buffer.from(event.body, "base64").toString("utf8")
9 : event.body;
10 
11 const job = verifyWebhook(
12 rawBody,
13 event.headers["x-simpleq-signature"],
14 process.env.SQ_SIGNING_SECRET,
15 );
16 
17 await handle(job.payload);
18 
19 return { statusCode: 200, body: "ok" };
20};
Cloudflare Workers

How do I run background jobs on Cloudflare Workers?

A Worker's fetch handler is your job endpoint — set its URL as the queue's webhookUrl. SimpleQ delivers each job over HTTP; you verify the signature, do the work, and return 200. For work that outlives the response, use the Worker's waitUntil to finish after responding, or ack mode to report the outcome later.

worker.ts
ts
1// worker.ts — Cloudflare Worker job endpoint
2import { verifyWebhook } from "@simpleq/sdk";
3 
4export default {
5 async fetch(req: Request, env: Env): Promise<Response> {
6 const raw = await req.text();
7 const job = verifyWebhook(
8 raw,
9 req.headers.get("x-simpleq-signature"),
10 env.SQ_SIGNING_SECRET,
11 );
12 
13 await handle(job.payload);
14 
15 return new Response("ok", { status: 200 });
16 },
17};
Supabase Edge Functions

How do I run background jobs on Supabase?

Write a Supabase Edge Function (Deno) and point the queue's webhookUrl at its URL. SimpleQ POSTs each job; you verify the signature against your signing secret, run the work, and return 200. Publish jobs from a Postgres trigger, a database webhook, or your app — SimpleQ handles retries, rate limiting, and dead-lettering.

supabase/functions/jobs/index.ts
ts
1// supabase/functions/jobs/index.ts — Supabase Edge Function
2import { verifyWebhook } from "npm:@simpleq/sdk";
3 
4Deno.serve(async (req) => {
5 const raw = await req.text();
6 const job = verifyWebhook(
7 raw,
8 req.headers.get("x-simpleq-signature"),
9 Deno.env.get("SQ_SIGNING_SECRET")!,
10 );
11 
12 await handle(job.payload);
13 
14 return new Response("ok", { status: 200 });
15});
FAQ

Serverless jobs, answered.

The questions teams ask before moving background work onto SimpleQ.

Yes. On serverless and edge platforms there's no always-on process to host a queue or a worker loop — so you offload the durable part. SimpleQ is the managed queue and delivery layer; your serverless function is the worker. You POST a job to SimpleQ, it stores the job durably, and it POSTs the job to your function with retries, rate limiting, and backpressure. Your function only has to handle one request and return 200.

Ship background jobs from your serverless app.

Free tier covers 30,000 attempts a month. Point a queue at your function and publish your first job in minutes.