Environment variables

Complete reference for Forven's environment variables — startup, paths, the mainnet gate, auth, encryption, AI, the bot sandbox, integrations, backups, launcher flags, and runtime tuning, with meanings and defaults.

Forven reads environment variables to control where it stores data, which ports it binds, whether real-funds (mainnet) orders are ever allowed, how the local HTTP API is secured, and a handful of advanced tuning knobs. This page is the reference: each variable, what it does, and its default.

Most users never set these. Nearly all configuration lives in the app's Settings. Reach for an environment variable only when you need a non-default port or data location, are hardening a deployment beyond localhost, are wiring an integration, or are pinning a value so the UI can't change it.

How variables are resolved

Environment variables sit at the top of Forven's configuration precedence:

env var  >  in-app settings (KV store)  >  config.json  >  built-in default

So an environment variable always wins over the same value set in the app or in the configuration file. If a setting "won't stick" in the UI, check for an environment override first.

The backend does not read a .env file by itself; the launcher is what puts variables into its environment:

  • macOS / Linux: start_all.sh loads .env from the repository root if it exists. Copy .env.example to .env and edit it.
  • Windows: start_all.ps1 reads variables from the shell that runs it. It does not load .env.

On Windows, set a variable for the current PowerShell session:

$env:FORVEN_PORT = "8003"
$env:FORVEN_BIND_HOST = "127.0.0.1"
.\start_all.ps1

To make a value stick across sessions on Windows, store it as a user environment variable and open a new terminal:

[Environment]::SetEnvironmentVariable("FORVEN_PORT", "8003", "User")

Startup & paths

VariableMeaningDefault
FORVEN_HOMERoot directory for app state: forven.db, forven_lab.db, config.json, auth.json, workspace/, and backups/. A legacy .juddex / .judex home is merged in on first run.~/.forven
FORVEN_PORTPort the FastAPI backend binds. A startup guard detects port collisions.8003
FRONTEND_PORTPort for the web UI (start_all.sh only; start_all.ps1 uses 5173 and falls back to a free port if it is taken).5173
FORVEN_BIND_HOSTHost the backend binds to. FORVEN_HOST is accepted as an alias. See API authentication before changing it.127.0.0.1
FORVEN_CLIENT_BASEAPI base URL used for internal calls and the allowed-origin list. The launchers set it from the port.http://127.0.0.1:8003
FORVEN_DATA_DIRDirectory for OHLCV Parquet files. The other market-data streams (funding, open interest, derivatives, macro) live beside it, in its parent directory.FORVEN_HOME/data/ohlcv when FORVEN_HOME is set in the environment; otherwise data/ohlcv in the repository
FORVEN_FRONTEND_DIRPath to a prebuilt web UI bundle. If set and present, the backend serves it at /.(unset)

FORVEN_HOME is the single most important variable: point it at a different directory to run an isolated second instance or to relocate your data. Keep FORVEN_DATA_DIR and FORVEN_HOME consistent — if they disagree, the backend logs a prominent startup error, because enrichment data (funding, open interest, macro) would be read from the wrong place.

Safety: the mainnet gate & execution mode

FORVEN_ALLOW_MAINNET is the one variable that decides whether Forven can ever place a real-funds order. Treat it as the load-bearing safety surface.

VariableMeaningDefault
FORVEN_ALLOW_MAINNETMust be 1 to permit real-funds (mainnet) orders. Default-deny: the exchange layer refuses any order that resolves to mainnet unless it is set. Reduce-only exits and protective stops are always allowed, so you can always get out. There is no UI control for it.0
FORVEN_EXECUTION_MODEpaper or live. A global label shown in the app, kept for compatibility. It does not decide whether orders are real: a strategy's stage does (see below). Beyond the label it only feeds a few fallbacks, such as the network used when no testnet setting is saved. The in-app and API switch accept paper only.paper
FORVEN_ENVOptional deployment-channel flag. Setting it to beta adds a hard lock that forces the execution mode to paper regardless of other settings.(unset)

