Skip to Content
TimeWren Docs
Configuration

Environment variables

Complete reference of every TimeWren environment variable: defaults, which ones are required, which are baked in at build time, and what each one does.

TimeWren is configured entirely through environment variables. This page lists every variable the code reads, grouped by purpose. Most self-hosted instances only need the minimum configuration and, later, mail and storage.

How variables are set

With the Docker Compose setup, put variables in a .env file next to docker-compose.yml. The app service loads that file (env_file: .env), and a few values are also passed explicitly by docker-compose.yml. After editing .env, run docker compose up -d to apply runtime variables. Compose recreates the containers whose configuration changed.

An empty value counts as "not set". NEXT_PUBLIC_APP_URL= falls back to its default, and a variable with an empty value behaves like one that is missing. Lines starting with # are comments, so .env.example ships with everything optional commented out.

Build time and runtime

Variables named NEXT_PUBLIC_* are inlined into the browser bundle when the image is built. Changing them in .env afterwards has no effect on the prebuilt image. Three exceptions are read at runtime, with the build value only as a fallback: NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_MARKETING_URL and NEXT_PUBLIC_BRAND. The server reads them from its environment, and the browser gets them from /runtime-config.js, which the server generates per request. Marketing pages exist only in a build made with BUILD_PROFILE=full. The prebuilt image and the compose example use selfhost, which has none, so NEXT_PUBLIC_MARKETING_URL has no marketing pages to enable there.

Instance pages such as cookies, contact and account deletion use the running app URL and brand. Set NEXT_PUBLIC_MARKETING_URL explicitly to enable marketing on a self-hosted domain. Shared navigation and site metadata use the running marketing URL and brand. Editorial metadata and page copy describe TimeTrack Cloud, including its pricing and publisher. The public Cloud data processing agreement PDF is only available on TimeTrack Cloud.

The prebuilt image ghcr.io/timewren/timewren therefore has the other build-time variables fixed (for example NEXT_PUBLIC_REALTIME_ENABLED, NEXT_PUBLIC_PLAUSIBLE_SCRIPT_URL and the Sentry browser settings). To change those, build your own image with the matching build arguments, see Install from source. The Build time column below says which variables this applies to.

The Content-Security-Policy headers are generated in next.config.ts from NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_MARKETING_URL, NEXT_PUBLIC_PLAUSIBLE_SCRIPT_URL, NEXT_PUBLIC_UMAMI_COLLECT_URL and NEXT_PUBLIC_UMAMI_SCRIPT_URL, so they use the values present at build time.

Note: Billing variables (ALUNTA_API_KEY, STRIPE_SECRET_KEY, STORE_BILLING_ENABLED and everything that goes with them) are inert for self-hosting. Billing is switched on only when at least one of those three is set. Without them every feature is open: there are no user or client limits, no trial that expires, no upgrade buttons and no payment mails.

Minimum configuration

These five lines are enough to start an instance. Generate each secret with openssl rand -hex 32.

POSTGRES_PASSWORD=replace-with-a-random-secret
BETTER_AUTH_SECRET=replace-with-a-random-secret
ENCRYPTION_KEY=replace-with-64-hex-characters
CRON_SECRET=replace-with-a-random-secret
NEXT_PUBLIC_APP_URL=https://timewren.example.com

Without a mail transport, sign-up needs REQUIRE_EMAIL_VERIFICATION=false (see Required). Configure email as soon as you can.

Required

Compose refuses to start when POSTGRES_PASSWORD, BETTER_AUTH_SECRET, ENCRYPTION_KEY or CRON_SECRET is missing.

VariableDefaultRequiredBuild timeDescription
POSTGRES_PASSWORDnoneyesnoPassword of the bundled PostgreSQL. Compose builds DATABASE_URL from it. It is only used when the database is first created: changing it later does not change the existing database.
BETTER_AUTH_SECRETnoneyesnoSecret that signs sessions. Changing it logs everybody out. The container refuses to start without it.
ENCRYPTION_KEYnoneyesnoAES-256-GCM key for stored tokens and credentials (calendar, accounting, webhooks). Exactly 64 hex characters. If you lose it, those integrations must be reconnected, so back it up.
CRON_SECRETnoneyesnoShared secret between the cron service and the app. Also needed for /api/health?detail=1.
DATABASE_URLset by ComposeconditionalnoPostgreSQL connection string. Compose sets it to the bundled db service, so you do not set it yourself. Only needed with a different database or when running without Compose, for example postgresql://user:password@host:5432/timetrack.
NEXT_PUBLIC_APP_URLhttp://localhost:3000yesnoThe URL users open, without a trailing slash. Must match what the browser sees: use your https:// domain behind a reverse proxy. See URLs, hosts and brand.
REQUIRE_EMAIL_VERIFICATIONtruenonoSet to false (or 0) to let people sign up and log in without a mail server. Only honoured while no mail transport is configured: with RESEND_API_KEY or SMTP_HOST set, the flag is ignored with a warning. Anyone who can reach the instance can then create an account, so remove it once mail works.
ADMIN_EMAILnonenonoInstance admin addresses, comma separated. The account with a matching, verified address becomes admin. Empty: the oldest account becomes admin, but only while the instance has no admin.

