Functions

Function templates

Eight versioned starting points with working code, preselected triggers and security defaults, and step-by-step setup instructions. Everything they generate is editable.

The catalog

TemplateTriggerWhat it doesRequired secrets
Hello WorldHTTPJSON greeting; the smallest possible function—
Stripe WebhookHTTP (public, custom signature)Verifies Stripe-Signature on the raw body; idempotent payment/subscription handlingSTRIPE_WEBHOOK_SECRET (STRIPE_SECRET_KEY optional)
GitHub WebhookHTTP (public, custom signature)Verifies X-Hub-Signature-256 for push and issue eventsGITHUB_WEBHOOK_SECRET
Send EmailHTTP (API key) or DatabaseTransactional email through the Resend APIRESEND_API_KEY + EMAIL_FROM variable
OpenAI ProxyHTTP (JWT)Server-side OpenAI calls so your key never ships to browsersOPENAI_API_KEY
Image ProcessingStorageProcesses new uploads, writes derivatives to a separate prefix—
Database Change HandlerDatabaseAudit logging for INSERT/UPDATE/DELETE, deduped on eventId—
Scheduled CleanupScheduledNightly removal of expired rows; edit to your schema—

In the Console, Functions → Templates shows the catalog with code previews. “Use template” preselects the trigger type, authentication mode, signature mode, timeout and memory, and walks you through the required secrets and external configuration.

Stripe Webhook, end to end

  1. Create from the template

    The function is created with public authentication and custom signature mode — Stripe cannot send a CubiBase JWT, and no CubiBase HMAC is forced on it.

  2. Create the dedupe table

    CREATE TABLE stripe_events (id text PRIMARY KEY, type text, processed_at timestamptz); — the handler records every processed event id.

  3. Deploy and copy the URL

    The function URL is https://{slug}.api.cubibase.com/functions/{name}. Deploy first; the endpoint is live only after a successful deployment.

  4. Configure Stripe

    Stripe Dashboard → Developers → Webhooks → Add endpoint. Paste the URL; subscribe to payment_intent.succeeded and customer.subscription.deleted (or your events).

  5. Store the signing secret

    Copy the endpoint’s signing secret (whsec_…) into the STRIPE_WEBHOOK_SECRET secret and redeploy. Optionally set STRIPE_SECRET_KEY to use the official SDK verification path.

  6. Verify with a test event

    Send a test event from the Dashboard and check Executions & Logs. The integration is connected only when a signed test delivery succeeds — the Console never claims otherwise.

Additional resources