Skip to content

Server ​

Environment Variable draft xyz environment server deployment

PORT, DIR, ALIAS, XYZ_CWD, APP_ENV and the rate limit configure how the XYZ API is served.

Resource and sources
VariableDefaultPurpose
PORT3000Port the Express server listens on.
DIRemptyPath prefix for every route, eg. /geo.
ALIASrequest hostPublic host name used to build absolute URLs.
XYZ_CWDrepository rootDirectory for local files and keys.
APP_ENVnoneDeployment environment name, eg. development.
RATE_LIMIT1000Requests per window per client.
RATE_LIMIT_WINDOW60000Rate limit window in milliseconds.

Paths and hosts ​

DIR mounts the API and the static public files under a common prefix, eg. DIR=/geo serves the API at /geo/api/.... processEnv.js adds a leading slash and removes a trailing slash, so geo/ becomes /geo. When the server uses the root redirect middleware, as server.js does, a request to / redirects to DIR. Session cookies are scoped to DIR unless COOKIE_PROPS is set.

ALIAS replaces the request host in the absolute URLs the user modules build, eg. the links in registration and verification emails. Set it when XYZ runs behind a proxy or a custom domain. A request from localhost always uses http:// and the request host; any other uses https://.

XYZ_CWD is the root for local paths: file: workspace and template sources, the public directory, SECRET_KEY and SIGN_* key files. processEnv.js defaults it to the repository root, not the process working directory.

Runtime ​

PORT only applies when the server starts itself. In a Vercel deployment the platform serves the exported app and PORT is ignored.

APP_ENV=development stops browsers caching the static CSS and fonts outside Vercel, so style changes show on reload. Telemetry reports APP_ENV as the deployment environment when Vercel does not provide one.

The rate limit applies to every request through the router, including static files, with standard RateLimit response headers. It counts per req.ip. XYZ does not set the Express trust proxy option, so behind a proxy which Express does not trust, all clients may share one limit.

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.