URLs, hosts and brand

VariableDefaultRequiredBuild timeDescription
NEXT_PUBLIC_APP_URLhttp://localhost:3000yesnoPublic URL of the app. Read at runtime; the build value is the fallback. Used for links in mails, OAuth callbacks and the default redirect URIs of the integrations.
NEXT_PUBLIC_MARKETING_URLthe app URLnonoSeparate public or marketing host. Without an explicit marketing URL, self-hosted instances of either brand redirect / to the dashboard and return 404 for other marketing paths. If the runtime app URL or brand changes, set the marketing URL again to opt in. Read at runtime. Needs an image built with BUILD_PROFILE=full; the prebuilt image has no marketing pages.
NEXT_PUBLIC_BRANDtimewrennonotimewren (self-hosting) or timetrack (the Danish hosted sibling, TimeTrack Cloud). Any other value, or none, gives TimeWren. Read at runtime.
SUPPORT_EMAILsupport@<EMAIL_DOMAIN>nonoSupport address shown in mails and the UI.
NEXT_PUBLIC_SUPPORT_EMAILnonenoyesOlder alias of SUPPORT_EMAIL. SUPPORT_EMAIL wins when both are set.
CONTACT_EMAILsupport@<EMAIL_DOMAIN>nonoPersonal contact address on marketing pages and in personal mails. Default: the support address (SUPPORT_EMAIL).
EMAIL_DOMAINhost of the marketing URL, else of the app URLnonoDomain for generated mail addresses such as noreply@ and the task+id@ addresses.
TRUSTED_ORIGINSnonenonoExtra origins accepted by the auth and CSRF checks, comma separated. Invalid entries are skipped.
CORS_ALLOWED_ORIGINSbrowser-extension originsnonoReplaces the CORS allowlist of the tRPC API. Exact origins, comma separated, without trailing slashes or wildcards. Unset accepts browser-extension origins. Empty disables cross-origin access. It does not replace token authentication.
APP_SCHEMEStimetrack://,timetrack.preview://nonoNative app schemes accepted by auth, comma separated. Set it to the scheme of a custom app build, for example timewren://. Empty disables native origins.
DEVICE_CALLBACK_URLtimewren://auth/callback (TimeWren) / timetrack://auth/callbacknonoCallback of the device login. Must be a native scheme with exactly auth/callback; web URLs, credentials, query and fragment are rejected. Match it to APP_SCHEMES. Without a value the instance brand decides (timewren://auth/callback for TimeWren, else timetrack://auth/callback); a client's redirect_uri is honoured only if it is on the APP_SCHEMES allowlist, one of the default callbacks (timetrack://, timewren://) or this value. Older clients that send no redirect_uri to a default self-host instance (brand TimeWren) get timewren://; set DEVICE_CALLBACK_URL=timetrack://auth/callback for them.
CALLBACK_BASE_URLthe app URLnonoBase for stored and registered callback links, for example webhook callbacks.
AUTH_COOKIE_DOMAINnonenonoShares the session cookie across hosts, for example .example.com. Only needed with a split app and marketing host.
AUTH_RP_IDmarketing host when the hosts are split, else the app hostnonoPasskey relying-party ID, for example example.com. Only needed with a split app and marketing host.
AUTH_COOKIE_PREFIXbetter-authnonoPrefix of the auth cookie names.
SUBDOMAIN_REDIRECT_STATUS308nonoHTTP status of redirects between the app and marketing hosts. Set 307 while you test a host split, because browsers cache 308.
APP_PORT3000nonoCompose only: host port of the app.
APP_BIND127.0.0.1nonoCompose only: bind address of the app port. 0.0.0.0 exposes it on all interfaces. Keep the default behind a reverse proxy, see Reverse proxy.
CADDY_DOMAINnonenonoCompose only: domain for the optional automatic HTTPS overlay (docker-compose.caddy.yml). DNS must point at the server and TCP 80/443 must be open.
COMPOSE_FILEdocker-compose.ymlnonoCompose only: set to docker-compose.yml:docker-compose.caddy.yml to turn on the automatic HTTPS overlay together with CADDY_DOMAIN.
NEXT_PUBLIC_GOOGLE_ADS_IDnonenoyesGoogle Ads tag ID for the marketing pages. Without it nothing is loaded on self-hosted instances.

Mail

Pick one transport: SMTP or Resend. Without either, the server logs skipped sends. Details and examples are in Email.

The transport is chosen in this order: MAIL_TRANSPORT if set to a valid value, otherwise Resend when RESEND_API_KEY is set, otherwise SMTP when SMTP_HOST is set, otherwise log only.

