Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/backtest-kit/backtest-kit-redis-postgres-pgpool-docker/llms.txt

Use this file to discover all available pages before exploring further.

Environment variables configure both the Node.js application and the Docker containers that support it. Variables prefixed CC_ are read directly by the TypeScript source at startup (via src/config/params.ts). Variables without that prefix are consumed by the backtest-kit CLI runner or forwarded to the running strategy via the environment section of the root docker-compose.yaml. All application variables have sensible defaults that match the dev compose files, so the stack works out of the box with zero configuration.

Application Variables

These variables are read by src/config/params.ts using process.env. The defaults shown below are the compiled fallback values — they match the credentials used by the bundled compose files.
CC_POSTGRES_CONNECTION_STRING
string
Full libpq-style connection string for the PostgreSQL database (or Pgpool-II endpoint). Change the host to host.docker.internal when running the app inside Docker while the database is on the host.
CC_REDIS_HOST
string
default:"127.0.0.1"
Hostname or IP address of the Redis server. Use host.docker.internal when the app runs inside a Docker container.
CC_REDIS_PORT
number
default:"6379"
TCP port on which Redis is listening.
CC_REDIS_USER
string
default:"default"
Redis ACL username. The bundled docker/redis/docker-compose.yaml uses the built-in default user.
CC_REDIS_PASSWORD
string
default:"mysecurepassword"
Password for the Redis connection. Must match the --requirepass value set in the Redis compose file.

Docker / CLI Variables

These variables are passed through to the backtest-kit CLI runner via the environment block of the root docker-compose.yaml. They control execution mode, strategy selection, and optional features. None of them have hard-coded defaults in the compose file — the runner provides its own defaults when they are unset.
VariableValues / ExampleDescription
MODEbacktest | live | paperExecution mode for the strategy runner.
STRATEGY_FILE./build/index.cjsPath (relative to /workspace) to the compiled strategy bundle.
ENTRY1Set to 1 to actually start execution. Without this, the container starts but the runner remains idle.
SYMBOLBTCUSDTOverride the trading symbol defined inside the strategy file.
STRATEGYmyStrategyOverride the strategy name defined inside the strategy file.
EXCHANGEbinanceOverride the exchange name defined inside the strategy file.
FRAME1hOverride the candlestick frame defined inside the strategy file.
UI1Enable the web UI served on port 60050.
TELEGRAM1Enable Telegram trade notifications (requires bot token configured inside the strategy).
VERBOSE1Enable verbose structured logging throughout the runner and persistence layer.
NO_CACHE1Disable Redis caching entirely — all reads go directly to PostgreSQL.
NO_FLUSH1Skip the Redis cache flush that normally runs on startup. Useful when you want to preserve a warm cache across restarts.

Pgpool Cluster Variables

These variables are set in docker/pgpool/docker-compose.yaml and are read by the tripolskypetr/pgpool:latest container entrypoint. They configure the PostgreSQL application role, the streaming-replication role, and internal filesystem paths.
POSTGRES_USER
string
default:"backtest"
The application database role. This must match the username in CC_POSTGRES_CONNECTION_STRING.
POSTGRES_PASSWORD
string
default:"mysecurepassword"
Password for POSTGRES_USER. Must match the password in CC_POSTGRES_CONNECTION_STRING.
POSTGRES_DB
string
default:"backtest-pro"
The database to create and connect to. Must match the database name in CC_POSTGRES_CONNECTION_STRING.
REPL_USER
string
default:"replicator"
Internal PostgreSQL role used exclusively for streaming replication between the primary and replicas. The application never connects as this user.
REPL_PASSWORD
string
default:"replicatorpass"
Password for REPL_USER. Change this in production; it is never exposed outside the container network.
PGCLUSTER_ROOT
string
default:"/var/lib/pgcluster"
Root data directory inside the container where the primary and replica data directories are stored. Bind-mounted to ./data on the host.
PGBIN
string
default:"/usr/local/bin"
Directory containing the PostgreSQL binary executables (pg_basebackup, pg_ctl, psql, etc.) inside the container. Rarely needs changing.

Example .env File

The .env.example file in the repository root shows the minimal overrides needed when running the app inside Docker (i.e. when the databases are on the host):
# .env.example
CC_REDIS_HOST=host.docker.internal
CC_POSTGRES_CONNECTION_STRING=postgres://backtest:mysecurepassword@host.docker.internal:5432/backtest-pro
Copy this to .env before running docker-compose up. When running Node.js directly on the host, you can omit the file entirely and rely on the defaults.

Production Override Example

To point the application at a remote PostgreSQL server and Redis instance, export the relevant variables before starting the process (or add them to your deployment environment):
export CC_POSTGRES_CONNECTION_STRING=postgres://backtest:mysecurepassword@prod-postgres:5432/backtest-pro
export CC_REDIS_HOST=prod-redis
export CC_REDIS_PORT=6379
export CC_REDIS_PASSWORD=your-secure-password
For Docker deployments, add these to the env_file or the environment block in your production compose override file.
All CC_* application variables have defaults that exactly match the credentials in the bundled dev compose files. This means you can clone the repo, run docker-compose -f docker/pgpool/docker-compose.yaml up -d and docker-compose -f docker/redis/docker-compose.yaml up -d, and then node build/index.cjs — no .env file required at all for host-side development.

Build docs developers (and LLMs) love