Skip to content

Environment Variables

Complete reference for all backend and frontend env vars. Only JWT_SECRET and one AI provider key are required to get started — everything else has sensible defaults.

Backend (backend/.env)

AI Provider

VariableDefaultDescription
AI_PROVIDERauto-detectForce: anthropic, openai, google, or local
ANTHROPIC_API_KEYconsole.anthropic.com
ANTHROPIC_MODELclaude-sonnet-4-20250514Override Anthropic model
OPENAI_API_KEYplatform.openai.com
OPENAI_MODELgpt-4o-miniOverride OpenAI model
GOOGLE_API_KEYaistudio.google.com
GOOGLE_MODELgemini-2.5-flashOverride Google model
OLLAMA_BASE_URLhttp://localhost:11434Ollama server URL
OLLAMA_MODELmistral:7bModel name for local inference
OLLAMA_MAX_PREDICT4096Max output tokens for Ollama
OLLAMA_TIMEOUT_MS120000Timeout for Ollama calls (ms)

Demo Mode

VariableDefaultDescription
DEMO_GOOGLE_API_KEYPlatform-owned Gemini API key for zero-config trial. When set, users without their own AI key can try Sentri immediately using the shared key, subject to per-user daily quotas
DEMO_DAILY_CRAWLS2Max crawls per user per day in demo mode
DEMO_DAILY_RUNS3Max test runs per user per day in demo mode
DEMO_DAILY_GENERATIONS5Max AI test generations per user per day in demo mode

LLM Retry & Tokens

VariableDefaultDescription
LLM_MAX_RETRIES3Retry count for rate-limited AI calls
LLM_BASE_DELAY_MS2000Base delay for exponential backoff (ms)
LLM_MAX_BACKOFF_MS30000Max backoff delay (ms)
LLM_MAX_TOKENS16384Max output tokens per AI call

Server

VariableDefaultDescription
PORT3001Backend server port
NODE_ENVSet to production for production deployments
DB_PATHdata/sentri.dbSQLite database file path (ignored when DATABASE_URL is set)
CORS_ORIGIN*Frontend origin(s) for CORS, comma-separated. Required in production
SHUTDOWN_DRAIN_MS10000Max time (ms) to wait for in-flight runs during graceful shutdown
SPA_INDEX_PATHauto-detectPath to the Vite-built index.html for CSP nonce injection (SEC-002). Only needed when the frontend dist is not at the default location relative to the backend source. In Docker multi-container deployments, set to the shared volume path (e.g. /usr/share/frontend/index.html)

Database & Infrastructure