VariableDefaultRequiredBuild timeDescription
MAIL_TRANSPORTautomaticnonoresend, smtp or log. Forces the transport. smtp requires SMTP_HOST.
SMTP_HOSTnoneconditionalnoSMTP server. Setting it selects SMTP unless RESEND_API_KEY is set or MAIL_TRANSPORT says otherwise.
SMTP_PORT587nonoSMTP port. Port 465 uses implicit TLS.
SMTP_SECUREtrue on port 465, else falsenonotrue for implicit TLS, false for STARTTLS. Empty uses the port rule.
SMTP_USERnonenonoSMTP username. Authentication is only used when this is set.
SMTP_PASSWORDnonenonoSMTP password.
SMTP_FROMthe sender chosen by the appnonoSender address for all SMTP mails, for example TimeWren <mail@timewren.example.com>. Recommended with SMTP.
RESEND_API_KEYnoneconditionalnoAPI key for Resend. Setting it selects Resend.
RESEND_FROM_EMAILTimeWren <noreply@<EMAIL_DOMAIN>>nonoDefault sender when sending through Resend. Use an address on a domain verified in Resend.
FROM_EMAILTimeWren <noreply@<EMAIL_DOMAIN>>nonoSender of the task and notification mails.
PERSONAL_FROM_EMAILthe default sendernonoSender of personal lifecycle mails.
PERSONAL_REPLY_TO_EMAILnonenonoReply-To of personal lifecycle mails. Empty means no Reply-To header.
RESEND_WEBHOOK_SECRETnonenonoSvix signing secret for Resend delivery webhooks (/api/webhooks/resend).
RESEND_AUDIENCE_IDnonenonoResend audience used for newsletter signups.
ADMIN_NOTIFICATION_EMAILnonenonoReceives admin alerts and digests, comma separated. An address saved in the admin settings takes precedence.
ADMIN_DISCORD_WEBHOOK_URLnonenonoDiscord webhook for admin alerts and in-app feedback. Must be https://discord.com/api/webhooks/<id>/<token> (or the same on discordapp.com); other hosts are rejected. A URL saved in the admin settings takes precedence.
FEEDBACK_TO_EMAILnonenonoReceives in-app feedback by mail. Empty: feedback goes to the Discord webhook only.

File storage

Uploads, email attachments and data exports need storage. Compose sets the local driver and mounts the storage volume. For S3-compatible storage (AWS, Hetzner, MinIO, R2) see Storage.

The driver is chosen like this: STORAGE_DRIVER=local wins; otherwise S3 is used when S3_ENDPOINT is set; otherwise there is no storage and uploads are switched off. The code never reads the value s3 of STORAGE_DRIVER, so setting S3_ENDPOINT is what selects S3.

VariableDefaultRequiredBuild timeDescription
STORAGE_DRIVERlocal in Compose, otherwise nonenonolocal stores files on disk. Anything else falls through to the S3_ENDPOINT rule.
STORAGE_LOCAL_PATH./data/storage (Compose: /app/data/storage)nonoDirectory of the local driver. Compose sets it to the storage volume; change it only outside Compose.
S3_ENDPOINTnoneconditionalnoEndpoint of the S3-compatible service. Setting it selects S3 (path-style addressing is always used).
S3_REGIONfsn1nonoRegion sent to the S3 client. Most S3-compatible services accept any value, but set the real one for AWS.
S3_ACCESS_KEY_IDemptyconditionalnoS3 access key.
S3_SECRET_ACCESS_KEYemptyconditionalnoS3 secret key.
S3_BUCKETtimetracknonoBucket name.
S3_PREFIXemptynonoOptional namespace for all keys inside the bucket.
EMAIL_ATTACHMENT_DIRstorage/email-attachmentsnonoDirectory that older email attachments are read from on disk.
EMAIL_SYNC_STORE_ATTACHMENTSfalsenonotrue uploads attachments from email-to-task sync to the configured storage.

Authentication and login providers

Email and password, magic links and passkeys work without any of these. Each social provider needs your own OAuth app, with the callback URL {NEXT_PUBLIC_APP_URL}/api/auth/callback/<provider>. A provider is enabled when both its ID and secret are set. See Authentication.

VariableDefaultRequiredBuild timeDescription
GOOGLE_CLIENT_IDnonenonoGoogle sign-in. Also used by the Google Calendar integration.
GOOGLE_CLIENT_SECRETnonenonoSecret for the Google OAuth app.
GITHUB_CLIENT_IDnonenonoGitHub sign-in.
GITHUB_CLIENT_SECRETnonenonoSecret for the GitHub OAuth app.
DISCORD_CLIENT_IDnonenonoDiscord sign-in.
DISCORD_CLIENT_SECRETnonenonoSecret for the Discord OAuth app.
MICROSOFT_CLIENT_IDnonenonoMicrosoft Entra ID (Azure AD) sign-in, for example company SSO. Callback: {NEXT_PUBLIC_APP_URL}/api/auth/callback/microsoft-entra-id.
MICROSOFT_CLIENT_SECRETnonenonoSecret for the Entra ID app.
MICROSOFT_TENANT_IDcommonnonocommon, organizations or a tenant GUID.
APPLE_CLIENT_IDnonenonoSign in with Apple: the Services ID, used for web login.
APPLE_TEAM_IDnonenonoApple developer team ID.
APPLE_KEY_IDnonenonoID of the Sign in with Apple key.
APPLE_PRIVATE_KEYnonenonoContents of the .p8 key. The client secret is generated from it at startup.
APPLE_APP_BUNDLE_IDENTIFIERdk.timetrack.appnonoiOS bundle ID, used for native login and for revoking the token when an account is deleted. Set your own if you build the mobile app yourself.
SESSION_EXPIRY_DAYS7nonoSession lifetime in days.
BETTER_AUTH_SECRETSnonenonoVersioned secrets for rotating BETTER_AUTH_SECRET without losing encrypted tokens.

