Demo mode: changes are disabled.

Skip to content

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

VariableWhat it is for
NEXTAUTH_SECRETSigns the session cookie. Use your own long random value.
NEXTAUTH_URLThe address of the web app.
NEXT_PUBLIC_API_BASE_URLThe public address of the API, without a trailing slash.
IMAGE_REMOTE_HOSTSExtra hosts that images may load from, such as an S3 bucket or a CDN. Images from the API host always load.
DEV_ALLOWED_ORIGINSDevelopment only: other hostnames that may open the dev server, such as a LAN address.

Realtime

VariableWhat it is for
NEXT_PUBLIC_PUSHER_KEYThe REVERB_APP_KEY of the API.
NEXT_PUBLIC_PUSHER_HOSTThe host of the websocket server.
NEXT_PUBLIC_PUSHER_PORTIts port: 8081 by default, 443 behind an HTTPS proxy.
NEXT_PUBLIC_PUSHER_SCHEMEhttp or https.

Language

VariableWhat it is for
NEXT_PUBLIC_DEFAULT_LOCALEThe 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.

VariableWhat it is for
NEXT_PUBLIC_DOCS_ENABLEDPublishes 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_ENABLEDTurns 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_ENABLEDAdds 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_URLThe item page that the Buy buttons of /landing open. Only an https address is accepted; empty hides every Buy button.
NEXT_PUBLIC_LEGAL_EFFECTIVE_DATEThe 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.

VariableWhat it is for
NEXT_PUBLIC_DEMO_MODEShows 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_PASSWORDThe 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_PASSWORDThe customer login shown on /login and /landing. Also a throwaway demo account.

Security

VariableWhat it is for
FRAME_ANCESTORSNot 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_SOURCESNot 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_ONLYRead 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.
PORTThe 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

VariableWhat it is for
NEXT_PUBLIC_SITE_URLThe public address used in metadata, robots.txt, the sitemap and llms.txt. Set it in every deployed environment.
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATIONThe Search Console verification code.
NEXT_PUBLIC_BING_SITE_VERIFICATIONThe Bing Webmaster Tools code.
NEXT_PUBLIC_GA_MEASUREMENT_IDA GA4 measurement ID. The tag loads only after a visitor allows analytics cookies.
NEXT_PUBLIC_GOOGLE_ADS_IDA 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.

GroupKeysNotes
ApplicationAPP_URLFRONTEND_URLCORS_ALLOWED_ORIGINSAPP_VERSIONAPP_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.
ProxiesTRUSTED_PROXIESThe 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 sessionsADMIN_TOKEN_TTL_HOURSHow many hours an admin sign-in lasts before the admin must sign in again. 12 by default.
DemoDEMO_MODEDEMO_RESET_DAILYDEMO_RESET_TIMEFor a public live demo only. DEMO_MODE=true refuses changes to settings, accounts and connections with status 403. See Public Demo.
DatabaseDB_*PGVECTOR_REQUIREDPostgreSQL only. The user of DB_USERNAME needs a password in DB_PASSWORD.
MailMAIL_*MAIL_LOGO_URLVerification 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.
AILLM_PROVIDEREMBEDDING_PROVIDEROPENAI_*ANTHROPIC_*GEMINI_*AI_SETTINGS_FROM_ENVNormally 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.
MetaINSTAGRAM_*FACEBOOK_*WHATSAPP_*INTEGRATION_SETTINGS_FROM_ENVNormally 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.
WebsocketsREVERB_*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).
LogsLOG_STACKLOG_DAILY_DAYSLOG_LEVELdaily (the default) writes one file a day in storage/logs and deletes those older than LOG_DAILY_DAYS (14); single keeps one growing file.
GoogleGOOGLE_*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.
StripeSTRIPE_SECRET_KEYSTRIPE_WEBHOOK_SECRETSTRIPE_SETTINGS_FROM_ENVSTRIPE_CURRENCYThe 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 limitsWEBSITE_CHAT_VISITOR_PER_MINUTEWEBSITE_CHAT_VISITOR_DAILY_LIMITWEBSITE_CHAT_WIDGET_DAILY_LIMITDEMO_CHAT_DAILY_CAPHow 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.
VoiceTWILIO_*VOICE_BRIDGE_*OPENAI_REALTIME_*DEEPGRAM_*The phone agent.
Legal and invoicesLEGAL_*INVOICE_*Shown in emails and on invoice PDFs.
RetentionCOPPA_*Minor detection and how long messages are kept are set in the admin panel under Settings → Privacy; these values apply until then.
Cost reportsOPENAI_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.