Authentication service

Clerk

The Clerk integration adds authentication and user management to your project by connecting to a Clerk application — a Dreambase-managed shared one or your own dedicated one — and publishing its keys for other services to consume.

Clerk is one of the Authentication service integrations. It handles its own webhook route:

POST/clerk/webhook
Connect to a shared or dedicated Clerk application

What it does

On DEPLOYMENT_CREATED the service verifies the supplied keys against the Clerk Backend API and exposes publishableKey, secretKey, and frontendApiUrl as outputs for other services to wire into. It also answers health checks, reports user and organization metrics, and runs user/organization functions on demand.

Connect vs. provision

The clerk route attaches to an existing (shared or dedicated) Clerk application. To create a brand-new Clerk application programmatically, use the Clerk Server integration.

Inputs

InputRequiredDescription
serverTypeyesshared (default) uses a Dreambase-managed Clerk application — no setup, ideal for MVPs and development. dedicated connects to your own application.
applicationNameyesA label for this auth application, used in logs and deployment outputs.
publishableKeydedicatedYour Clerk publishable key (pk_test_… or pk_live_…), from the Clerk dashboard's API Keys page.
secretKeydedicatedYour Clerk secret key (sk_test_… or sk_live_…), kept secret.

Outputs

  • publishableKey — the Clerk publishable key, safe to expose to the frontend.
  • secretKey — the Clerk secret key, available to backend services.
  • frontendApiUrl — the Clerk Frontend API URL derived from the publishable key.

Functions

Other services can call these via a FUNCTION_CALL event:

  • createUser, getUser, listUsers, updateUser, deleteUser, countUsers — manage users.
  • createOrganization, listOrganizations — manage organizations.

Metrics

  • number_of_users — total users in the application.
  • number_of_organizations — total organizations.

Events it handles

  • WEBHOOK_CHALLENGE — verify the webhook endpoint.
  • HEALTH_CHECK — confirm the Clerk Backend API is reachable.
  • METRIC_UPDATE — report user and organization counts.
  • DEPLOYMENT_CREATED — verify credentials and return the keys as outputs.
  • DEPLOYMENT_DELETED — stop the deployment.
  • DOWNLOAD_STARTED — generate a .env.local file or Next.js middleware.ts snippet.
  • FUNCTION_CALL — run a named user/organization function.

Wire it into any service

Because the keys are published as deployment outputs, any service in your design can read publishableKey and secretKey without holding its own Clerk configuration.