Integrations

Billy needs nothing here: each user pastes their own Billy API key in the app. See Billy, Dinero, e-conomic, Calendar and CVR.

VariableDefaultRequiredBuild timeDescription
GOOGLE_REDIRECT_URI{NEXT_PUBLIC_APP_URL}/api/integrations/google/callbacknonoOAuth redirect URI of the Google Calendar integration. Uses GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.
OUTLOOK_CALENDAR_CLIENT_IDnonenonoClient ID of a Microsoft Entra ID app registration for the Outlook calendar integration (Microsoft Graph, read only). With its secret, the Outlook calendar is offered under Settings, Integrations; without it, Outlook is hidden. The sign-in app (MICROSOFT_CLIENT_ID) is never used for it.
OUTLOOK_CALENDAR_CLIENT_SECRETnonenonoClient secret of the Outlook calendar app.
OUTLOOK_CALENDAR_TENANT_IDcommonnonoMicrosoft tenant for the Outlook calendar: common, organizations, consumers or a tenant GUID.
OUTLOOK_CALENDAR_REDIRECT_URI{NEXT_PUBLIC_APP_URL}/api/integrations/outlook/callbacknonoOAuth redirect URI of the Outlook calendar integration.
DINERO_CLIENT_IDnoneconditionalnoVisma Connect OAuth app for Dinero. Both ID and secret are needed to enable the integration.
DINERO_CLIENT_SECRETnoneconditionalnoSecret of the Visma Connect app.
DINERO_REDIRECT_URI{NEXT_PUBLIC_APP_URL}/api/integrations/dinero/callbacknonoOAuth redirect URI for Dinero.
DINERO_WEBHOOK_SECRETnonenonoSecret used to verify Dinero webhooks.
BILLY_WEBHOOK_SECRETnonenonoSecret used to verify Billy webhooks.
ECONOMIC_APP_PUBLIC_TOKENnoneconditionalnoPublic token of your app registered at the e-conomic developer portal. Both tokens are needed to enable the integration.
ECONOMIC_APP_SECRET_TOKENnoneconditionalnoSecret token of the e-conomic app.
ECONOMIC_REDIRECT_URI{NEXT_PUBLIC_APP_URL}/api/integrations/economic/callbacknonoRedirect URI for e-conomic.
CVR_SERVICE_API_KEYnonenonoKey for the CVR lookup service. Empty: lookups fall back to the free cvrapi.dk.
CVR_SERVICE_URLthe maintainer's CVR servicenonoBase URL of the CVR lookup service used together with CVR_SERVICE_API_KEY.
CVR_API_TIMEOUT_MS10000nonoTimeout of CVR lookups in milliseconds.
GITHUB_TOKENnonenonoGitHub token for desktop-update lookups, giving a higher rate limit.
NEXT_PUBLIC_DESKTOP_RELEASES_REPOmahope/timetrack-releases (TimeTrack)noyesGitHub owner/repo for desktop downloads. Defaults to mahope/timetrack-releases in TimeTrack builds and is otherwise disabled unless set. A runtime brand change keeps the build’s download repository.
DESKTOP_UPDATER_REPOnonenonoGitHub owner/repo for legacy desktop updates. Disabled unless set.
CHANGELOG_REPOnonenonoGitHub owner/repo the changelog is read from. Disabled unless set.

AI, SMS, push and email-to-task

