Authentication service
Clerk Server
The Clerk Server integration provisions a dedicated Clerk application programmatically via Clerk's Platform API (beta). It creates a brand-new application and instance on deploy, tears it down on delete, and exposes user/organization functions, health monitoring, and usage metrics against it.
Clerk Server is one of the Authentication service integrations. It handles its own webhook route:
/clerk-server/webhookWhat it does
On DEPLOYMENT_CREATED it calls Clerk's Platform API (POST /platform/applications) to create a new application and instance, then publishes applicationId, instanceId, publishableKey, secretKey, and frontendApiUrl as outputs. On DEPLOYMENT_DELETED it calls DELETE /platform/applications/{id}, resolving the application id from the deployment outputs so teardown works even after a cold start. Where Clerk connects to an existing application, this integration creates the application itself.
Platform API (beta)
Creating whole Clerk applicationsuses Clerk's Platform API, which is currently in beta and may need to be enabled on your Clerk workspace. It is authenticated with a Platform API access token (distinct from a Backend secret key) and the base URL is configurable viaCLERK_PLATFORM_API_BASE.Inputs
| Input | Required | Description |
|---|---|---|
applicationName | yes | Name for the new Clerk application to create. |
platformApiKey | optional | Clerk Platform API access token used to create the application. Leave blank to use the Dreambase-managed token (CLERK_PLATFORM_API_KEY). |
environmentType | optional | development (default — no domain, test keys on an accounts.dev domain) or production (live keys, requires a domain). |
domain | production | Domain for the production instance (e.g. app.example.com). Shown only when environmentType is production. |
template | optional | Optional Clerk application template to preconfigure the app (e.g. b2b-saas, b2c-saas, waitlist). |
Outputs
applicationId— the id of the provisioned Clerk application.instanceId— the id of the created Clerk instance (environment).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
The same user and organization functions as the Clerk integration, run against the provisioned instance via the Backend API:
createUser,getUser,listUsers,updateUser,deleteUser,countUsers— manage users.createOrganization,listOrganizations— manage organizations.
Metrics
number_of_users— total users in the provisioned application.number_of_organizations— total organizations.
Events it handles
WEBHOOK_CHALLENGE— verify the webhook endpoint.HEALTH_CHECK— confirm the provisioned instance is reachable.METRIC_UPDATE— report user and organization counts.DEPLOYMENT_CREATED— create the application and return its ids and keys.DEPLOYMENT_DELETED— delete the provisioned application.DOWNLOAD_STARTED— generate a.env.localfile or Next.jsmiddleware.tssnippet.FUNCTION_CALL— run a named user/organization function.