Platform services
Authentication
The Authentication service adds user management and sign-in to your project. Its first integration is Clerk, which you can attach to a shared, Dreambase-managed application or your own dedicated one.
What it does
Dreambase POSTs webhook events to the Authentication service; the service acts on them — verifying credentials, running health checks, executing function calls — and calls back into the Dreambase API to report status, logs, and outputs such as the publishable and secret keys other services consume.
Built on NestJS
The Authentication service is a NestJS application, sharing the same shape as the Database service. Each integration exposes a singlePOST /<name>/webhook endpoint, and the app can run as a single Vercel serverless function or as a local Node process.Integrations
Each integration has its own dedicated reference page:
Auth (generic)
A deployment-less placeholder for an external identity provider.
Clerk
Connect to a shared or dedicated Clerk application.
Clerk Server
Provision a dedicated Clerk application via the Platform API.
Each integration is its own webhook route:
/auth/webhook/clerk/webhook/clerk-server/webhookThe clerk route attaches to an existing (shared or dedicated) Clerk application, while clerk-server provisions a brand-new one — the same relationship as postgres vs. postgres-server in the Database service. The generic auth route is a deployment-less placeholder for an external or unmanaged identity provider, analogous to the generic database service.
Clerk
Clerk provides authentication and user management. Like the database integrations, the Clerk service offers two server types:
- Shared — use a Dreambase-managed Clerk application. No setup required; ideal for MVPs and development.
- Dedicated — connect to your own Clerk application by supplying its publishable key (
pk_…) and secret key (sk_…).
On DEPLOYMENT_CREATED the service verifies the keys against the Clerk Backend API and exposes publishableKey, secretKey, and frontendApiUrl as outputs for other services to wire into.
Clerk Server (provisioned applications)
The clerk-server integration goes a step further and creates a dedicated Clerk application for you, programmatically. 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 frontendApiUrlas outputs — the create response returns each instance's keys. 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.
The Platform API is authenticated with a Platform API access token (distinct from a Backend secret key), supplied per deployment (platformApiKey) or via the CLERK_PLATFORM_API_KEY environment variable. The environmentType input chooses which instance to create: development (default — no domain needed, test keys) or production (requires a domain, live keys). Health checks, metrics, downloads, and the functions below then run against the provisioned instance via the Backend API.
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. The base URL is configurable viaCLERK_PLATFORM_API_BASE.Functions it exposes
Other services can call these via a FUNCTION_CALL event:
createUser,getUser,listUsers,updateUser,deleteUser,countUsers— manage users.createOrganization,listOrganizations— manage organizations.
A function call arrives as an event shaped like this:
POST /clerk/webhook
{
"name": "FUNCTION_CALL",
"functionCall": {
"name": "createUser",
"arguments": {
"emailAddress": "user@example.com",
"firstName": "Ada",
"lastName": "Lovelace"
}
}
}Events it handles
WEBHOOK_CHALLENGE— verify the webhook endpoint.HEALTH_CHECK— confirm the Clerk Backend API is reachable.METRIC_UPDATE— reportnumber_of_usersandnumber_of_organizations.DEPLOYMENT_CREATED— verify credentials and return the keys as outputs.DEPLOYMENT_DELETED— stop the deployment.DOWNLOAD_STARTED— generate a.env.localfile or a Next.jsmiddleware.tssnippet.FUNCTION_CALL— run a named user/organization function.
Configuration
The service is configured through environment variables. The most important ones:
| Variable | Required | Description |
|---|---|---|
DREAMBASE_API_URL | yes | Base URL of the Dreambase API the service calls back into. |
CORS_ORIGINS | prod | Comma-separated allowed origins. |
CLERK_SHARED_SECRET_KEY | optional | Secret key (sk_…) for the shared Clerk application. |
CLERK_SHARED_PUBLISHABLE_KEY | optional | Publishable key (pk_…) for the shared Clerk application. |
CLERK_API_BASE | optional | Clerk Backend API base (default https://api.clerk.com/v1). |
CLERK_PLATFORM_API_KEY | optional | Platform API access token used by clerk-server to create applications. |
CLERK_PLATFORM_API_BASE | optional | Clerk Platform API base (default https://api.clerk.com/v1). |
PORT | optional | Local server port (default 3009; unused on Vercel). |
Wire it into any service
Because the keys are published as deployment outputs, any service in your design can readpublishableKey and secretKey — a Next.js frontend, an API, a background worker — without each one holding its own Clerk configuration.