VariableDefaultRequiredBuild timeDescription
OPENAI_API_KEYnonenonoEnables AI suggestions and categorisation.
AI_PROVIDERopenainonoThe server's own AI provider: openai, anthropic, mistral or openai-compatible (Ollama, vLLM, LM Studio). See AI.
AI_BASE_URLnonenonoURL of the server's model, for example http://ollama:11434/v1. Required for openai-compatible.
AI_MODELper provider (gpt-4o-mini for OpenAI)nonoModel name of the server's AI, for example qwen2.5:3b.
AI_API_KEYOPENAI_API_KEY for OpenAInonoKey for the server's AI provider. Not needed for a local server.
AI_SYSTEM_FOR_ALLfalsenonoSet to true to let every AI feature use the server's AI, including those that otherwise need a personal or organisation key. Meant for self-hosted instances with a local model.
AI_SYSTEM_ONLYfalsenonoSet to true to use only the server's AI. Keys saved on organisations or by users are ignored, so no text reaches a cloud provider. Set by docker-compose.ollama.yml.
AI_ALLOW_PRIVATE_URLSfalsenonoSet to true to let users and organisations point AI at private or plain HTTP addresses, such as a local Ollama. Leave it off on a public multi-tenant instance.
AI_ENGINEai-sdknonoSet to openai-legacy to run OpenAI-compatible providers through the older openai client instead of the AI SDK. A kill switch while the new layer settles.
AI_CACHE_TTL_MS60000nonoLifetime of cached AI results in milliseconds.
AI_HIGH_CONFIDENCE_THRESHOLD0.8nonoConfidence from which an AI suggestion counts as high confidence.
MESSAGEBIRD_API_KEYnonenonoEnables SMS login via MessageBird.
MESSAGEBIRD_ORIGINATORthe brand short name (TimeWren)nonoSender name of SMS messages.
NEXT_PUBLIC_VAPID_PUBLIC_KEYnonenonoPublic VAPID key for Web Push. The server hands it to the browser, so it is read at runtime. Generate a key pair with npx web-push generate-vapid-keys.
VAPID_PRIVATE_KEYnonenonoPrivate VAPID key. Web Push is on when both keys are set.
VAPID_EMAILmailto:support@<EMAIL_DOMAIN>nonoContact sent with push messages, as a mailto: URL.
EXPO_ACCESS_TOKENnonenonoOptional Expo access token for push notifications to the mobile app.
INBOUND_EMAIL_DOMAINthe email domainnonoDomain of the email-to-task addresses.

Valkey and realtime

Valkey is optional. It gives rate limits shared between processes and realtime timer sync. Start it with docker compose --profile valkey up -d, or set COMPOSE_PROFILES=valkey in .env.

VariableDefaultRequiredBuild timeDescription
VALKEY_URLnonenonoConnection URL, for example redis://valkey:6379. Without it everything falls back to in-memory behaviour.
RATE_LIMIT_BACKENDin-memorynonovalkey stores rate limits in Valkey. Any other value keeps them in memory.
REALTIME_ENABLEDtrue in the Docker imagenonoServer flag for realtime timer events. Realtime also needs VALKEY_URL. Set false to switch it off without a rebuild.
NEXT_PUBLIC_REALTIME_ENABLEDnonenoyesClient flag, must be true at build time. Both this and REALTIME_ENABLED must be true. The prebuilt image does not set it.
BUILD_PROFILEfullnoyesBuild argument and variable for npm run build. selfhost leaves the Cloud marketing site and the TimeWren website out of the build (shorter build, smaller image); the prebuilt image uses it. full also builds the marketing pages that NEXT_PUBLIC_MARKETING_URL enables.
REACT_COMPILERannotationnoyesBuild argument and variable for npm run build. React Compiler mode: annotation compiles only components marked "use memo", infer compiles every component it can analyse, off turns it off. Any other value fails the build.
REACT_COMPILER_RUSTunsetnoyesBuild variable. 1 also uses Next.js' experimental Rust port of React Compiler. Ignored when REACT_COMPILER=off.
ELECTRIC_URLnonenonoExperimental ElectricSQL timer shape proxy. Inert unless both variables are set; the endpoints then answer 503 and clients fall back.
ELECTRIC_SECRETnonenonoSecret for the ElectricSQL proxy.

Telemetry and monitoring

Nothing is sent to the maintainers unless you set these. See also Troubleshooting.

VariableDefaultRequiredBuild timeDescription
NEXT_PUBLIC_PLAUSIBLE_SCRIPT_URLnonenoyesURL of a Plausible analytics script. Empty: no Plausible script is loaded. Also added to the CSP.
NEXT_PUBLIC_UMAMI_SCRIPT_URLnonenoyesURL of the Umami tracker script. Used when no collection URL is configured. Events go to the collector built into the tracker. A same-origin script that proxies Umami Cloud (for example /stats.js) sends through /api/send next to it instead of gateway.umami.is.
NEXT_PUBLIC_UMAMI_COLLECT_URLnonenoyesFull collection URL or same-origin path, including any custom path. With the website ID and analytics consent, sends tool events immediately with keepalive.
NEXT_PUBLIC_UMAMI_WEBSITE_IDnonenoyesWebsite ID for the Umami collector.
PLAUSIBLE_BASE_URLhttps://plausible.iononoPlausible host used by the admin analytics page.
PLAUSIBLE_SITE_IDnonenonoPlausible site ID for the admin analytics page.
PLAUSIBLE_API_KEYnonenonoPlausible API key. The admin analytics page needs this and PLAUSIBLE_SITE_ID (for both brands) or a brand's plausibleSiteId in BRANDS_CONFIG.
NEXT_PUBLIC_SENTRY_DSNnonenoyesSentry DSN for errors. Empty: Sentry reports nothing.
NEXT_PUBLIC_SENTRY_BROWSER_ENABLEDenablednoyesfalse disables Sentry in the browser.
NEXT_PUBLIC_SENTRY_ENVIRONMENTderived from the hostnoyesEnvironment name sent with browser errors.
SENTRY_AUTH_TOKENnonenonoSource map upload at build time, and API access for the Sentry issue lookup.
SENTRY_ACCESS_TOKENnonenonoToken for the Sentry issue lookup; takes precedence over SENTRY_AUTH_TOKEN.
SENTRY_API_URLhttps://sentry.iononoSentry API base URL, for self-hosted Sentry.
SENTRY_WEBHOOK_SECRETnonenonoSecret that verifies Sentry webhooks.
SENTRY_DISABLEDnonenoyes1 turns the Sentry build plugin off. The Dockerfile sets it during the image build.

