Skip to the article
Aniq-UI

VelraEnvironment variables

Environment variables

What each setting in the API's and the frontends' .env files does, and which ones you need.

For the Full Stack package

Where the settings live

FileRead byHolds secrets
back-end/.envThe API, with yarn dev and inside Docker ComposeYes. Never commit it.
storefront/.envThe public website, at build timeNo. Every value is public.
admin-dashboard/.envThe agency dashboard, at build timeNo. Every value is public.
.env beside docker-compose.ymlDocker Compose, for the full stackNo

Create each app's file from the .env.example beside it, which documents every variable: cp .env.example .env. The examples work as they are for a local run, and the Docker Compose start needs no file at all.

Where the settings live

One file, .env in the website's folder, read when the website is built. Every value in it is public, so it never holds a secret. Create it from .env.example, which points at an API on http://localhost:8000: cp .env.example .env. With Docker, pass the same values as --build-arg.

Where the settings live

One file, .env in the dashboard's folder, read when the dashboard is built. Every value in it is public, so it never holds a secret: provider keys live in the API's .env. Create it from .env.example, which points at an API on http://localhost:8000: cp .env.example .env. With Docker, pass the same values as --build-arg.

Where the settings live

One file, .env in the API's folder, read by the API with yarn dev, and by a container when you add --env-file .env -e NODE_ENV=production to its docker run. It holds secrets: never commit it. Create it from .env.example, which documents every variable and works as it is for a local run: cp .env.example .env.

The Docker image sets its own defaults, so docker run works without a file: SQLite at /data/database.sqlite, uploads in /data/uploads, CORS_ORIGIN for the two local frontends, FRONTEND_URL=http://localhost:3031, PUBLIC_MEDIA_URL=http://localhost:8000/media and SEED_DEMO_DATA=false. Override any of them with -e.

API essentials

The API checks JWT_SECRET and, in production, CORS_ORIGIN before it starts. If one is missing or unusable, it stops with one line saying what to fix.

VariableWhat it does
NODE_ENVdevelopment locally, which creates and updates the tables on start. production on a live server, which never touches the tables.
PORTThe API's port, 8000. Both frontends point at it.
DB_TYPEsqlite (as in .env.example) or mysql. Unset means MySQL, so keep the line.
SQLITE_DATABASEPath of the SQLite file, ./database.sqlite by default.
JWT_SECRETSigns every sign-in. Required. The example value is accepted outside production only.
JWT_EXPIRATIONHow long a sign-in lasts, 7d by default. The sign-in response reports it as expires_in.
CORS_ORIGINThe website's and the dashboard's addresses, comma separated. Unset, only http://localhost:3030 and http://localhost:3031 are allowed, never every origin; required in production.
FRONTEND_URLThe dashboard's address, which its live notifications connect from, http://localhost:3031 when unset.
TRUST_PROXYOptional. The number of reverse proxies in front of the API, so the per-address limits count the real visitor.
RATE_LIMIT_LOGINOptional. Failed sign-ins one address may make in 15 minutes before 429, 10 by default.
SEED_DEMO_DATARead only by the Docker image, on a volume with no database yet: true creates it with the demo agency, false with the tables only.

Generate your own JWT_SECRET with:

Terminal
node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"

Every optional feature below is off while its lines in .env.example stay commented out.

Use MySQL instead of SQLite

Create an empty database, then set the driver and the connection in the API's .env:

The API's .env
DB_TYPE=mysql
DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=root
DB_PASSWORD=
DB_DATABASE=velra

Then run yarn seed for the demo agency, or yarn db:sync for the tables with no data. The running API only creates and updates the tables itself when NODE_ENV=development, so with NODE_ENV=production one of those commands runs before the first start (yarn seed:prod or yarn db:sync:prod after yarn build).

Photos and uploads

The API serves the seeded photos itself, from public/media/velra, at /media/velra/…. Uploads from the dashboard (property photos, room photos for the studio, staged previews, profile pictures) are stored on the API's disk under MEDIA_UPLOAD_DIR and served at /media/uploads/…, unless a bucket is set.

The API's .env
PUBLIC_MEDIA_URL=http://localhost:8000/media
MEDIA_UPLOAD_DIR=./public/media/uploads

PUBLIC_MEDIA_URL is the address /media is reached at from a browser. Every photo address is built from it, and the API moves the stored ones onto it when it starts, so moving the API keeps every photo. On a server, point MEDIA_UPLOAD_DIR at persistent storage; with Docker it is in the data volume.

To send uploads to Cloudflare R2, or any S3-compatible bucket, set all five variables. Give both frontends the bucket's public host through NEXT_PUBLIC_MEDIA_HOSTNAME (with Docker Compose, MEDIA_HOSTNAME) so Next.js resizes those photos.

The API's .env
R2_ACCESS_KEY_ID=your-r2-access-key-id
R2_SECRET_ACCESS_KEY=your-r2-secret-access-key
R2_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com
R2_BUCKET_NAME=your-bucket-name
R2_PUBLIC_URL=https://your-public-url.r2.dev

