Configuration reference
This reference covers server overrides and feature-specific settings. Start with Run locally for local services or service setup for hosting.
Application settings
Declare your application's backend settings in a root env.ts:
import { defineEnv } from "@kambium/kit/shared/env";
export const envVars = defineEnv({
REPORTING_TOKEN: {
label: "API token",
group: "Reporting",
setupUrl: "https://example.com/settings",
description: "Create a read-only token in your reporting provider and paste it here.",
secret: true,
required: true,
},
REPORTING_REGION: {
label: "Region",
group: "Reporting",
options: ["eu", "us"],
description: "Optional reporting region.",
secret: false,
},
});Optional label and group give Desktop friendly field names and connection sections. setupUrl adds an explicit link to the provider's HTTPS settings page. For OAuth, declare a relative callbackPath such as /api/connect-callback-airtable; Desktop combines it with the selected SERVE_BASE_URL. Keep the declaration aligned with the application's actual OAuth route. Links and callback paths contain metadata, never credentials.
Use format: "url" for HTTP/HTTPS URLs or format: "email" for email addresses. Alternatively, options: ["eu", "us"] restricts a value to those strings; set secret: false to display a dropdown. Kambium Kit builds Zod validators from this static metadata and checks entered values before saving, when reading declared settings for deployment, and in read. Errors identify fields without showing rejected values. Arbitrary Zod schemas, transforms and refinements are not part of Desktop's static inspection protocol.
At backend startup, resolve the declarations against the environment your host already loaded, then pass the values into your engine or service:
const env = envVars.read(process.env);
// Supply env.REPORTING_TOKEN to your engine's configuration.read returns only declared values. Missing or blank required values throw an error listing their names, without printing values. Required entries are typed as strings; optional entries are string | undefined. required defaults to false and secret defaults to true. Descriptions are optional. Keep actual credentials in Fly secrets for Fly-hosted apps. Keep credentials out of declarations, examples and source-controlled defaults. Built-in infrastructure settings retain their existing configuration groups; env.ts extends them with application-owned backend settings.
In Fly-based apps, a declaration with secret: false can go in the Fly TOML [env] table when its value is safe to commit. Set declared values in Desktop under Cloud → Configuration. See Configuration for service setup.
Fly deployment checks required settings against TOML and Fly secret names. secret: false changes input masking. Frontend builds get only their allowlisted public inputs. Keep operator credentials such as NPM_TOKEN and FLY_API_TOKEN out of backend runtime settings.
Inspection needs no running backend or credentials:
kambium config inspect --jsonThe CLI parses the exported envVars = defineEnv({...}) declaration without executing imports or application code. Use static object literals with uppercase environment names and literal metadata properties and string arrays for options. as const, satisfies and an aliased named defineEnv import are supported; computed metadata, spreads and calls in properties fail inspection. The report contains metadata, source locations and a fingerprint, with no environment values.
Literal process.env.NAME and process.env["NAME"] references in application JS/TS are also discovered during inspection. Declare those names in env.ts to configure them for deployment through Desktop. Scanning skips dependencies, hidden/generated directories, tests, scripts, dashboard/frontend folders and configuration/declaration files. Declare dynamic keys and settings read by installed packages explicitly. If inspection fails, run kambium config inspect --json to identify the error.
New applications declare the Example Slack bot's optional app credentials and optional AI provider keys. Native Local mode uses local services and simulators. Other applications should resolve only the settings their execution mode needs.
Provider registration
Add providerSetup to the OAuth client ID declaration to show exact permissions beside that connection's fields. Keep callbackPath there too, and use those same properties in the backend OAuth binding. For an Airtable engine that reads schema and records, the declaration could include:
AIRTABLE_CLIENT_ID: {
label: "Client ID",
group: "Airtable · Internal",
secret: false,
callbackPath: "/api/connect-callback-airtable",
providerSetup: {
provider: "airtable",
scopes: ["schema.bases:read", "data.records:read"],
},
},In the engine's existing OAuth configuration, use scopes: [...envVars.definitions.AIRTABLE_CLIENT_ID.providerSetup.scopes] and redirectUri: new URL(envVars.definitions.AIRTABLE_CLIENT_ID.callbackPath, frontendUrl).href, where frontendUrl is the selected SERVE_BASE_URL. Bind client ID and secret to the corresponding envVars.read(process.env) values. Choose permissions according to the engine's actual operations; Desktop does not infer them from handlers.
For Slack, the generated declaration also supplies appName, events and an explicit interactivity boolean. The generated engine consumes its declared scopes and callback directly. Desktop's Slack manifest uses these declarations and the configured frontend/backend URLs. Token rotation and Socket Mode are disabled to match the Kit's HTTP integration.
After creating the app, save its credentials and deploy the backend, then verify the request URL in Slack's App Manifest settings. Connect the workspace from the application dashboard. Changing scopes later requires updating the provider app and, for Slack, reinstalling it. The Kit's default backend verifies one Slack app's signing secret; share that app across engine instances on the same backend.
Provider metadata must be literal and is validated without executing application code. This prevents Desktop inspection from requiring a running backend; it does not verify arbitrary custom engine bindings. Keep the metadata references in the real OAuth configuration when adapting the generated code.
Server settings
| Variable | Purpose |
|---|---|
HOST | Listen address. Use 0.0.0.0 for container ingress or 127.0.0.1 behind a local proxy. |
PORT | Listen port, default 3000; match the hosting service's port. |
NODE_ENV | Set by your app's scripts: production for startup, development for dev. |
ACTIVE_CREDENTIAL_KEY_VERSION | Optional app-defined input for config.credentials.activeKeyVersion; the default is v1. |
CREDENTIAL_ENCRYPTION_KEY_V2_B64 | Optional app-defined input for config.credentials.keys.v2. |
Retain the keys needed to decrypt existing credentials when changing the active version. The Redis cache key and credential encryption keys serve different data.
See encryption key generation for the required format.
npm scripts
Use npm run dev:local for local services. The generated app also provides:
| Command | Behavior |
|---|---|
npm start | Run the local CLI in production mode with the supplied process environment. |
npm run dev | Start the development server with the supplied process environment. |
npm run build | Run build.mjs, using core's buildServer() without runtime secrets. |
Fly supplies hosted secrets to the generated Docker image at runtime. To use hosted services from a local terminal, supply the development credentials in that terminal's environment.
Runtime wiring
config.localWebhooks: true starts a webhook-only ngrok tunnel in development mode when webhook routes are registered. The updated CLI template enables this for both npm run dev:local and npm run dev; production leaves it disabled. The tunnel setting does not select the database, email delivery or Auth hook configuration. Those still come from the selected command's environment.
Update an existing app's tunnel default
In index.ts, add or replace this entry in createServer.config once:
localWebhooks: process.env.NODE_ENV === "development",Subsequent switches between local and hosted development need no code changes.
The normal public API resolver remains unchanged. Production and test modes reject this option. See local webhook setup.
The app reads environment variables in index.ts and passes them to createServer. These are the default mappings:
| Input | Core configuration |
|---|---|
API_BASE_URL | config.publicApi.baseUrl |
SERVE_BASE_URL | config.frontendBaseUrl, approved frontend redirects and invitation links |
SUPABASE_URL | config.supabase.url |
SUPABASE_SECRET_KEY | config.supabase.apiKey |
SUPABASE_PUBLISHABLE_KEY | config.supabase.publishableKey |
REDIS_URL | config.redis.url |
REDIS_CACHE_ENCRYPTION_KEY_B64 | config.redis.cacheEncryptionKey |
CREDENTIAL_ENCRYPTION_KEY_B64 | config.credentials.keys.v1 |
POSTMARK_SERVER_TOKEN | config.postmark.serverToken |
POSTMARK_FROM_EMAIL | config.postmark.fromEmail |
SUPABASE_AUTH_EMAIL_HOOK_SECRET | config.supabase.authHookSecret |
Missing configured settings are reported together at startup, before services or jobs start. Keep app configuration and backend engine registration in index.ts.
Jobs default to enabled in production and disabled in development/tests; config.jobsEnabled overrides this. With jobs enabled, core registers task recovery and payload cleanup. Airtable OAuth and managed-webhook declarations also enable the corresponding refresh jobs; managed webhooks enable daily notification repair and payload catch-up. Repair does not move an existing webhook to a different URL. See local restarts.
Set config.startupTaskRecovery: false if the host owns startup recovery. See Task execution for which startup and periodic actions each setting controls.
Supabase authentication is the default. First-engine and broken-task notification emails stay disabled until their presentation settings are supplied. The generated app sets config.productName to its name for email branding; config.branding allows further customization. Workspace links default to the frontend URL. Multi-product hosts can use config.getFrontendBaseUrl(product) and config.runtime.getWorkspaceInvitationBaseUrl for their link destinations.
Sources: server configuration, runtime services, credential encryption.
Provider connections
Add the inputs required by the installed engine's connection declarations:
| Connection | Inputs |
|---|---|
| Airtable OAuth | App client ID, client secret and redirect URI. |
| Slack OAuth | App client ID, client secret and redirect URI. Slack ingress also needs the signing secret. |
| External Postgres | Connection credentials entered through the engine's storage setup. |
| LLM features | Credentials for the configured LLM provider. |
Supply OAuth app credentials to the engine factory's connection configuration; the engine declares its scopes. Match the provider's registered redirect URI to the deployed app. Connected-account tokens are stored through the normal authorization flow, encrypted with the credential key.
Engines with empty connection maps need no provider OAuth credentials. Airtable, Slack, LLM and external-storage credentials are only needed by engines that use them; environment-variable names belong in that engine's setup guide.
Local Airtable OAuth
If an engine needs Airtable, follow Add an Airtable connection. Scopes belong to the backend engine declaration; app credentials come from the host. The public runtime contains no OAuth secrets.
Email
In local mode, Core sends application emails to the Mailpit inbox and uses the app's existing sender and templates. Set mailpit: false in createServer config to skip local application emails. See local email behavior.
The setup guide uses Postmark for app emails, including the Supabase Auth email hook. Configure Postmark sender verification, the hook endpoint and its signing secret before testing signup. The same Postmark token supports application emails such as workspace invitations.
Keep Supabase's Email Provider enabled when using the hook. The HTTP hook must verify signatures with SUPABASE_AUTH_EMAIL_HOOK_SECRET before processing email requests. See Supabase Send Email Hook.
Supabase Auth can instead deliver login emails through custom SMTP. Configure its SMTP credentials in Supabase. That replaces the Auth hook; application email still needs its own delivery configuration. See Supabase SMTP setup.
Sources: email configuration and email templates.
Dashboard inputs
The generated dashboard reads these public build inputs from dashboard/.env.local or the build environment:
| Dashboard variable | Value |
|---|---|
VITE_API_BASE_URL | The backend's API_BASE_URL. |
VITE_SUPABASE_URL | The backend's SUPABASE_URL. |
VITE_SUPABASE_PUBLISHABLE_KEY | The backend's SUPABASE_PUBLISHABLE_KEY. |
SERVE_BASE_URL points the backend to the dashboard's deployed origin. Local startup supplies the public build inputs automatically. The combined Fly deployment reads the public settings from the selected Fly TOML file. For a separately hosted dashboard, supply the inputs before running npm run build:dashboard. Rebuild after changing them. Backend secret keys, Redis credentials, email tokens and encryption keys stay on the server.
Database access and recovery
Browser-accessible data uses database grants and row-level security (RLS). Backend secret keys bypass RLS, so custom server routes must enforce authorization before using the privileged client. See Supabase data security.
Apply migrations in one deployment job before starting code that needs them. See updates and rollback for recording applied migrations and deciding whether an older build can run against them.
Persisted tasks and engine records are in Supabase. With jobs enabled, core periodically retries pending and stale processing tasks. If your engine stores its own data in Redis, check its recovery requirements before replacing or flushing Redis.
Sentry error reporting
Generated apps enable core’s Sentry reporting when SENTRY_DSN is configured for hosted execution. SENTRY_ENVIRONMENT and SENTRY_RELEASE are optional deployment labels. Local runs and tests do not send events by default. Apps can pass sentry: false to createServer and keep a custom hooks.reportError callback. See core reporting for the contract.
For reporting setup, monitoring credentials and Desktop's Cloud → Sentry page, see Sentry. Its monitoring connection is separate from the server's reporting DSN.