Skip to content

Environment variables

This table is the source of truth. server/.env.template and client/.env.template are copies to start from; scripts/check-docs.sh fails when a variable used in the code is missing here. For the reasoning behind each group of settings, read Server configuration.

The server loads server/.env with dotenv at startup (server/src/env.ts). There is no schema validation: a missing variable takes its default, or throws when first used if it has none.

VariableDefaultPurpose
APP_NAMEDamvia - Open Source Digital Asset ManagementReturned by the public env query; the client uses it as the document title.
APP_URLhttp://localhost:5173Public URL of the client. Every link in an email is built from it, and expired download links redirect to APP_URL/link-expired.
API_URLhttp://localhost:3000Public URL of this server. Download links are API_URL/v1/downloads/{id}.
APP_SECRETDamvia App SecretSecret used to sign JWT auth tokens (180-day lifetime). Change it: with the default, anyone can forge a token. Changing it later logs every user out.
PORT3000HTTP port the server listens on (0.0.0.0).
NODE_ENVunsetproduction in deployments. npm start sets it.
ENABLE_WORKERunset (worker off)true starts the pg-boss worker inside this process. npm run dev sets it. See Worker and scaling.
ENABLE_PASSWORD_LESS_AUTHfalsetrue disables passwords entirely: sign-up stores none and login always emails a magic link.
VariableDefaultPurpose
DATABASE_URLpostgresql://dam:dam@localhost/damPostgres connection string, used by TypeORM and by pg-boss (which creates a pgboss schema in the same database).
VariableDefaultPurpose
MAIN_S3_URLnone, requiredhttp(s)://ACCESS_KEY:SECRET_KEY@host:port/bucket. Bucket for collection and page thumbnails, page images and the login background.
ASSETS_S3_URLnone, requiredSame syntax. Bucket for asset originals (asset-file/{id}), asset thumbnails and download archives (downloads/{id}).

The scheme sets useSSL; the port defaults to 443 for https and 80 for http. Details in Object storage.

VariableDefaultPurpose
SMTP_HOSTlocalhostSMTP server.
SMTP_PORT1025SMTP port. The defaults match MailHog from docker-compose.yml.
SMTP_USERunsetSMTP login. Authentication is only enabled when both SMTP_USER and SMTP_PASS are set.
SMTP_PASSunsetSMTP password.
MAILCONFIGunsetBase64-encoded JSON of the mail templates. When unset, the server reads server/mailconfig.json and exits with an error if the file is unreadable. See Email templates.
VariableDefaultPurpose
ASSET_UPDATERnone, requireddropbox or onedrive. Any other value stops the server at startup with Provide a valid asset updater.
DROPBOX_APP_KEYunsetDropbox app key (Dropbox only).
DROPBOX_APP_SECRETunsetDropbox app secret.
DROPBOX_REFRESH_TOKENunsetLong-lived refresh token obtained once through the OAuth flow. See Dropbox.
DROPBOX_USE_TEAM_ROOTfalsetrue lists the Dropbox Business team space instead of the member’s home folder.
ONEDRIVE_TENANT_IDunsetAzure AD tenant (OneDrive only).
ONEDRIVE_CLIENT_IDunsetAzure app registration client id.
ONEDRIVE_CLIENT_SECRETunsetAzure app client secret.
ONEDRIVE_USERunsetUser principal name whose drive is synced, for example [email protected].
ONEDRIVE_DRIVEunsetPath inside that drive, Graph syntax, for example root:/DAM. See OneDrive.
VariableDefaultPurpose
PRODUCT_MATCHING_REGEXunset (job logs an error and skips)Regex applied to each asset file name every 5 minutes. Capture group 1 is the product key, optional group 2 the product view. Example: ^(.{6}-\d{3})(?:\.(\d{2}))?.
PIM_PRODUCT_VIEWunsetThe product view code (group 2 above) whose thumbnail represents the product in the admin product list, for example 00.

See Products and PIM.

Client variables are read by Vite at build time and baked into the bundle. Changing one means restarting npm run dev or rebuilding.

VariableDefaultPurpose
VITE_API_ENDPOINThttp://localhost:3000/trpcFull URL of the server’s tRPC endpoint, that is API_URL plus /trpc.
VITE_BRAND_COLORsky-400Accent colour. A Tailwind colour name (red-500) or any CSS colour (#e11d48).
VITE_BRAND_COLOR_HOVERsky-500Hover shade of the accent.
VITE_BRAND_COLOR_STRONGsky-600Strong shade of the accent, used for emphasis text.

The brand colours are resolved in client/tailwind.config.js, which loads client/.env itself. See Client configuration.