Skip to Content
ConfigurationEnvironment Variables

Environment Variables

Tracearr uses environment variables for core configuration.

Required Variables

VariableDescriptionExample
DATABASE_URLPostgreSQL/TimescaleDB connection stringpostgres://user:pass@host:5432/tracearr
REDIS_URLRedis connection stringredis://localhost:6379

Optional Variables

VariableDescriptionDefault
PORTHTTP server port3000
NODE_ENVEnvironment modeproduction
LOG_LEVELLogging verbosityinfo
SESSION_SECRETSession encryption key(generated)
TZTimezoneUTC
CORS_ORIGINAllowed CORS origin for API requests*
REDIS_PREFIXRedis key prefix for namespacingno prefix
CLAIM_CODEClaim code for first time setupnone
BASE_PATHBase path when served under a subpathnone
DNS_CACHE_MAX_TTLDNS cache maximum TTL in secondsdisabled

Database Configuration

Tracearr requires TimescaleDB (PostgreSQL with the TimescaleDB extension) for time-series data storage.

DATABASE_URL=postgres://tracearr:password@localhost:5432/tracearr

Redis Configuration

Redis is used for caching and background job queues.

REDIS_URL=redis://localhost:6379

For Redis with authentication:

REDIS_URL=redis://:password@localhost:6379

To enable Redis key prefixing:

Redis key prefixes must end with a delimiter (we recommend a colon ”:”) to ensure proper namespacing and avoid key collisions in shared Redis instances.

REDIS_PREFIX=myprefix:

Claim Code

The CLAIM_CODE environment variable is used to protect the initial setup page.
This is recommended when Tracearr is exposed to the public internet.

When set, the claim code will be printed to the log on startup.

Claim code

Before you can access the setup page, you must enter the claim code.

Claim code

Base Path

Set BASE_PATH when you want Tracearr to be served under a subpath.
This ensures all routes, assets, and links are prefixed correctly.

BASE_PATH=/tracearr

You only need to set this if Tracearr is accessed through a reverse proxy under a subpath (e.g. https://example.com/tracearr). If Tracearr is served at the root, this can be left unset.

DNS Cache

Set DNS_CACHE_MAX_TTL to enable DNS caching for outgoing requests.
This can improve performance by reducing the number of DNS lookups for frequently accessed hosts.
DNS caching is disabled if DNS_CACHE_MAX_TTL is not set.

DNS_CACHE_MAX_TTL=3600

Tracearr will respect the TTL provided by the DNS server, but will not cache entries longer than the value set in DNS_CACHE_MAX_TTL. Error responses (e.g. DNS resolution failures) are not cached to ensure that transient issues do not persist longer than necessary.

Last updated on