Environment Variables
Last updated
Every setting of the Deskply web app, and the groups of settings of the API, with what each one is for and when a change takes effect.
Web app
The web app reads frontend/.env.local. The setup fills in the connection and realtime values. env.example lists every variable with a comment.
Connection
| Variable | What it is for |
|---|---|
NEXTAUTH_SECRET | Signs the session cookie. Use your own long random value. |
NEXTAUTH_URL | The address of the web app. |
NEXT_PUBLIC_API_BASE_URL | The public address of the API, without a trailing slash. |
IMAGE_REMOTE_HOSTS | Extra hosts that images may load from, such as an S3 bucket or a CDN. Images from the API host always load. |
DEV_ALLOWED_ORIGINS | Development only: other hostnames that may open the dev server, such as a LAN address. |
Realtime
| Variable | What it is for |
|---|---|
NEXT_PUBLIC_PUSHER_KEY | The REVERB_APP_KEY of the API. |
NEXT_PUBLIC_PUSHER_HOST | The host of the websocket server. |
NEXT_PUBLIC_PUSHER_PORT | Its port: 8081 by default, 443 behind an HTTPS proxy. |
NEXT_PUBLIC_PUSHER_SCHEME | http or https. |
Language
| Variable | What it is for |
|---|---|
NEXT_PUBLIC_DEFAULT_LOCALE | The language shown until a visitor picks one. English by default. |
Pages and features
The three flags below are off by default. true, 1, yes or on turns one on; anything else, or nothing, leaves it off.
| Variable | What it is for |
|---|---|
NEXT_PUBLIC_DOCS_ENABLED | Publishes this documentation at /documentation, with its footer link and sitemap entries. Leave it off on your live site: the pages are written for you, not for your customers. |
NEXT_PUBLIC_LANDING_ENABLED | Turns on the /landing product page, which a CodeCanyon demo uses to offer the demo logins. Each demo panel on it shows a login box only when the matching NEXT_PUBLIC_DEMO_* login is set. |
NEXT_PUBLIC_UI_KIT_ENABLED | Adds the UI kit, a gallery of the interface components, to the admin panel. Only admins see it, and it is hidden while an admin views the app as a customer. |
NEXT_PUBLIC_CODECANYON_URL | The item page that the Buy buttons of /landing open. Only an https address is accepted; empty hides every Buy button. |
NEXT_PUBLIC_LEGAL_EFFECTIVE_DATE | The effective date printed on the privacy policy, the terms and the data processing agreement, shown as written, such as 1 March 2027. Empty hides the date line. |
Demo mode
For a public live preview only, together with DEMO_MODE=true in the API. Off by default. See Public Demo.
| Variable | What it is for |
|---|---|
NEXT_PUBLIC_DEMO_MODE | Shows a banner saying changes are disabled, shows the demo logins on the sign-in pages, and explains the API's demo-mode refusals in a friendly message. With an https NEXTAUTH_URL it also lets the sign-in work inside a preview frame. |
NEXT_PUBLIC_DEMO_ADMIN_EMAILNEXT_PUBLIC_DEMO_ADMIN_PASSWORD | The admin login shown on /admin/login and /landing. Use a throwaway demo account: every visitor sees it. |
NEXT_PUBLIC_DEMO_USER_EMAILNEXT_PUBLIC_DEMO_USER_PASSWORD | The customer login shown on /login and /landing. Also a throwaway demo account. |
Security
| Variable | What it is for |
|---|---|
FRAME_ANCESTORS | Not sent to browsers, but written into the build: rebuild after a change. The sites that may show the app in a frame, as a space-separated CSP frame-ancestors list. Empty means none: every page refuses to be framed (frame-ancestors 'none' and X-Frame-Options: DENY), which protects the panels from clickjacking, except the chat widget at /widget/{key}, which any site can embed. A demo inside Envato's preview frame sets https://preview.codecanyon.net https://codecanyon.net. |
CSP_EXTRA_SOURCES | Not sent to browsers; read when the app starts, so restart it after a change. Extra sources for the Content-Security-Policy, space-separated, for a service the app does not know about, such as a CDN, an error tracker or an embedded video: https://cdn.example.com https://*.sentry.io. They are added to the image, media, font, style, connect and frame sources, never to scripts. A value that is not a plain list of sources is ignored. |
CSP_REPORT_ONLY | Read when the app starts, like CSP_EXTRA_SOURCES. true sends the policy as Content-Security-Policy-Report-Only: the browser console lists what it would block, and nothing is blocked. Use it to find a missing source, then turn it off. frame-ancestors stays enforced meanwhile. |
PORT | The port pnpm start listens on. 3000 by default. |
Every page gets a Content-Security-Policy built around a new random nonce for each page load. Only the app's own scripts run, and the scripts they load (Meta's SDK, Google's tags): an injected script, inline event handler or javascript: link is refused. The policy already allows the API and the hosts in IMAGE_REMOTE_HOSTS, the Reverb websocket, Meta's login and picture hosts, and Google's endpoints for the tags you configure (with a Google Ads tag, images from any https host, for its remarketing pixel on the visitor's own Google domain). Pages are rendered for each request, so do not cache their HTML at a CDN.
If the browser console reports a Content Security Policy violation for a service you added, allow its host with CSP_EXTRA_SOURCES; CSP_REPORT_ONLY=true helps you find every missing source at once. A script of your own needs the nonce: render it with next/script and read the nonce in a Server Component from the x-nonce request header.
Your brand is not a variable
The name, the logos, the contact and legal details and the social links are set in the admin panel, under Settings → Branding. See Branding.
Search engines and analytics
| Variable | What it is for |
|---|---|
NEXT_PUBLIC_SITE_URL | The public address used in metadata, robots.txt, the sitemap and llms.txt. Set it in every deployed environment. |
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION | The Search Console verification code. |
NEXT_PUBLIC_BING_SITE_VERIFICATION | The Bing Webmaster Tools code. |
NEXT_PUBLIC_GA_MEASUREMENT_ID | A GA4 measurement ID. The tag loads only after a visitor allows analytics cookies. |
NEXT_PUBLIC_GOOGLE_ADS_ID | A Google Ads tag ID. The tag loads only after a visitor allows advertising cookies. |
API
The API reads backend/.env. The setup fills in the addresses, the database and the secrets. Every setting is in .env.example, with a comment where the value is not obvious. These are the groups.
| Group | Keys | Notes |
|---|---|---|
| Application | APP_URLFRONTEND_URLCORS_ALLOWED_ORIGINSAPP_VERSION | APP_URL is the API; the webhook addresses derive from it. FRONTEND_URL is the web app; Meta and Google return the browser to it after sign-in, so the OAuth redirect addresses derive from it. APP_VERSION overrides the version the installer shows (2.0.0 for this release); leave it unset. |
| Proxies | TRUSTED_PROXIES | The reverse proxies whose X-Forwarded-For header the API believes: comma-separated IPs or CIDR ranges. Unset means loopback and the private ranges, which fits nginx on the same server. Behind a load balancer or CDN with public addresses, list those. Avoid *: it lets any visitor choose the IP that rate limits and logs see. |
| Admin sessions | ADMIN_TOKEN_TTL_HOURS | How many hours an admin sign-in lasts before the admin must sign in again. 12 by default. |
| Demo | DEMO_MODEDEMO_RESET_DAILYDEMO_RESET_TIME | For a public live demo only. DEMO_MODE=true refuses changes to settings, accounts and connections with status 403. See Public Demo. |
| Database | DB_*PGVECTOR_REQUIRED | PostgreSQL only. The user of DB_USERNAME needs a password in DB_PASSWORD. |
MAIL_*MAIL_LOGO_URL | Verification codes, password resets, invoices and notifications. The SMTP server and sender address are normally entered under Settings → Integrations → Email (SMTP), which can send a test email; these values apply until then. | |
| AI | LLM_PROVIDEREMBEDDING_PROVIDEROPENAI_*ANTHROPIC_*GEMINI_*AI_SETTINGS_FROM_ENV | Normally set in the admin panel under Settings → AI & Voice; these values apply to what is left empty there. EMBEDDING_PROVIDER is chosen once, at install. See AI providers. |
| Meta | INSTAGRAM_*FACEBOOK_*WHATSAPP_*INTEGRATION_SETTINGS_FROM_ENV | Normally entered in the admin panel under Settings → Integrations, which stores them encrypted. These values apply only while nothing is saved there. INSTAGRAM_REDIRECT_URI and FACEBOOK_REDIRECT_URI default to FRONTEND_URL/platforms; leave them unset. |
| Websockets | REVERB_* | The web app's NEXT_PUBLIC_PUSHER_* values must match. REVERB_HOST and REVERB_PORT are where the API sends the updates; REVERB_SERVER_HOST and REVERB_SERVER_PORT are where reverb:start listens when started without --host and --port (keep the ports equal). |
| Logs | LOG_STACKLOG_DAILY_DAYSLOG_LEVEL | daily (the default) writes one file a day in storage/logs and deletes those older than LOG_DAILY_DAYS (14); single keeps one growing file. |
GOOGLE_* | Calendar sync. The client ID and secret can also be entered under Settings → Integrations. GOOGLE_USER_REDIRECT_URI and GOOGLE_REDIRECT_URI default to FRONTEND_URL/calendar/google/callback and FRONTEND_URL/admin/calendar/google/callback; leave them unset. | |
| Stripe | STRIPE_SECRET_KEYSTRIPE_WEBHOOK_SECRETSTRIPE_SETTINGS_FROM_ENVSTRIPE_CURRENCY | The key and secret are normally entered in the admin panel under Settings → Payment methods, which stores them encrypted; these values apply only while nothing is saved there. STRIPE_CURRENCY (usd by default) is the currency plans are priced and charged in: choose it before you create the first plan. |
| Public chat limits | WEBSITE_CHAT_VISITOR_PER_MINUTEWEBSITE_CHAT_VISITOR_DAILY_LIMITWEBSITE_CHAT_WIDGET_DAILY_LIMITDEMO_CHAT_DAILY_CAP | How many messages the website chat and the demo chat answer (6 a minute and 100 a day per visitor, 2,000 a day per widget, 500 a day for the demo). Normally set in the admin panel under Settings → Billing rules and Settings → Demo Chat; these values apply until then. 0 turns a limit off. |
| Voice | TWILIO_*VOICE_BRIDGE_*OPENAI_REALTIME_*DEEPGRAM_* | The phone agent. |
| Legal and invoices | LEGAL_*INVOICE_* | Shown in emails and on invoice PDFs. |
| Retention | COPPA_* | Minor detection and how long messages are kept are set in the admin panel under Settings → Privacy; these values apply until then. |
| Cost reports | OPENAI_PRICE_*OPENAI_REALTIME_PRICE_* | Used by the admin margin report, and editable under Settings → AI & Voice. Blank means the built-in rates. |
The settings of each service are explained in Integrations.
When a change takes effect
After sudo bash server/restart.sh, in both files. It builds the web app again, because the NEXT_PUBLIC_ variables and FRAME_ANCESTORS are written into the build, and it refreshes the cached settings of the API. Settings made in the admin panel apply at once.
Never put a secret in a NEXT_PUBLIC_ variable
Those values are sent to every visitor's browser. Secret keys, such as the Reverb app secret or the Stripe API key, belong to the API only: in its .env, or, for Stripe and the AI providers, in the admin panel, which stores them encrypted.