VariableDefaultDescription
DATABASE_URLPostgreSQL connection string (e.g. postgres://user:pass@host:5432/db). When set, uses PostgreSQL instead of SQLite. Requires pg + pg-native (or deasync as fallback)
PG_POOL_SIZE10Max PostgreSQL connection pool size (ignored for SQLite)
REDIS_URLRedis connection URL (e.g. redis://localhost:6379). When set, enables shared rate limiting, cross-instance token revocation, SSE pub/sub, and BullMQ job queue. Requires ioredis. For Redis-backed rate limiting also install rate-limit-redis
MAX_WORKERS2Global concurrency limit for BullMQ run execution (INF-003). Each slot processes one crawl or test run at a time. Ignored when Redis/BullMQ is not available

Local Redis setup

Redis is optional for local development — without it, Sentri uses in-memory stores for rate limiting, token revocation, and SSE. To enable Redis locally:

bash
# macOS (Homebrew)
brew install redis && redis-server

# Or via Docker (any platform)
docker run -d --name sentri-redis -p 6379:6379 redis:7-alpine

Then in backend/.env:

bash
REDIS_URL=redis://localhost:6379

Install the required npm packages:

bash
cd backend
npm install ioredis rate-limit-redis

Local BullMQ setup

BullMQ provides durable job queue execution for crawls and test runs (INF-003). Without it, runs execute in-process — which is fine for local development but means runs are lost if the server crashes mid-execution.

To enable BullMQ locally, ensure Redis is running (see above), then:

bash
cd backend
npm install bullmq

BullMQ is detected automatically when both REDIS_URL is set and the bullmq package is installed. Set MAX_WORKERS to control how many runs can execute concurrently (default: 2).

Email (Transactional)

VariableDefaultDescription
RESEND_API_KEYResend API key for transactional email (recommended)
SMTP_HOSTSMTP server host (alternative to Resend)
SMTP_PORT587SMTP server port
SMTP_SECUREfalseUse TLS for SMTP connection
SMTP_USERSMTP username
SMTP_PASSSMTP password
EMAIL_FROMSentri <noreply@sentri.dev>Sender address for all transactional emails
SKIP_EMAIL_VERIFICATIONfalseWhen "true", new users are auto-verified on registration. Dev/CI only — never set in production

Auth & Security

VariableDefaultDescription
JWT_SECRETrandom (dev)Required in production. 32+ char secret for signing JWTs
CREDENTIAL_SECRETfalls back to JWT_SECRETEncryption secret for project credentials
ARTIFACT_SECRETrandom (dev)Required in production. Signs artifact URLs (screenshots, videos)
ARTIFACT_TOKEN_TTL_MS3600000Artifact URL token TTL (ms)
ENABLE_DEV_RESET_TOKENSfalseWhen "true", forgot-password response includes the reset token (dev/test only — never in production)
APP_URLhttp://localhost:3000Frontend base URL (used for OAuth redirects, email verification links, and notification deep links). Falls back to CORS_ORIGIN
APP_BASE_PATH/Frontend base path prefix (e.g. /sentri for GitHub Pages)
BACKEND_URLauto-detectBackend URL override for cross-origin cookie detection

Test Execution

VariableDefaultDescription
BROWSER_HEADLESStrueSet false to see the browser window
VIEWPORT_WIDTH1280Browser viewport width (px)
VIEWPORT_HEIGHT720Browser viewport height (px)
NAVIGATION_TIMEOUT30000Timeout for page.goto() calls (ms)
API_TEST_TIMEOUT30000Per-API-test timeout (ms)
BROWSER_TEST_TIMEOUT120000Per-browser-test timeout guard (ms)
PARALLEL_WORKERS1Concurrent browser contexts (1–10). Override per-run from UI
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATHCustom Chromium executable path

Crawler

VariableDefaultDescription
CRAWL_MAX_PAGES30Maximum pages to visit per crawl
CRAWL_MAX_DEPTH3Maximum link-follow depth from the start URL
CRAWL_NETWORKIDLE_TIMEOUT5000Timeout (ms) for networkidle wait after page load

Self-Healing

VariableDefaultDescription
HEALING_ELEMENT_TIMEOUT5000Element finding timeout per strategy (ms)
HEALING_RETRY_COUNT3Retries per interaction before giving up
HEALING_RETRY_DELAY400Pause between retries (ms)
HEALING_HINT_MAX_FAILS3Skip healing hints that have failed this many consecutive times
HEALING_VISIBLE_WAIT_CAP1200Max waitFor timeout per strategy in firstVisible (ms)

AI Chat

VariableDefaultDescription
MAX_CONVERSATION_TURNS20Max turn pairs kept in chat context
AI_CLASSIFY_THRESHOLD40Confidence threshold for AI-assisted intent classification (0–100)

Logging

VariableDefaultDescription
LOG_LEVELinfodebug, info, warn, or error
LOG_DATE_FORMATisoiso, utc, local, or epoch
LOG_TIMEZONEsystemIANA timezone for local format
LOG_JSONfalseEmit structured JSON logs

OAuth

VariableDescription
GITHUB_CLIENT_IDGitHub OAuth app client ID
GITHUB_CLIENT_SECRETGitHub OAuth app client secret
GOOGLE_CLIENT_IDGoogle OAuth client ID
GOOGLE_CLIENT_SECRETGoogle OAuth client secret
GOOGLE_REDIRECT_URIOverride Google OAuth redirect URI

Frontend (build-time)

VariableDefaultDescription
VITE_API_URL"" (same origin)Backend URL for cross-origin deploys
GITHUB_PAGESSet to true to use /sentri/ base path
VITE_GITHUB_CLIENT_IDGitHub OAuth client ID (passed to frontend)
VITE_GOOGLE_CLIENT_IDGoogle OAuth client ID (passed to frontend)

Released under the MIT License.