Tuning

All optional. The defaults are the values used by TimeWren unless you change them.

VariableDefaultRequiredBuild timeDescription
DEFAULT_WEEKLY_HOUR_GOAL37nonoDefault weekly hour goal for new users.
PRODUCTIVITY_HEATMAP_DAYS90nonoNumber of days in the productivity heatmap.
PREPAID_LOW_BALANCE_THRESHOLD0.2nonoFraction of a prepaid hours package left that counts as low.
PREPAID_CRITICAL_BALANCE_HOURS1nonoHours left that count as critical, on top of the fraction rule.
PREPAID_EXPIRY_WARNING_DAYS30nonoHow many days before expiry a package triggers a warning.
MAX_MONETARY_AMOUNT100000000nonoUpper limit for a single monetary amount.
PDF_ENGINEreact-pdfnonoInvoice PDF renderer. takumi is an experimental alternative.
CHURN_PLAYBOOKS_DISABLEDnonenono1 switches the churn-playbook cron job off.
CRON_LOG_RETENTION_DAYS90nonoDays of cron run history kept in cron_job_logs. The daily webhook-cleanup job deletes older rows, and the admin cron overview looks no further back. Values below 62 days (twice the longest job interval) are raised to 62.
MIGRATE_ON_START1 in Composenono1 runs database migrations on every start. Without it migrations are skipped (outside Compose the default is off). See Upgrading.
MIGRATION_LOCK_TIMEOUT_MS300000nonoHow long a starting container waits for another one to finish migrating. Invalid values use the default.
SEED_DEMO_ORGSfalsenonotrue seeds a demo organisation on startup.
MIN_CLIENT_VERSIONSnonenonoMinimum client versions per client type, for example extension=2.5.2,mobile=1.0.0+5,desktop=0.2.21. Older clients can still read but timer and time writes are rejected. Empty: no enforcement.
MIN_CLIENT_VERSIONS_MODEenforcenonoobserve evaluates the minimums and shows outdated clients in the admin area without rejecting anything.
SYNTHETIC_USER_EMAILSnonenonoEmail addresses of monitoring or test accounts that are excluded from stats and mails, comma separated.
SYNTHETIC_USER_IDSnonenonoUser IDs of those accounts, comma separated.

Docker Compose and startup

Compose sets some of these itself; they are listed so you know where they come from.

VariableDefaultRequiredBuild timeDescription
TIMEWREN_VERSIONlatestnonoCompose only: image tag to run. Pin it, for example 1.2.3, to control upgrades.
COMPOSE_PROFILESnonenonoRead by Docker Compose, not by the app. Use valkey to start the optional Valkey service.
TZEurope/CopenhagennonoTimezone of the app and database containers. The cron container always runs in Europe/Copenhagen.
APP_URLhttp://app:3000yes (cron)noOnly read by the cron container: the internal URL it calls the /api/cron/* endpoints on. Compose sets it; do not confuse it with NEXT_PUBLIC_APP_URL.
NODE_ENVproduction in the imagenonoSet by the image and by npm run dev. Leave it alone when self-hosting.
NEXT_PHASEset by Next.jsnonoSet by Next.js (phase-production-build during next build). During the build the MCP OAuth resource is not written to the database. Never set it yourself.
NEXT_RUNTIMEset by Next.jsnonoSet by Next.js (nodejs or edge). Never set it yourself.
CInonenonoSilences build logs of the Sentry plugin when set. Set by CI systems.
CI_SKIP_TYPECHECKfalsenoyesBuild argument of the Dockerfile: true skips the type check during next build. Only for CI builds that type-check separately.
APP_VERSIONnonenonoVersion string of the deploy, read by the server at runtime and used to detect a new deploy in open tabs. The Dockerfile sets it from the APP_VERSION build argument; changing it needs no rebuild. Empty uses the Next.js build ID.
NEXT_PUBLIC_APP_VERSIONnonenonoOld name for APP_VERSION, still read as a fallback at runtime when APP_VERSION is empty.

Hosted service only

Warning: Not for self-hosting. These variables belong to the hosted TimeTrack Cloud and TimeWren Cloud deployments. Leave them unset on your own instance. The ALUNTA_*, STRIPE_*, STORE_BILLING_ENABLED and GOOGLE_PLAY_* variables are the billing variables described at the top of the page.

