Skip to content

Environment Variables

Source of truth: the .env.example file in each app directory. This page collects them in one place for grep-ability. When the two disagree, the .env.example wins — please update this page in the same PR.

DATABASE_URL=postgresql://user:password@localhost:54320/weiqi_dev
PORT=3002
AUTH_SERVICE_URL=http://localhost:3004
CORS_ORIGINS=http://localhost:3001,https://game.weiqi.app
SITE_PARSER_CRON_PATTERN=0 3 * * *
NODE_ENV=development
RECOGNITION_SERVICE_URL=http://localhost:4010
AWS_S3_ENDPOINT=http://localhost:9000
AWS_S3_FORCE_PATH_STYLE=true
AWS_S3_BUCKET_NAME=weiqi.boards.local
AWS_S3_BUCKET_URL=http://localhost:9000/weiqi.boards.local
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=dev-access-key
AWS_SECRET_ACCESS_KEY=dev-secret-key
KeyPurpose
DATABASE_URLPostgres connection. Matches docker-compose.yml (port 54320).
PORTHTTP listen port. Default 3002.
AUTH_SERVICE_URLBase URL of auth-app. Used for session validation.
CORS_ORIGINSComma-separated allow-list.
SITE_PARSER_CRON_PATTERNStandard 5-field cron for the GoProblems sync job. Default daily at 03:00.
NODE_ENVdevelopment / production / test.
RECOGNITION_SERVICE_URLURL of recognition-service.
AWS_S3_*MinIO (dev) or real S3 (prod).
DB_CONNECTION_STRING=postgresql://auth_user:auth_password@localhost:5433/auth_dev
BETTER_AUTH_URL=http://localhost:3004
AUTH_DOMAIN=http://localhost:3004
NEXT_PUBLIC_AUTH_URL=http://localhost:3004
COOKIE_DOMAIN=localhost
BETTER_AUTH_SECRET=<openssl rand -hex 32>
GOOGLE_CLIENT_ID=<...>
GOOGLE_CLIENT_SECRET=<...>
RESEND_API_KEY=<...>
AWS_REGION=eu-central-1
AWS_S3_ENDPOINT=http://localhost:9000
AWS_S3_FORCE_PATH_STYLE=true
AWS_ACCESS_KEY_ID=dev-access-key
AWS_SECRET_ACCESS_KEY=dev-secret-key
AWS_S3_BUCKET_NAME=weiqi.accounts.local
AWS_S3_BUCKET_URL=http://localhost:9000/weiqi.accounts.local
BILLING_DOMAIN_NAME=Weiqi Billing
BILLING_DOMAIN_VERSION=1
PRO_UPGRADE_PRICE_WEI=10000000000000000
TOPUP_PRICE_PER_ENERGY_WEI=100000000000000
COMMON_DAILY_ENERGY=50
PRO_DAILY_ENERGY=1000
PRO_TIER_DURATION_DAYS=30
PRO_TIER_GRACE_DAYS=3
NONCE_TTL_SECONDS=900
BILLING_TREASURY_ADDRESS=0x1111111111111111111111111111111111111111

BETTER_AUTH_SECRET must be at least 32 chars and must not contain placeholder words like dev-secret. Generate with openssl rand -hex 32.

DATABASE_URL=postgresql://billing_user:billing_password@localhost:5435/billing_dev
BILLING_TREASURY_ADDRESS=0x0000000000000000000000000000000000000000
BASE_RPC_URL=
BASE_RPC_WSS_URL=
ETHEREUM_RPC_URL=
ETHEREUM_RPC_WSS_URL=
POLYGON_RPC_URL=
POLYGON_RPC_WSS_URL=
ARBITRUM_RPC_URL=
ARBITRUM_RPC_WSS_URL=
OPTIMISM_RPC_URL=
OPTIMISM_RPC_WSS_URL=
AUTH_APP_WEBHOOK_URL=http://localhost:3004/api/internal/billing/webhook
BILLING_INDEXER_WEBHOOK_PRIVATE_KEY=<32-byte hex>
BILLING_INDEXER_KEY_ID=local-key-1
BILLING_WEBHOOK_TIMEOUT_MS=5000
BILLING_WEBHOOK_MAX_ATTEMPTS=6
BILLING_INDEXER_START_BLOCK_8453=12000000
BILLING_INDEXER_START_BLOCK_84532=5000000
BILLING_INDEXER_START_BLOCK_1=0
BILLING_INDEXER_START_BLOCK_137=0
BILLING_INDEXER_START_BLOCK_42161=0
BILLING_INDEXER_START_BLOCK_10=0
PORT=9090

Per-chain RPC URLs are optional; leave blank to skip a chain.

PORT=4011
GRPC_PORT=50051
KATAGO_PATH=katago
KATAGO_MODEL_PATH=
KATAGO_CONFIG_PATH=
QUEUE_MODE=none
REDIS_URL=redis://localhost:6379

Set QUEUE_MODE=bullmq when running multiple weiqi-server replicas that need to share a KataGo budget.

MCP_ENABLED=true
MCP_TRANSPORT=http
MCP_PORT=3003
MCP_API_KEY=
WEIQI_URL=http://localhost:3002
WEIQI_TIER=pro
AUTH_APP_URL=http://localhost:3004
ADMIN_EMAIL=admin@admin.local
ADMIN_PASSWORD=admin
ADMIN_NAME=AI Bridge Test User

MCP_ENABLED=false makes the process exit without binding any port — use this in prod-by-default deployments.

PORT=4010
REDIS_URL=redis://localhost:6379

The model URL, input size, and threshold are hard-coded in src/adapters/inference/moku-v3.constants.ts.

PUBLIC_GA_MEASUREMENT_ID=

Leave empty in dev/preview to disable Google Analytics loading entirely. PUBLIC_* keys are inlined into the client bundle at build time.

VITE_SERVER_URL=http://localhost:3012
VITE_AUTH_SIGNIN_URL=https://accounts.weiqi.app/auth/sign-in
# VITE_RECOGNITION_URL=http://localhost:4010 # optional direct bypass

VITE_SERVER_URL is the weiqi-server base URL. VITE_AUTH_SIGNIN_URL points at the Better-Auth sign-in page.

These are not in any .env.example. They live in the deploy secret store (GitHub Secrets / Cloudflare Pages dashboard):

  • CLOUDFLARE_API_TOKEN — Pages deploy token.
  • CLOUDFLARE_ACCOUNT_ID — account holding the Pages projects.
  • *_ENV (per app) — the contents of the app’s .env file, piped in by the deploy workflow.