Skip to main content
Each example reads the secret key from CURIOUS_SECRET_KEY, serves one decision with a fallback, reports one event, and hands the flush to the runtime so nothing is lost when it exits or freezes.

Next.js (App Router)

Decide in server components and route handlers, where the key is secret and the user’s attributes are at hand. The page’s own text is the natural fallback.

Cloudflare Worker

Workers end when the response is sent; ctx.waitUntil(curious.flush()) keeps the event delivery alive past it.

Supabase Edge Function

Set the secret with supabase secrets set CURIOUS_SECRET_KEY=…. Pin an exact package version in production.

A Node job

Server-initiated channels decide once per send, which is the natural exposure. The idempotency key makes a crashed-and-rerun job safe.