VariableDefaultRequiredBuild timeDescription
DEMO_MODEnonenono1 turns the instance into the public demo: one sandbox per visitor, no mail, payments or integrations, and accounts deleted after 24 hours. Only for demo.timewren.com; see docs/demo.md in the repository.
ALUNTA_API_KEYnonenonoTurns billing on and enables the Alunta payment provider.
ALUNTA_WEBHOOK_SECRETnonewith ALUNTA_API_KEYnoVerifies Alunta webhooks. Without it the webhook answers 503 and processes nothing.
ALUNTA_WEBHOOK_ALLOW_UNSIGNEDnonenono1 or true accepts Alunta webhooks without a signature when the secret is set. Development only; ignored when NODE_ENV=production.
ALUNTA_PLAN_MONTHLYemptynonoAlunta plan ID of the monthly plan.
ALUNTA_PLAN_YEARLYemptynonoAlunta plan ID of the yearly plan.
ALUNTA_PLAN_TEAM_MONTHLYemptynonoAlunta plan ID, Team, monthly.
ALUNTA_PLAN_TEAM_YEARLYemptynonoAlunta plan ID, Team, yearly.
ALUNTA_PLAN_BUSINESS_MONTHLYemptynonoAlunta plan ID, Business, monthly.
ALUNTA_PLAN_BUSINESS_YEARLYemptynonoAlunta plan ID, Business, yearly.
ALUNTA_PLAN_TEAM_SEATSemptynonoAlunta plan ID for extra Team seats.
ALUNTA_PLAN_BUSINESS_SEATSemptynonoAlunta plan ID for extra Business seats.
ALUNTA_PLAN_PRIVAT_MONTHLYemptynonoAlunta plan ID, Privat, monthly.
ALUNTA_PLAN_PRIVAT_YEARLYemptynonoAlunta plan ID, Privat, yearly.
ALUNTA_PLAN_FOUNDING_MONTHLYemptynonoAlunta plan ID, founding plan, monthly.
ALUNTA_PLAN_FOUNDING_YEARLYemptynonoAlunta plan ID, founding plan, yearly.
ALUNTA_PLAN_LEGACY_SOLOemptynonoAlunta plan IDs of the legacy solo plan.
ALUNTA_PLAN_LEGACY_TEAMemptynonoAlunta plan IDs of the legacy Team plan.
ALUNTA_PLAN_LEGACY_BUSINESSemptynonoAlunta plan IDs of the legacy Business plan.
ALUNTA_PLAN_LEGACY_TEAM_SEATSemptynonoAlunta plan ID for extra seats on the legacy Team plan.
ALUNTA_PLAN_LEGACY_BUSINESS_SEATSemptynonoAlunta plan ID for extra seats on the legacy Business plan.
STRIPE_SECRET_KEYnonenonoTurns billing on and enables Stripe.
STRIPE_WEBHOOK_SECRETnonenonoVerifies Stripe webhooks.
STRIPE_TAX_ENABLEDfalsenonotrue enables Stripe Tax.
STRIPE_DESKTOP_LIFETIME_PRICE_IDemptynonoStripe price ID of the desktop lifetime licence.
STRIPE_TIMEWREN_PORTAL_CONFIGURATIONemptynonoMultibrand Cloud only: Stripe billing portal configuration for TimeWren accounts. Empty: found or created by metadata brand=timewren.
STORE_BILLING_ENABLEDnonenono1 turns billing on for in-app purchases (App Store and Google Play).
GOOGLE_PLAY_SERVICE_ACCOUNT_JSONnonenonoService account for verifying Google Play purchases.
GOOGLE_PLAY_PACKAGE_NAMEnonenonoAndroid package name for Google Play.
GOOGLE_PLAY_WEBHOOK_TOKENnonenonoToken in the Google Play notification URL.
FREE_TRIAL_DAYS30nonoLength of the free trial. Only has an effect when billing is on.
DOKPLOY_API_URLnonenonoHosting API used to register customer domains.
DOKPLOY_API_TOKENnonenonoToken for that hosting API.
DOKPLOY_APP_IDnonenonoApplication ID in that hosting API. All three DOKPLOY_* variables are needed.
CLAUDE_AGENT_API_KEYnonenonoKey used by the Sentry webhook to trigger an automated fix agent.
CLAUDE_AGENT_TRIGGER_URLnonenonoTrigger URL for that agent.
UNBLOCK_PLAN_EMAILnonenonoOne-off plan grant applied during the migration step at release.
UNBLOCK_PLAN_TIERteamnonoPlan tier for that grant.
UNBLOCK_PLAN_SEATSnonenonoSeat count for that grant.
SHARED_PROD_DBnonenono1 when the database is shared with an older version; disables features that older version cannot handle.
MULTIBRAND_ENABLEDnonenono1 enables the multi-brand host registry of the hosted service.
BRANDS_CONFIGbuilt-in placeholdersnonoJSON with the real brand hosts of the hosted multi-brand setup.
TIMEWREN_APP_ENABLEDnonenono1 opens the app (login, sign-up, dashboard) on the hosted TimeWren hosts.
TIMEWREN_GOOGLE_CLIENT_IDnonenonoClient ID of the TimeWren Cloud Google app. With its secret, Google sign-in is offered on the TimeWren hosts; without it, the button is hidden and the provider is not registered there. The TimeTrack keys are never used on TimeWren hosts.
TIMEWREN_GOOGLE_CLIENT_SECRETnonenonoClient secret of the TimeWren Cloud Google app.
TIMEWREN_GITHUB_CLIENT_IDnonenonoClient ID of the TimeWren Cloud GitHub app. With its secret, GitHub sign-in is offered on the TimeWren hosts; without it, the button is hidden and the provider is not registered there. The TimeTrack keys are never used on TimeWren hosts.
TIMEWREN_GITHUB_CLIENT_SECRETnonenonoClient secret of the TimeWren Cloud GitHub app.
TIMEWREN_DISCORD_CLIENT_IDnonenonoClient ID of the TimeWren Cloud Discord app. With its secret, Discord sign-in is offered on the TimeWren hosts; without it, the button is hidden and the provider is not registered there. The TimeTrack keys are never used on TimeWren hosts.
TIMEWREN_DISCORD_CLIENT_SECRETnonenonoClient secret of the TimeWren Cloud Discord app.
TIMEWREN_MICROSOFT_CLIENT_IDnonenonoClient ID of the TimeWren Cloud Microsoft Entra ID app. With its secret, Microsoft Entra ID sign-in is offered on the TimeWren hosts; without it, the button is hidden and the provider is not registered there. The TimeTrack keys are never used on TimeWren hosts.
TIMEWREN_MICROSOFT_CLIENT_SECRETnonenonoClient secret of the TimeWren Cloud Microsoft Entra ID app.
TIMEWREN_MICROSOFT_TENANT_IDcommonnonoMicrosoft tenant for TimeWren Cloud sign-in, like MICROSOFT_TENANT_ID.
TIMEWREN_GOOGLE_REDIRECT_URIhttps://<TimeWren host>/api/integrations/google/callbacknonoGoogle Calendar redirect URI for TimeWren Cloud accounts. Google Calendar on TimeWren uses TIMEWREN_GOOGLE_CLIENT_ID and TIMEWREN_GOOGLE_CLIENT_SECRET; without them TimeWren accounts see "coming soon".
TIMEWREN_OUTLOOK_CLIENT_IDnonenonoClient ID of the TimeWren Cloud Outlook calendar app. Without it, the TimeWren Microsoft sign-in app (TIMEWREN_MICROSOFT_CLIENT_ID) is used for the calendar too, if set.
TIMEWREN_OUTLOOK_CLIENT_SECRETnonenonoClient secret of the TimeWren Cloud Outlook calendar app.
TIMEWREN_OUTLOOK_REDIRECT_URIhttps://<TimeWren host>/api/integrations/outlook/callbacknonoOutlook calendar redirect URI for TimeWren Cloud accounts.
TIMEWREN_APPLE_CLIENT_IDnonenonoServices ID of the TimeWren Cloud Sign in with Apple app. Signed with the team key (APPLE_TEAM_ID, APPLE_KEY_ID, APPLE_PRIVATE_KEY).