What actually sends orders to HyperLiquid is a strategy at the Live stage (live_graduated) or a Bot Factory bot armed live. Paper-stage strategies fill locally, inside Forven, and never place an order. Those live orders go to testnet unless you switch Settings → HyperLiquid → Hyperliquid testnet off (a change that needs a typed LIVE to save) and set FORVEN_ALLOW_MAINNET=1.

Paper is the supported mode and the default. There is no supported live / mainnet path. Reaching a real-money order takes a strategy you promote to Live with a typed GO LIVE, the testnet setting turned off, FORVEN_ALLOW_MAINNET=1, and mainnet agent-wallet credentials. It is unsupported and entirely at your own risk. See Execution modes and Going live safely.

The public site sometimes calls the paper stage a candidate strategy; in the app and in these variables it is always paper.

API authentication

Forven's local HTTP API binds to 127.0.0.1 and is unauthenticated unless you set keys. On loopback that is safe for a single user. For anything else, set both keys. See the REST & WebSocket API for endpoint groups and headers.

VariableMeaningDefault
FORVEN_API_KEYIf set, every /api/* request must carry this key (header x-api-key or Authorization: Bearer). /api/health, /api/webhooks/*, and the loopback-only /api/shutdown are exempt.(unset — no auth)
FORVEN_OPERATOR_KEYSecond, higher-privilege key (header x-operator-key) for operator routes: trading and system controls, promotions, updates, agent tools, MCP servers, and most write operations.(unset — no auth)
VITE_FORVEN_API_KEY, VITE_FORVEN_OPERATOR_KEYThe same keys, handed to the web UI so the browser sends them. Set them to match when auth is on.(unset)
FORVEN_AUTH_REQUIREDWhen true, the backend refuses to start unless both keys are set.false
FORVEN_ALLOWED_HOSTSExtra Host header values to accept (comma-separated) — a DNS-rebinding guard.loopback names only
FORVEN_CORS_ORIGINSComma-separated origins allowed to call the API from a browser.the local UI origins
FORVEN_CSRF_PROTECTCross-site request protection for state-changing calls. false is an escape hatch for an unusual front end whose origin cannot be listed in FORVEN_CORS_ORIGINS.on
FORVEN_RATE_LIMIT_ENABLEDPer-client request rate limiting (health and WebSocket paths are exempt).1
FORVEN_RATE_LIMIT_DEFAULTThe default limit.600/minute

Two guards fail closed:

  • Non-loopback bind. If FORVEN_BIND_HOST (or FORVEN_HOST) is anything other than a loopback address, the backend refuses to start unless both FORVEN_API_KEY and FORVEN_OPERATOR_KEY are set. The API can run code and manage orders; it is never exposed to a network unauthenticated.
  • FORVEN_AUTH_REQUIRED=true turns the startup warning about missing keys into a hard failure.
$env:FORVEN_API_KEY = "<a-long-random-string>"
$env:FORVEN_OPERATOR_KEY = "<a-different-long-random-string>"
$env:VITE_FORVEN_API_KEY = $env:FORVEN_API_KEY
$env:VITE_FORVEN_OPERATOR_KEY = $env:FORVEN_OPERATOR_KEY
$env:FORVEN_AUTH_REQUIRED = "true"

Encryption & secrets

Forven encrypts provider keys and exchange credentials at rest with Fernet symmetric encryption.

VariableMeaningDefault
FORVEN_ENCRYPTION_KEYExplicit Fernet key for secrets. If unset, Forven generates one on first use.(auto-generated)

The generated key lives at %LOCALAPPDATA%\Forven\.forven_key on Windows ($XDG_CONFIG_HOME/forven/.forven_key or ~/.config/forven/.forven_key elsewhere) — deliberately outside FORVEN_HOME and outside cloud-synced folders. A key left over in FORVEN_HOME by an older version is migrated there. Forven refuses to generate a fresh key when encrypted data already exists, because a new key would orphan every saved credential.

Your encrypted credentials (auth.json under FORVEN_HOME) and the key that decrypts them live in different places. Back them up together, or set FORVEN_ENCRYPTION_KEY explicitly so the key is reproducible.

HyperLiquid credentials

These supply exchange credentials as a fallback for the encrypted in-app settings. They matter for Live-stage strategies and live-armed bots — paper fills never place an exchange order. Full setup is on the HyperLiquid integration page; keys stay on your machine.

VariableMeaningDefault
FORVEN_HL_API_KEYHyperLiquid API key.(unset)
FORVEN_HL_API_SECRETHyperLiquid API secret (the API/agent wallet's private key).(unset)
FORVEN_HL_WALLET_ADDRESSYour main wallet address.(unset)
FORVEN_HL_USE_TESTNETtrue for testnet, false for mainnet.true
FORVEN_HL_ALLOW_MASTER_KEYForven refuses live mainnet trading with a withdrawal-capable master-account key; the safe setup is a separate API/agent wallet. 1 overrides that refusal. Don't.(unset)
FORVEN_HL_DISABLE_ENCRYPTION1 reads a legacy plaintext settings.json without a key file.0
FORVEN_HL_CREDS_PATHDirectory of a legacy file-based credential store.(legacy default)

Credentials resolve from the encrypted in-app settings (Settings → HyperLiquid) first, then these variables, then the legacy file store. Once the in-app settings exist they win, including the Hyperliquid testnet toggle. Turning testnet off does not permit real-funds orders on its own — FORVEN_ALLOW_MAINNET=1 is the separate, explicit gate.

AI, agents & strategy code

VariableMeaningDefault
FORVEN_BACKUP_AI_PROVIDERPins the backup provider used when the primary provider's credentials are unusable. none disables it. Normally set in the app.none
FORVEN_BACKUP_AI_MODELModel id for the backup provider. Empty uses that provider's default.(empty)
FORVEN_ENABLE_SHELL_TOOLAllows agents a raw shell tool. Off by default: subprocess execution mixed with tool calling and web-ingested content is a prompt-injection risk. At your own risk.0
FORVEN_SHELL_STRICT_ALLOWLISTWhen the shell tool is on, restricts it to a vetted list of programs.1
FORVEN_ISOLATED_STRATEGY_EXECRuns your own custom strategies' signal code in the locked-down worker (no database, network, or secrets). Imported strategies always run there. See the safety guard.off
FORVEN_ALLOW_LOCAL_MCPLets an agent tool server use an http URL on localhost or a private network. Cloud metadata addresses stay blocked.(unset)
FORVEN_AGENT_TASK_TIMEOUT_SECONDSDefault timeout for an agent task, when none is saved in settings.(built in, per task type)

API keys for model providers are not environment variables — connect providers on the Agents page (Setup → Providers), where they are encrypted at rest.

Bot sandbox (Windows)

VariableMeaningDefault
FORVEN_BOT_SANDBOXOn Windows, Bot Factory bots run in a low-integrity sandbox: they can use ~\.forven, the local API and the internet, but cannot write Forven's code or your user profile, or read the master key or .env files. 0 turns the sandbox off. It has no effect on other platforms.on (Windows)

Run python -m forven bot-sandbox to prepare and check the sandbox. If it is unusable on your machine, bots start without it and the bot's activity log says why.

Regime gate

The direction × regime gate is normally configured on the risk page or in Settings → Trading → Regime gating. These override it.

VariableMeaningDefault
FORVEN_REGIME_GATE_MODEoff, observe (log would-be blocks only), or enforce.observe
FORVEN_REGIME_GATE_BLOCK_LONGComma-separated regimes in which long entries are vetoed.TREND_DOWN,HIGH_VOL
FORVEN_REGIME_GATE_BLOCK_SHORTComma-separated regimes in which short entries are vetoed.(none)
FORVEN_REGIME_GATE_MIN_CONFIDENCEClassifier confidence below which a hostile regime is not acted on (0–1).0.6

Integrations & updates

VariableMeaningDefault
DISCORD_TOKENDiscord bot token. Needed only when START_BOT=1.(unset)
DISCORD_WEBHOOK_URLA Discord webhook URL (https://discord.com/api/webhooks/…). With no bot token, every notification that goes to Discord is posted to that one channel, labelled with where it was meant to go ("Forven · alerts"). Overrides the webhook saved in Settings → Notifications → Discord transport.(unset)
POLYGON_API_KEYPolygon.io key for market data. Overrides the key saved in Settings → System → Data source API keys.(unset)
FORVEN_UPDATE_REMOTEGit remote the in-app updater fast-forwards from. See Updating & backups.origin
FORVEN_UPDATE_BRANCHBranch the in-app updater tracks.main
FORVEN_GITHUB_WEBHOOK_SECRETHMAC secret that enables the /api/webhooks/github auto-pull endpoint. For development setups; leave unset unless you need it.(unset)
FORVEN_GITHUB_WEBHOOK_BRANCHBranch the webhook pulls.main
FORVEN_GITHUB_WEBHOOK_REMOTERemote the webhook pulls from.origin
FORVEN_GITHUB_WEBHOOK_REPOPath of the local checkout to update.(unset)
FORVEN_GITHUB_WEBHOOK_POST_PULL_CMDOptional command run after a successful pull, such as a service restart.(unset)

MCP server

The MCP server is a separate process spawned by your MCP client, so these go in the client's env block, not the backend's environment.

VariableMeaningDefault
FORVEN_API_URLBackend the MCP server calls.http://127.0.0.1:8003
FORVEN_MCP_TIMEOUTHTTP timeout in seconds. Raise it for slow cold-cache backtests.60
FORVEN_API_KEY, FORVEN_OPERATOR_KEYThe backend's keys, when auth is on.(unset)

Backups & logs

VariableMeaningDefault
FORVEN_DB_BACKUP_RETENTIONSnapshots to keep, overriding every per-reason window at once.7 daily, 3 pre-migration, 3 for anything else
FORVEN_DB_BACKUP_MAX_TOTAL_BYTESCeiling on the whole backups folder; the oldest snapshots are pruned past it.the larger of 2 GiB or 6× the database size
FORVEN_LOG_MAX_BYTESSize at which a log file rotates.52428800 (50 MiB)
FORVEN_LOG_BACKUP_COUNTRotated log files kept alongside the live one.3

First-run seeding

These control what a fresh FORVEN_HOME is seeded with on its first launch. Most users never set them. See Running from source.

VariableMeaningDefault
FORVEN_DEFAULT_ENVA .env template copied to FORVEN_HOME/.env on first launch, if none exists.(unset)
FORVEN_DEFAULT_SEED_DATAA seed folder (containing ohlcv/<SYMBOL>/*.parquet) copied into FORVEN_HOME/data/ohlcv on first launch, so charts have data immediately. Needs FORVEN_HOME set. The repository's packaging/config/seed_data holds a small BTC and ETH sample at 1h, 4h, and 1d.(unset)
FORVEN_DISABLE_CHROMA_IN_PROCESSTurns off the in-process vector store used for Bot Factory bot memory — a Windows stability workaround. Bot processes set it automatically on Windows; 0 overrides.(auto on Windows)

Launcher flags

The launch scripts read these to decide which processes to start. The defaults differ by script, so check which one you run.

VariableMeaningstart_all.ps1Windows launcherstart_all.sh
START_BOT1 starts the Discord bot.001
START_DAEMON1 starts the standalone data/risk daemon. The backend already hosts the daemon loop in-process, so this is optional; a standalone daemon takes over when running.010
FORCE_RESTART1 restarts services even if they are healthy.001
BACKEND_WORKERSBackend worker processes.112
DETACH_SERVICES1 keeps services running after the script exits.00—
SHOW_CHILD_WINDOWS1 shows each service's console window.00—
START_LAB_WORKER1 starts the optional Regime Lab worker.00follows FORVEN_ENABLE_REGIME_LAB
FORVEN_ENABLE_REGIME_LABEnables the optional Regime Lab worker and its UI.000

"Windows launcher" means ForvenLauncher.exe / Forven Launcher.vbs (see Installing Forven); start_all.bat uses the same daemon default. START_BOT=1 without DISCORD_TOKEN skips the bot with a warning.

Runtime tuning (advanced)

You rarely need these. They size worker pools and timeouts; the defaults suit a desktop machine, and most have an in-app equivalent set by the throughput preset.

VariableMeaningDefault
FORVEN_HEADLESS_AGENT_CONCURRENCYAgent worker pool size (1–8).3
FORVEN_HEADLESS_BRAIN_LIMITBrain worker task limit (1–8).2
FORVEN_API_RUNTIME_THREAD_MODEtrue runs the scheduler, agent, brain, and daemon loops on their own threads; false runs them as tasks on the event loop.true
FORVEN_API_RUNTIME_START_DELAY_SECONDSDelay before background loops start, to let the database initialize (0–60).5.0
FORVEN_BACKTEST_PROCESS_ISOLATIONRuns backtests in timed-out subprocesses so a misbehaving strategy can't freeze the backend.on
FORVEN_BACKTEST_SUBPROCESS_BUDGETPins the process-wide cap on concurrent backtest subprocesses (1–8), overriding the throughput preset.(from preset)
FORVEN_CPU_PRIORITYCPU priority tiers: the live scanner and paper trading keep normal priority, gauntlet steps and research backtest subprocesses run below normal, and the agent task loop lower still. Best effort — if the OS refuses, the work stays at normal priority. off runs everything at normal priority.on
FORVEN_GAUNTLET_DRAIN_WORKERSPins how many gauntlet jobs drain in parallel (1–8).(from settings)
FORVEN_OPTIMIZATION_MAX_WORKERSParameter-optimization pool (1–4).2
FORVEN_ROBUSTNESS_MAX_WORKERSRobustness-test pool (1–8).5
FORVEN_ROBUSTNESS_TIMEOUT_SECSPer-run robustness timeout (min 60).600
FORVEN_DATA_AUTOBACKFILLFetches missing history automatically when a run needs it.on
FORVEN_DROPZONE_IDLE_TTL_HOURSIdle time after which an AI Drop Zone session auto-closes (min 0.25).6
FORVEN_MAX_UPLOAD_BYTESMaximum CSV upload size; larger uploads get 413.52428800 (50 MiB)

Verifying your settings

After setting variables, confirm the backend picked them up:

  1. Start Forven with the launcher (start_all.ps1 on Windows, start_all.sh on macOS/Linux).
  2. Open http://127.0.0.1:8003/api/health — it returns a health payload with no auth required.
  3. Open Diagnostics in the app for the health checks, and look at the control strip at the top of any page: with nothing at the Live stage it reads Mode: PAPER and a TESTNET badge. Live ×N means N strategies or bots can send real orders.
  4. If you set auth keys, confirm that a request without the key is rejected with 401.

Caveats

  • Env always wins. A value set here overrides the same key in the app or config.json.
  • Windows doesn't read .env. Set variables in the shell, or as user environment variables.
  • Live/mainnet is unsupported. Paper is the supported mode. Setting FORVEN_ALLOW_MAINNET=1 and promoting a strategy to Live is at your own risk.
  • Secrets and their key can diverge. Back up FORVEN_HOME/auth.json together with the encryption key, or pin it with FORVEN_ENCRYPTION_KEY.
  • Exposing the API needs both keys. A non-loopback bind without them refuses to start, by design.

Forven is a research tool. Nothing here is financial advice, paper results are not predictive of live results, and any numbers in the app are illustrative of process — not a forecast of profit.