Photos are re-encoded on upload, at most 1920 pixels wide, with a smaller copy for property cards. Videos are accepted as MP4, WebM, MOV or M4V, up to 150 MB.

Public website and agency dashboard

Every NEXT_PUBLIC_* value is compiled into the JavaScript the browser loads, and anyone who opens the page can read it. Never put a secret in these files, and rebuild after changing one.

VariableAppWhat it does
NEXT_PUBLIC_API_BASE_URLBothThe API's address including /api, http://localhost:8000/api by default.
NEXT_PUBLIC_SITE_URLBothThe website's public address, http://localhost:3030 by default. On the website, canonical URLs, language alternates, sharing cards, robots.txt and the sitemap are built from it; in the dashboard, the "View website" link and the listing preview.
NEXT_PUBLIC_MEDIA_HOSTNAMEBothOptional. The https hosts serving the photos, comma separated: your bucket's public host, such as pub-1234.r2.dev, the API's domain, or both. Photos on them are resized by Next.js; any other photo loads as it is. Hosts only, without https://. Both apps read the same list, so one value serves both. Leave it empty while the API runs on localhost.
NEXT_PUBLIC_WEBSOCKET_BASE_URLDashboardThe API's address without /api, for live notifications.
NEXT_PUBLIC_MAP_STYLE_LIGHT, NEXT_PUBLIC_MAP_STYLE_DARKDashboardOptional map tile styles. Unset, both themes draw OpenFreeMap's Positron style, which needs no key.
NEXT_PUBLIC_PLACE_SEARCH_URLDashboardThe place search in the property editor's Location tab, https://photon.komoot.io/api in .env.example. Any geocoder that answers the same shape works.
API_INTERNAL_URLWebsiteOptional, server only, read at run time rather than at build time. Where the website's own server reaches the API when the browser's address does not work from inside it, as in Docker (http://api:8000/api in Docker Compose). Leave it unset elsewhere.
BUILD_STANDALONEBothtrue makes yarn build emit a self-contained server, which the Dockerfiles set. Leave it unset otherwise.

The website's marketing tags are NEXT_PUBLIC_* values too: Google Tag Manager, GA4, Meta, TikTok, Snapchat and Pinterest, each switched on by one id.

Docker Compose options

Nothing has to be set for a local run. To change something, put it in a .env file beside docker-compose.yml and run docker compose up --build again: the frontends compile these values in.

VariableDefaultWhat it does
SITE_PORT3030The website's port on your computer.
ADMIN_PORT3031The dashboard's port on your computer.
API_PORT8000The API's port on your computer.
SITE_URL, ADMIN_URL, API_URLThe local addresses on those portsWhere the browser reaches each app. Set all three when serving the stack on your own domains.
MEDIA_HOSTNAMEEmptyThe https hosts serving the photos, comma separated: your bucket's public host (with the R2_* variables in back-end/.env), the API's own domain, or both.
SEED_DEMO_DATAtruefalse starts with empty tables and no accounts instead of the demo agency. It matters only on a new volume.
NEXT_PUBLIC_GTM_ID, NEXT_PUBLIC_GA4_MEASUREMENT_ID, NEXT_PUBLIC_META_PIXEL_ID, NEXT_PUBLIC_TIKTOK_PIXEL_ID, NEXT_PUBLIC_SNAPCHAT_PIXEL_ID, NEXT_PUBLIC_PINTEREST_TAG_IDEmptyThe website's marketing tags, all optional.
NEXT_PUBLIC_ANALYTICS_CURRENCY, NEXT_PUBLIC_ANALYTICS_DEBUGAED, falseThe currency sent with every tracked price, and logging every event to the browser console.
NEXT_PUBLIC_MAP_STYLE_LIGHT, NEXT_PUBLIC_MAP_STYLE_DARK, NEXT_PUBLIC_PLACE_SEARCH_URLEmptyThe dashboard's map tiles and place search; empty uses OpenFreeMap and Photon.

Change a port when another program already uses it, such as ADMIN_PORT=3041. The API's CORS_ORIGIN, FRONTEND_URL and PUBLIC_MEDIA_URL, and the frontends' API and website addresses, are all built from the ports and the three addresses, so they follow by themselves.

The API container also reads back-end/.env when it exists, so the optional keys are set in one place for both yarn dev and Docker. The compose file wins for the values that differ inside a container: the database path, the upload folder, the port, NODE_ENV=production and the addresses above. The database and the uploads live in the velra-data volume.

AI features

Included with your purchase. Sign in to read, or open it in your download.

Turning on the AI assistant and the AI staging studio: the provider keys and the image model.

The MCP server

Included with your purchase. Sign in to read, or open it in your download.

Letting coding agents and other MCP clients use the assistant's tools: the key and the endpoint.

Demo mode

Included with your purchase. Sign in to read, or open it in your download.

The switch for a public demo, and why it stays off for a real agency.

Stuck on a step?

Find a fix before you start over.

Troubleshooting

Cookie Preferences

We use cookies to enhance your browsing experience, analyze site traffic, and personalize content. By clicking "Accept All", you consent to our use of cookies for analytics and personalized advertising.