TimeWren Cloud trial reminders. Enable trial-ending reminder emails in Stripe Dashboard under Subscriptions and emails. Stripe sends these reminders for Stripe trials. The app does not send its own. Stripe setup guide

Development and tests only

Warning: These variables are for developing TimeWren itself. Do not set them in production.

For a local setup without Docker (npm run dev), put DATABASE_URL in .env.local, for example postgresql://postgres:postgres@localhost:5432/freelance_crm. npm run docker:up starts a matching PostgreSQL from docker-compose.dev.yml.

VariableDefaultRequiredBuild timeDescription
TT_DB_TESTSnonenono1 runs the database-backed timer model tests. They need DATABASE_URL pointing at a disposable database.
DATABASE_CONNECT_TIMEOUT10nonoSeconds the app waits for a new database connection. CI sets 60 for the model tests on shared runners.
TT_MODEL_RUNS150nonoNumber of generated command sequences in the timer model test.
TT_MODEL_SEEDfixed seednonoSeed of the timer model test. random explores new sequences.
TT_MODEL_MAX_COMMANDS30nonoMaximum commands per generated sequence.
TT_MODEL_PATHnonenonoReplays one counterexample, for example 4:2:1, together with TT_MODEL_SEED.
TT_MODEL_DEBUGnonenonoWhen set, the timer model test prints extra debug output.
TT_QUERY_COUNTnonenono1 counts database queries per tRPC request. Ignored when NODE_ENV is production.

Instance operations

VariableDefaultRequiredBuild timeDescription
UPDATE_CHECKonnonoSet to off to disable the release check and lock its setting. The check only runs in BUILD_PROFILE=selfhost builds.
BACKUP_STATUS_FILEnonenonoPath in the app container to a marker file whose modification time records the last successful backup.

On this page