Environment variables
Every environment variable a self-hosted dCal reads, grouped by area, with its default and what it does: database, booking pages on their own host, tracking tags, sign-in, calendar, email, HubSpot and
A self-hosted dCal is configured entirely through environment variables. Every one of them has a safe default, so a fresh clone with nothing set starts on the zero-setup path: SQLite, emails written to the log, and the open development sign-in. None of this applies to app.dcal.ai, where these choices are already made for you.
The API checks its settings when it starts. A bad value stops it with a message naming the variable, rather than letting it run half broken. The source of truth is packages/config/src/env.ts in the repository, with notes in .env.example and SELF-HOSTING.md.
⚠️ Note: Anything starting with
NEXT_PUBLIC_is baked into the web image when you build it. Changing one means rebuilding the web image, not restarting a container. Keep every secret out ofNEXT_PUBLIC_variables, because those reach the browser.
Unless a row says web, the variable is read by the API. Rows marked secret must come from your secret manager, never from a committed file.
Core
NODE_ENV
development
Set production for any real deployment. Production refuses the development sign-in.
DATABASE_URL
file:./.data/dev.db
A postgres:// address selects PostgreSQL; a file: address selects SQLite, for development only. Secret: it holds the database password.
API_PORT
4000
The port the API listens on.
PUBLIC_APP_URL
http://localhost:3000
Your public web address. dCal builds manage links, dashboard links in emails and the default allowed browser origin from it. Also read by the web app.
NEXT_PUBLIC_API_URL
http://localhost:4000
Web, build time. Where the browser reaches the API.
API_URL
the value of NEXT_PUBLIC_API_URL
Web. The API address the web server uses. Set it to a private or in-cluster address. INTERNAL_API_SECRET only takes effect when this is set: the web app sends the secret only to this address.
Booking pages and tracking tags
PUBLIC_BOOKING_URL
unset, so booking pages stay on PUBLIC_APP_URL
API and web, the same value on both. An origin of its own for booking pages, personal, team, one-off links and the guest's manage page, such as https://book.your-domain.example. That host sends the dashboard's pages to PUBLIC_APP_URL, and every link dCal writes names it. It also opens Google Tag Manager, Google Analytics 4 and HubSpot to every workspace, on that host only. Set it on the web app first, then on the API; to roll back, take it off the API first. A blank value counts as unset. See Self-hosting.
BOOKING_HOST_REDIRECTS
off
Web. off, temporary or permanent. With PUBLIC_BOOKING_URL set, temporary (307) or permanent (308) makes every other host answer a booking page's GET with a redirect to the same path and query on the booking host. Start with temporary.
EVENT_TRACKING_ACCOUNTS
unset, which means nobody
The workspaces whose booking pages may load Google Tag Manager, Google Analytics 4 and HubSpot while booking pages share the dashboard's address: account short codes or custom links, separated by commas, or * for every workspace. Not needed once PUBLIC_BOOKING_URL is set. Meta Pixel and PostHog need nothing here.
Sign-in
AUTH_PROVIDER
local
local is the open development sign-in; workos checks HS256 tokens from your identity service. Set the same value on the API and the web app.
JWT_SECRET
unset
Secret. The shared secret your identity service signs tokens with. Required when AUTH_PROVIDER=workos.
JWT_ISSUER
unset
Optional. When set, tokens must carry this issuer.
JWT_AUDIENCE
unset
Optional. When set, tokens must carry this audience.
WEB_SESSION_SECRET
unset
Web, secret. Signs the session cookie. Required for any provider other than local.
IAM_BASE_URL
unset
Web. The identity service the web app's sign-in redirects through when AUTH_PROVIDER=workos.
OPERATOR_EMAIL_DOMAIN
unset
API and web. Your own staff's email domain, such as @your-company.example, if you run dCal for other people's workspaces. Staff from it join a customer workspace as admin and see an account switcher at the top of the left menu, under the workspace switcher when they also belong to several workspaces. Leave unset otherwise.
DEV_LOGIN_EMAIL
unset
Development only. The person the local sign-in signs in as.
AUTH_LOCAL_STRICT
false
Development only. Gives the local sign-in a real signed-out state.
Calendar
CALENDAR_PROVIDER
disabled
disabled: no calendar sync, open times subtract only dCal's own bookings. external: talk to a calendar backend.
CALENDAR_API_BASE_URL
unset
The address of your calendar backend, for the built-in REST contract.
CALENDAR_API_TOKEN
unset
Secret. The Bearer token for that backend.
CALENDAR_BACKEND_FEATURES
unset
Features your generic calendar backend implements, separated by commas: recurrence and attendee-free-busy. Advertise only capabilities your adapter supports. Without them, recurring writes are refused and attendee calendars are unknown. See Repeating events and attendee checks.
CALENDAR_BACKEND_MODULE
unset
Absolute path to your own backend module, instead of the two above.
CALENDAR_HTTP_TIMEOUT_MS
30000
How long one calendar request may take.
CALENDAR_BUSY_REQUESTS_PER_SECOND
4
Busy-time requests one API process may start per second for one host. With several API copies, give each its share.
CALENDAR_BUSY_WINDOW_DAYS
14
The longest span of one busy-time request, 1 to 90 days. Raise it only if your backend answers with a free/busy query, which is complete for any span.
CALENDAR_CONFERENCING_LABEL
unset
The name of the meeting platform your backend creates links for, up to 60 characters. Hosts see it instead of "Online meeting".
CALENDAR_BUSY_CACHE_TTL_MS
30000
How long one read of a calendar's busy times is shared by every visitor of the pages that show times, 0 to 600000 ms. 0 turns the sharing off. Holds, bookings, moves and confirmations always read fresh.
CALENDAR_BUSY_CACHE_MAX_STALE_MS
300000
How old the last good read may be and still stand in when a fresh read fails, 0 to 3600000 ms. Older than this, no times are offered.
CALENDAR_BUSY_CACHE_MAX_ENTRIES
1000
How many reads one API process keeps, 1 to 100000. The least recently used go first.
CALENDAR_BUSY_READ_TIMEOUT_MS
10000
How long a page waits for a slow calendar before it uses the last good read or says the calendar cannot be read, 1000 to 120000 ms.
EMAIL_PROVIDER
log-only
log-only prints emails to the log, noop drops them, smtp and http send them.
MAIL_FROM_EMAIL
bookings@example.com
The sender address. Change it before you send anything real.
MAIL_FROM_NAME
Calendars
The sender name shown in the inbox.
MAIL_SUPPORT_EMAIL
unset
A support address printed in the email footer. Unset prints no support line. With the transactional-v1 profile, the email service adds its own support footer in each recipient's language, so dCal leaves out its own line.
SMTP_HOST
unset
Your SMTP server, for EMAIL_PROVIDER=smtp.
SMTP_PORT
587
The SMTP port.
SMTP_SECURE
false
Whether to connect with TLS from the start.
SMTP_USER
unset
The SMTP user name, if your server needs one.
SMTP_PASS
unset
Secret. The SMTP password.
EMAIL_HTTP_ENDPOINT
unset
The send address of your HTTP email service, for EMAIL_PROVIDER=http.
EMAIL_HTTP_PROFILE
generic
generic: a provider-agnostic JSON body. transactional-v1: a managed contract with signed requests.
EMAIL_HTTP_TOKEN
unset
Secret. The Bearer token for the generic profile.
EMAIL_HTTP_CLIENT_ID
unset
The client ID for the transactional-v1 profile.
EMAIL_HTTP_SIGNING_SECRET
unset
Secret, at least 32 characters. Signs transactional-v1 requests; it is never sent.
EMAIL_HTTP_CATEGORY
lifecycle
The message category for transactional-v1.
EMAIL_HTTP_API_KEY
unset
Secret. Deprecated fallback for transactional-v1; use the client ID and signing secret instead.
HubSpot and webhooks
CRM_PROVIDER
disabled
Set hubspot to offer the HubSpot integration in Settings > Integrations.
INTEGRATION_ENCRYPTION_KEY
unset
Secret. 32 random bytes in base64 (openssl rand -base64 32). Encrypts stored HubSpot tokens and webhook signing secrets. Without it, connecting HubSpot and creating a webhook are refused. Back it up: losing it means new tokens and new webhook secrets for everyone.
HUBSPOT_PRIVATE_APP_TOKEN
unset
Secret. One HubSpot token for the whole deployment, used only by workspaces that connected none of their own.
CRM_HTTP_TIMEOUT_MS
10000
How long one HubSpot request may take.
CRM_API_BASE_URL
HubSpot's public API address
Where HubSpot requests go. Change it only to route them through a proxy or a test stub.
Background deliveries
Webhooks, calendar writes, HubSpot writes and emails go through a durable queue that a background worker drains, so none of them can slow or fail a booking. Each kind drains on its own, the deliveries about one booking go out in order, and several API copies can share one queue without delivering anything twice.
OUTBOX_WORKER_ENABLED
true
Set false only if a separate process drains the queue. This also disables the repeating-event horizon extender; keep it enabled on a process that maintains series.
OUTBOX_POLL_MS
5000
How often the worker checks the queue, in milliseconds.
OUTBOX_MAX_ATTEMPTS
5
The fewest attempts a failing delivery gets before it can be given up.
OUTBOX_RETRY_HORIZON_MS
86400000 (24 hours)
How long a failing delivery keeps being retried, counted from its first failure, up to 30 days. It is given up only after both this and OUTBOX_MAX_ATTEMPTS. 0 gives up as soon as the attempts are spent. Product analytics events never wait for this.
OUTBOX_CONCURRENCY
4
Deliveries in flight at once per kind of work, per API process, 1 to 64. A slow webhook endpoint holds at most one of them.
OUTBOX_LEASE_MS
300000
How long a claimed delivery belongs to the API process that claimed it, 10000 to 3600000 ms. If that process stops, another one takes the delivery over after this. Keep it longer than your slowest delivery.
Traffic, proxies and browsers
CORS_ORIGINS
unset, which allows only PUBLIC_APP_URL
A comma-separated list of the websites allowed to call the API from a browser. When you set it, it replaces the default, so include your own web address in the list.
RATE_LIMIT_ENABLED
true
Throttles the public booking endpoints per visitor.
RATE_LIMIT_CAPACITY
60
The burst allowance per visitor.
RATE_LIMIT_REFILL_PER_SEC
1
How fast that allowance refills, per second.
RATE_LIMIT_TRUSTED_PROXY_HOPS
1
How many proxies sit in front of the API, 0 to 10: 1 for one load balancer, 2 for a CDN in front of it, 0 with no proxy. Set it on the web app too when you use INTERNAL_API_SECRET.
INTERNAL_API_SECRET
unset
API and web, secret, same value on both, at least 32 characters. Lets the booking pages pass each visitor's address to the API, so each visitor gets their own rate-limit allowance.
REQUEST_LOG_ENABLED
true
One log line per request: method, route, status, duration, request ID, error code and workspace. Never query strings, bodies, headers or client addresses.
MCP server
The MCP server lets AI assistants book on your copy. On app.dcal.ai, dCal's MCP server is at https://mcp.dcal.ai/mcp, and you connect by signing in or with an API key. See Connect an AI assistant (MCP).
MCP_ENABLED
true
false makes /mcp answer 404. When it is on, the tools for public booking pages answer anyone; the other tools answer API keys, and also sign-ins when sign-in for AI apps is on.
MCP_PUBLIC_URL
unset
API and web. The full address people paste into an assistant, path included, for example https://api.your-domain.example/mcp. Connect your agent shows it, and shows its steps only when it is set. With sign-in for AI apps on, it is also the address every access token is issued for.
API_PUBLIC_URL
unset, then MCP_PUBLIC_URL without its final /mcp
API and web. The API's public address. The API docs item in the left menu opens its /docs, and the agent skill on API keys is built with it. In production, with neither set, the menu has no API docs item and API keys says the skill is not available. On the API, /openapi.json and the introduction of the API reference at /docs name it as the base URL, and the introduction links the OpenAPI document with it. Not set on the API, both stay relative to wherever the API is served: the API does not fall back to MCP_PUBLIC_URL.
MCP_ALLOWED_ORIGINS
unset, which allows no browser origin
Comma-separated browser origins allowed to call /mcp. A request with any other Origin header is refused with 403; clients that send no Origin are not affected.
MCP_ALLOWED_HOSTS
unset, no check
Comma-separated host names /mcp answers to. Set it when the API is reachable under names you do not control.
MCP_RATE_LIMIT_CAPACITY
30
Burst of read tool calls per key, per sign-in, or per address with neither. A sign-in that reaches no workspace yet counts per address.
MCP_RATE_LIMIT_REFILL_PER_SEC
1
How fast that burst refills, per second.
MCP_WRITE_RATE_LIMIT_CAPACITY
10
Burst of calls to the tools that write (book, hold, move, confirm, decline, cancel) per key, per sign-in, or per address.
MCP_WRITE_RATE_LIMIT_REFILL_PER_SEC
0.2
How fast that burst refills, per second.
MCP_TOOL_TIMEOUT_MS
20000
How long one tool call may run before it is abandoned, 1000 to 120000 ms.
Sign-in for AI apps (OAuth)
Lets people connect apps such as Claude or ChatGPT to the MCP server by signing in, instead of pasting a key. It is off by default, and it works in one of two ways:
Through an authorization server you already run, the way app.dcal.ai works: set
OAUTH_ENABLED=true,MCP_PUBLIC_URLandOAUTH_AUTHORIZATION_SERVER. That server handles sign-in and consent; dCal only checks its tokens. See Self-hosting for what the server must support.With the built-in authorization server: set
OAUTH_ENABLED=true,MCP_PUBLIC_URL,OAUTH_ISSUERandOAUTH_SIGNING_JWK. dCal runs the sign-in itself, people approve each app on a consent page, and API keys lists the connected apps.
Either way, MCP_ENABLED must stay true. The API refuses to start when a value the chosen way needs is missing or malformed, and says which one.
OAUTH_ENABLED
false
Turns sign-in for AI apps on.
OAUTH_AUTHORIZATION_SERVER
unset
Your own authorization server only. Its issuer, as a bare origin: https://, no path and no trailing slash, written exactly as its tokens write it (http:// only on localhost outside production). Set, dCal runs no authorization server of its own, and OAUTH_ISSUER and OAUTH_SIGNING_JWK are not needed.
OAUTH_JWKS_URL
the jwks_uri in that server's /.well-known/oauth-authorization-server metadata
Your own authorization server only. Where it publishes its signing keys.
OAUTH_LINK_MAX_AGE_DAYS
30
Your own authorization server only, 1 to 365 days. How long after a person's last sign-in to the web app in a workspace a sign-in from an AI app may still act there. Past it, the sign-in no longer reaches that workspace until the person opens dCal on the web there again, and a sign-in that reaches no workspace gets NOT_LINKED from the tools; no reconnect is needed. Match your identity service's session lifetime.
OAUTH_ISSUER
unset
Built-in server only. Your public origin that serves /oauth/... and /.well-known/oauth-authorization-server, scheme and host only, https://. Never change it once apps are connected.
OAUTH_SIGNING_JWK
unset
Built-in server only. Secret. The private key that signs access tokens: one EC P-256 key as a JSON Web Key, with its private part. Every API copy uses the same one.
OAUTH_ACCESS_TOKEN_TTL_SECONDS
3600
Built-in server only. How long an access token lasts, 60 to 86400 seconds. A disconnected app keeps working until its last token runs out.
OAUTH_GRANT_TTL_DAYS
90
Built-in server only. How long a connection lasts before the person connects again, 1 to 365 days. Refreshing never extends it.
OAUTH_REFRESH_REUSE_GRACE_SECONDS
10
Built-in server only. A used refresh token presented again within this many seconds counts as a retry; later, it ends the whole connection. 0 to 60, 0 is strict.
OAUTH_CIMD_ENABLED
true
Built-in server only. Lets apps identify themselves with an https address dCal reads (a client metadata document).
OAUTH_DCR_ENABLED
true
Built-in server only. Lets apps register themselves at /oauth/register, limited to a fixed list of return addresses.
OAUTH_DCR_EXTRA_REDIRECT_URIS
unset
Built-in server only. Comma-separated exact return addresses to add to that list, for an app you trust that is not on it.
Product analytics
Off unless both a provider and its key are set. The API and the web app read the same names when they run, so no rebuild is needed. See Security and privacy for what is recorded.
PRODUCT_ANALYTICS_PROVIDER
unset
posthog is the one provider included. Any other value keeps analytics off.
PRODUCT_ANALYTICS_KEY
unset
The project's write-only key. A personal read key (phx_...) is refused.
PRODUCT_ANALYTICS_HOST
https://us.i.posthog.com
Where events are sent, for example your own proxy.
PRODUCT_ANALYTICS_INTERNAL_EMAILS
unset
Comma-separated parts of email addresses that mark your own staff, so their events can be left out of reports.
Search engines
NOINDEX
unset
Web, read when it runs. Set 1, true or yes on a staging or preview copy: every response then says noindex, nofollow and robots.txt closes the whole site. Unset, robots.txt lets search engines read your booking pages and keeps them out of /admin, /login, /onboarding, /api and /auth.
Premium extras
dCal itself is free. The premium switch exists so a deployment can put its own entitlements in front of the two extras: hiding the Dapta branding and the custom link.
PREMIUM_FEATURES
open
open unlocks both extras for everyone, which is what a self-hosted copy wants. locked checks each workspace against an entitlement service.
ENTITLEMENTS_API_URL
unset
The entitlement service. Only with PREMIUM_FEATURES=locked.
ENTITLEMENTS_API_KEY
unset
Secret. Its credential. Only with PREMIUM_FEATURES=locked.
Product name and branding
NEXT_PUBLIC_PRODUCT_NAME
Calendars
Web, build time. The product name shown in the dashboard and browser tabs. A copy with its own name gets a neutral letter mark next to that name instead of Dapta's logo.
PRODUCT_NAME
unset, then MAIL_FROM_NAME
The product name in the "Made with" line of guests' emails and in the title of the API reference at /docs and of openapi.json, which read <name> API.
NEXT_PUBLIC_PLATFORM_URL
unset
Web, build time. Adds a Dapta Agents item at the end of the left menu and the product switcher, both linking to this address in a new tab.
NEXT_PUBLIC_FORMS_URL
unset
Web, build time. Also shows the product switcher, and turns its Forms row into a link to this address. Unset, the row reads Coming soon.
NEXT_PUBLIC_SIGNUP_URL
unset
Web, build time. When set, public pages carry the "Made with" badge and a sign-up invitation linking here: your sign-up page, or your product site when its own call to action leads to sign-up. Unset shows neither.
SIGNUP_URL
the value of NEXT_PUBLIC_SIGNUP_URL
The same link for the footer of guests' emails, when the API needs a different value.
NEXT_PUBLIC_HIDE_BADGE
unset
Web, build time. Set 1, true or yes to hide the badge and the invitation even when a sign-up link is set.
HIDE_BADGE
the value of NEXT_PUBLIC_HIDE_BADGE
The same switch for guests' emails.
DOCS_URL
unset
Web, read on each request, so no rebuild is needed. Adds a Docs item to the left menu that opens this address in a new tab. Anything that is not an http or https address counts as unset, and unset shows no Docs item.
DOCS_URL_ES
the value of DOCS_URL
Web, read on each request. The Docs link for people whose dashboard is in Spanish.
DEVELOPER_DOCS_URL
unset
Where your developer guides live, such as https://docs.your-domain.example/developers. The introduction of the API reference at /docs, which also travels in openapi.json, ends with a "developer docs" link to it. Only an http or https address with no credentials, query or fragment is used; anything else counts as unset, and unset shows no guides link. On app.dcal.ai it points to these developer pages.
Operator integrations
These connect a deployment to its operator's own sign-up funnel. Leave them all unset on a self-hosted copy: with nothing set, nothing is asked and nothing is sent anywhere.
ONBOARDING_IAM_BASE_URL
unset
Turns on extra questions for new sign-ups, answered against an identity service. Unset skips them.
ONBOARDING_IAM_TOKEN
unset
Secret. Bearer token for that service.
ONBOARDING_PROBE_TIMEOUT_MS
1500
How long to wait for that service.
DAPTA_SYNC_URL
unset
Where new sign-ups are pushed as contacts, for the operator's own CRM. Unset sends nothing.
DAPTA_SYNC_TOKEN
unset
Secret. Bearer token for that address.
DAPTA_SYNC_TIMEOUT_MS
5000
How long to wait for that address.
Related
Self-hosting: requirements, database, quickstart and the options behind these settings.
Connect an AI assistant (MCP): what the MCP settings above switch on.
REST API: what the rate-limit settings above protect.
Last updated