Environment Variables Reference
This page groups the most important environment variables by area.
Application
APP_URL- public app URL.HOST/PORT- HTTP binding for app process.NODE_ENV-developmentorproduction.NEXTAUTH_SECRET- required for session/token security.NEXTAUTH_URL- public URL used by auth callbacks.
Per-User Settings in Redis
TradeJS also stores account-specific settings in the Redis user record (users:index:<user>):
BYBIT_API_KEYBYBIT_API_SECRETtokenOPENAI_API_KEYOPENAI_API_ENDPOINTTG_BOT_TOKENTG_CHAT_ID
The web app manages these values from the account settings drawer opened by the gear icon in the left sidebar.
Data Services
REDIS_HOST,REDIS_PORTPG_HOST,PG_PORT,PG_USER,PG_PASSWORD,PG_DATABASEML_GRPC_ADDRESS(for runtime inference)
ML Training
ML_TRAIN_RECENT_DAYSML_TRAIN_TEST_DAYSML_TRAIN_WALK_FORWARD_FOLDSML_TRAIN_FEATURE_PROFILE(allorrobust)ML_TRAIN_FEATURE_SET(legacyorenriched)ML_TRAIN_ENSEMBLEML_TRAIN_ENSEMBLE_MEMBERS
Practical Recommendations
- Keep
.env.examplesafe and generic; never commit secrets. - In production, inject secrets from a secret manager.
- For local setup, run
npx @tradejs/cli infra-initonce, thennpx @tradejs/cli infra-up. - Validate environment with
npx @tradejs/cli doctorbefore enabling live orders. - Prefer the account settings drawer for user-scoped API keys and tokens instead of sharing one global
.envsecret across operators. OPENAI_*andTG_*are not app environment variables anymore; store them on the user record in Redis.