settlekit/.env.example
caelum0x 1d92fa23f2 feat: branded hosted storefront per merchant (G12)
Merchants can publish a store (slug, title, tagline, https logo, accent
colour, search description, optional custom domain) through settings or
the dashboard. The checkout app serves it at /store/<slug> with SEO and
Open Graph metadata, listing active products (invoice products hidden)
that each open their payment link, and a middleware rewrites '/' on a
merchant's custom domain to its store when CHECKOUT_PRIMARY_HOSTS is set.
Slugs and domains are unique; public data at /v1/public/stores. Carts of
several products stay out of scope because hosted checkout fulfils one
product per session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 06:32:06 +03:00

546 lines
26 KiB
Plaintext

# =============================================================================
# SettleKit environment configuration
# Copy to `.env` and fill in real values. Never commit a real .env file.
# =============================================================================
# --- Core ---------------------------------------------------------------------
# PostgreSQL connection string used by @settlekit/database.
DATABASE_URL=postgresql://settlekit:settlekit@localhost:5432/settlekit
# Listen port for the API (default 8787) and for Next apps started with -p $PORT.
PORT=8787
# --- Arc settlement (USDC chain) ----------------------------------------------
#
# Arc is Circle's stablecoin L1 (USDC is the native gas token). Set ARC_CHAIN_ID
# to enable on-chain settlement. For a KNOWN chain (Arc testnet = 5042002), the
# RPC URL and USDC/EURC/USYC addresses default from the bundled chain config, so
# ARC_CHAIN_ID is the only required var. Override RPC/USDC below for a private
# RPC (Alchemy/QuickNode) or a custom deployment.
#
# Arc testnet: chainId 5042002, RPC https://rpc.testnet.arc.network,
# USDC 0x3600…0000 (native gas), explorer testnet.arcscan.app, faucet faucet.circle.com.
# Numeric chain id for the Arc network (5042002 = Arc testnet).
ARC_CHAIN_ID=5042002
# Optional override of the JSON-RPC endpoint (defaults from the chain config).
# ARC_RPC_URL=https://rpc.testnet.arc.network
# Optional override of the USDC token contract (defaults from the chain config).
# Required only for an unknown ARC_CHAIN_ID.
# ARC_USDC_ADDRESS=0x3600000000000000000000000000000000000000
# --- Multi-chain payments (EVM stablecoins, Solana, Zcash) -------------------
#
# Every network FAILS CLOSED until enabled: a payment on a disabled network can
# never be confirmed. Chain ids, RPCs and token addresses come from the verified
# @settlekit/chains registry (see docs/colosseum/MULTICHAIN-PLAN.md).
#
# mainnet | testnet for every EVM chain (default testnet). Per-chain override:
# <KEY>_NETWORK. Keys: ethereum, base, arbitrum, robinhood, hyperevm, tempo, arc.
# SETTLEKIT_CHAIN_ENV=testnet
# Comma list of EVM chains to verify (BASE_RPC_URL / ARC_CHAIN_ID also enable
# Base / Arc for backwards compatibility).
# ENABLED_EVM_CHAINS=base,arbitrum,tempo
# Per-chain RPC (defaults to the registry's public RPC; use your own in prod,
# the public HyperEVM RPC is limited to 100 req/min/IP) and confirmation depth
# (defaults: ethereum 12, base/arbitrum/robinhood/arc 3, hyperevm/tempo 1).
# ETHEREUM_RPC_URL=
# ETHEREUM_NETWORK=
# ETHEREUM_MIN_CONFIRMATIONS=
# BASE_RPC_URL=
# BASE_NETWORK=
# BASE_MIN_CONFIRMATIONS=
# ARBITRUM_RPC_URL=
# ARBITRUM_NETWORK=
# ARBITRUM_MIN_CONFIRMATIONS=
# ROBINHOOD_RPC_URL=
# ROBINHOOD_NETWORK=
# ROBINHOOD_MIN_CONFIRMATIONS=
# HYPEREVM_RPC_URL=
# HYPEREVM_NETWORK=
# HYPEREVM_MIN_CONFIRMATIONS=
# TEMPO_RPC_URL=
# TEMPO_NETWORK=
# TEMPO_MIN_CONFIRMATIONS=
# <KEY>_TOKEN_ADDRESS overrides a token for local testing only; production
# refuses any value other than the registry address.
#
# Solana (mainnet | devnet); RPC and USDC mint default from the cluster.
# SOLANA_CLUSTER=devnet
# SOLANA_RPC_URL=
#
# Zcash: transparent t-addresses only, mainnet, verified via Blockchair
# (keyless tier: 1000 requests/day, 30/min). Quotes lock for ZCASH_QUOTE_TTL_SEC.
# ZCASH_ENABLED=false
# ZCASH_EXPLORER_URL=https://api.blockchair.com/zcash
# BLOCKCHAIR_API_KEY=
# ZCASH_MIN_CONFIRMATIONS=3
# ZCASH_QUOTE_TTL_SEC=900
# Worker: how often open Zcash sessions' addresses are polled (ms).
# WORKER_ZCASH_WATCH_INTERVAL_MS=90000
# --- Circle (Gateway / x402 payment rails) ------------------------------------
# Circle API key for Gateway and x402 paid-API settlement.
CIRCLE_API_KEY=test_circle_api_key_replace_me
# --- Circle developer-controlled wallets (real payout execution) --------------
#
# Used by POST /v1/payouts/:id/execute to move USDC from a SettleKit treasury
# wallet to a merchant. Set both API key + the funding wallet id to enable;
# unset leaves /execute returning a clear "not configured" error (settle via
# /paid instead). Use the W3S sandbox base URL for testnet.
# CIRCLE_WALLETS_API_KEY=TEST_API_KEY:...
# CIRCLE_WALLETS_WALLET_ID=<treasury wallet id>
# CIRCLE_WALLETS_BASE_URL=https://api-sandbox.circle.com
# RSA-encrypted entity secret ciphertext (Circle wants a fresh one per request;
# a static value suits low-volume/dev — prefer a per-call KMS provider in prod).
# CIRCLE_WALLETS_ENTITY_SECRET_CIPHERTEXT=
# CCTP cross-chain pay-in (/v1/cctp) polls Circle's Iris attestation API.
# Defaults to the testnet sandbox; override for mainnet (https://iris-api.circle.com).
# CCTP_IRIS_BASE_URL=https://iris-api-sandbox.circle.com
# --- Circle Gas Station (sponsored gas) + Circle Mint (mint/redeem) -----------
#
# Gas Station: enables POST/GET /v1/gas-station/policies for sponsoring user gas.
# (The /v1/paymaster/* config/permit/encode endpoints are permissionless and
# always available — Circle Paymaster is a permissionless ERC-4337 contract.)
# GAS_STATION_API_KEY=
# GAS_STATION_BASE_URL=https://api.circle.com
# GAS_STATION_POLICIES_PATH=/v1/w3s/gasStation/policies
#
# Circle Mint: enables /v1/mint + /v1/mint/redeem (treasury top-up / off-ramp).
# CIRCLE_MINT_API_KEY=
# CIRCLE_MINT_BASE_URL=https://api.circle.com
# --- Circle Compliance Engine (transaction screening) -------------------------
#
# When set, payout destination addresses are screened for sanctions/risk before
# funds move (POST /v1/payouts/:id/execute); a DENIED/sanctioned address is
# blocked with HTTP 403 compliance_blocked. Unset = pass-through (logged).
# COMPLIANCE_API_KEY=
# COMPLIANCE_BASE_URL=https://api.circle.com
# Circle chain to screen against for networks Circle does not list (e.g. Arc).
# Sanctions hits are address-scoped, so screening on a supported chain still
# catches them. Defaults to ETH.
# COMPLIANCE_DEFAULT_CHAIN=ETH
# --- Circle inbound webhooks (real-time payout settlement) --------------------
#
# POST /v1/circle/webhooks is a PUBLIC receiver authenticated by Circle's ECDSA
# signature (verified against the public key fetched with the wallets API key).
# It settles payouts in real time on transactions.* events (the worker
# payout-reconcile poll remains as a fallback). Requires CIRCLE_WALLETS_API_KEY
# (above) to fetch Circle's signature public keys; unset = receiver returns
# "not configured".
# --- GitHub (private repo + team access delivery) -----------------------------
# Numeric GitHub App id.
GITHUB_APP_ID=123456
# GitHub App private key (PEM). Use literal \n escapes or a single-line PEM.
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nREPLACE_WITH_REAL_KEY\n-----END RSA PRIVATE KEY-----"
# Secret used to verify inbound GitHub webhook signatures.
GITHUB_WEBHOOK_SECRET=replace_with_github_webhook_secret
# --- Discord (community / role access delivery) -------------------------------
# Bot token used to add/remove Discord roles on purchase (API, worker, checkout).
# Unset = Discord purchases show "pending setup"; roles are granted once set.
DISCORD_BOT_TOKEN=replace_with_discord_bot_token
# Checkout "Connect Discord" (OAuth2 identify + guilds.join). Register the
# redirect <CHECKOUT_PUBLIC_URL>/api/discord/callback in the Discord portal.
# DISCORD_CLIENT_ID=
# DISCORD_CLIENT_SECRET=
# Dashboard: shows the "add the bot to your server" link.
# NEXT_PUBLIC_DISCORD_CLIENT_ID=
# --- Email (transactional, via Resend) ----------------------------------------
# Resend API key for sending delivery/receipt emails.
RESEND_API_KEY=re_replace_with_resend_api_key
# From address for outbound transactional email.
EMAIL_FROM=SettleKit <no-reply@settlekit.example>
# --- File storage (S3 / Cloudflare R2 for digital downloads) ------------------
# S3/R2 region. For R2 use "auto".
S3_REGION=auto
# S3/R2 endpoint URL (omit for native AWS S3; required for R2).
S3_ENDPOINT=https://<accountid>.r2.cloudflarestorage.com
# Bucket holding sellable file assets.
S3_BUCKET=settlekit-files
# S3/R2 access credentials.
S3_ACCESS_KEY_ID=replace_with_access_key_id
S3_SECRET_ACCESS_KEY=replace_with_secret_access_key
# --- Webhooks -----------------------------------------------------------------
# Secret used to sign outbound webhook payloads (HMAC) so receivers can verify.
WEBHOOK_SIGNING_SECRET=replace_with_webhook_signing_secret
# --- Next.js apps -------------------------------------------------------------
# Public base URL of the SettleKit API, read by the browser-facing Next apps.
NEXT_PUBLIC_API_URL=http://localhost:8787
# Dashboard: hosted checkout base URL; payment links are <url>/l/<slug>.
NEXT_PUBLIC_CHECKOUT_URL=http://localhost:3000
# --- Platform fee (single source of truth) --------------------------------------
# Default: 1% per successful payment, no fixed fee. Defined once as
# DEFAULT_FEE_SCHEDULE in packages/platform-billing/src/fees.ts ({ bps: 100,
# fixed: "0" }). The API uses it unless PLATFORM_FEE_BPS / PLATFORM_FEE_FIXED
# are set; the landing/pricing pages (apps/web) default to the same values via
# NEXT_PUBLIC_PLATFORM_FEE_*. To change the fee, change the constant and set
# all four variables to the new values so the page matches what is charged.
# PLATFORM_FEE_BPS=100
# PLATFORM_FEE_FIXED=0
#
# --- Platform fee statements (SettleKit's own revenue) ---------------------------
# Buyers pay merchants' wallets directly, so the fee above is billed monthly: a
# statement invoice from SettleKit's own organization, paid through SettleKit's
# own checkout. Off (and nothing enforced) until PLATFORM_BILLING_ORG_ID is set.
# That org must finish payment setup (receiving wallets) in the dashboard.
# PLATFORM_BILLING_ORG_ID=org_settlekit
# PLATFORM_BILLING_DUE_DAYS=14 # due N days after the month ends
# PLATFORM_BILLING_GRACE_DAYS=14 # then free-plan product limits apply
# PLATFORM_BILLING_MIN_USD=1 # smaller totals roll into next month
# PLATFORM_BILLING_AUTORUN=1 # 0 = only POST /v1/billing/statements/run
#
# Public URL of the hosted checkout (invoice pay pages /i/<token>, receipt PDF
# links in receipt emails; API and worker). Falls back to NEXT_PUBLIC_CHECKOUT_URL.
# CHECKOUT_PUBLIC_URL=https://pay.example.com
NEXT_PUBLIC_PLATFORM_FEE_BPS=100
NEXT_PUBLIC_PLATFORM_FEE_FIXED=0
# API: extra organization ids hidden from the public /proof page (demo/test
# sellers; the bootstrap org and orgs flagged testAccount are always hidden).
# PROOF_EXCLUDED_ORGS=org_demo1,org_demo2
# =============================================================================
# Everything below is OPTIONAL for local dev — the API boots with none of it
# (in-memory clients + in-memory persistence). See docs/CONFIGURATION.md for the
# authoritative per-component reference, defaults, and value ranges.
# =============================================================================
# --- API: signing secrets (override in production!) ---------------------------
# HMAC secret used to sign license-key tokens. Must match the worker.
# Dev default: settlekit-dev-license-secret
LICENSE_TOKEN_SECRET=settlekit-dev-license-secret
# HMAC secret used to sign the sk_session auth cookie.
# Dev default: settlekit-dev-auth-cookie-secret
AUTH_COOKIE_SECRET=settlekit-dev-auth-cookie-secret
# --- API: runtime / identity --------------------------------------------------
# Static bootstrap Bearer key so the first authenticated call can mint real API
# keys. Leave unset once real keys exist. (read in middleware/auth.ts)
# API_BOOTSTRAP_KEY=dev_bootstrap_key
# When "production", the sk_session cookie is set Secure. (read in routes/auth.ts)
# NODE_ENV=production
# Merchant identity surfaced on invoices/receipts. (read in context.ts)
MERCHANT_NAME=SettleKit Merchant
# MERCHANT_EMAIL=billing@your-store.example
# MERCHANT_WEBSITE=https://your-store.example
# --- Arc settlement: tuning ---------------------------------------------------
# Confirmations required before a payment is treated as settled (1-1000).
ARC_MIN_CONFIRMATIONS=3
# --- Circle: optional override ------------------------------------------------
# Override the Circle API base URL (e.g. sandbox). Only used when CIRCLE_API_KEY set.
# CIRCLE_BASE_URL=https://api-sandbox.circle.com
# --- GitHub: installation -----------------------------------------------------
# Default installation id the API/worker authenticate as (required with the
# GITHUB_APP_* group above).
GITHUB_INSTALLATION_ID=12345678
# The checkout app reads GITHUB_APP_INSTALLATION_ID; the worker accepts either.
# Worker: how often pending GitHub entitlements from checkout are re-delivered
# once an installation id is configured (ms).
# WORKER_GITHUB_RETRY_INTERVAL_MS=120000
# --- File delivery: API process (FILE_DOWNLOAD_*) -----------------------------
# Base URL embedded in signed file-download links.
FILE_DOWNLOAD_BASE_URL=http://localhost:8787/v1/files/download
# HMAC secret used to sign file-download URLs. Override in production.
FILE_DOWNLOAD_SECRET=settlekit-dev-file-secret
# Default signed-link lifetime in seconds (60-2592000).
FILE_DOWNLOAD_EXPIRES_SEC=3600
# Default max downloads per signed link (1-10000).
FILE_DOWNLOAD_MAX_DOWNLOADS=3
# --- x402 paid API (in-process /v1/paid/*) ------------------------------------
# Destination USDC address advertised in the /v1/paid/research x402 challenge.
# Set to your real wallet to actually receive payment. (read in routes/x402.ts)
X402_PAY_TO=0x0000000000000000000000000000000000000000
# --- Agent payments: x402 v2 on every chain + MPP on Tempo (/v1/x402, /v1/mpp) -
# A network is offered only with a payTo + a facilitator. Remote (PayAI, no key)
# serves Solana/Base/Arbitrum; the self-hosted facilitator (relayer hot key)
# serves Ethereum/HyperEVM/Robinhood. Chain env follows SETTLEKIT_CHAIN_ENV,
# <KEY>_NETWORK and SOLANA_CLUSTER. See apps/api/src/agent-payments/config.ts.
# X402_EVM_PAY_TO=0x...
# X402_SOLANA_PAY_TO=
# X402_PAY_TO_HYPEREVM=0x... # per-network override
# X402_NETWORKS=solana,base,arbitrum,ethereum,hyperevm,robinhood
# X402_REMOTE_FACILITATOR_URL=https://facilitator.payai.network
# X402_REMOTE_FACILITATOR_API_KEY= # only for keyed facilitators (e.g. CDP)
# X402_RESEARCH_PRICE=0.01
# Self-hosted facilitator (@settlekit/x402-facilitator). Unset key = off.
# X402_RELAYER_PRIVATE_KEY=0x... # hot key: fund with gas only
# X402_FACILITATOR_NETWORKS=ethereum,hyperevm,robinhood
# X402_FACILITATOR_MAX_AMOUNT=100 # USD per settlement
# X402_FACILITATOR_ALLOWED_PAY_TO=0x... # recipients the relayer will settle to (default: X402_EVM_PAY_TO +
# # X402_PAY_TO_<CHAIN>; "*" = any recipient; empty = refuse all)
# Replay protection uses the x402_nonces table when DATABASE_URL is set (in-memory otherwise, dev only).
# X402_FACILITATOR_KILL=0 # 1 = refuse every verify/settle
# X402_FACILITATOR_TOKEN= # bearer for POST /v1/x402/facilitator/*
# X402_FACILITATOR_ALLOW_EXPERIMENTAL=0 # 1 = Tempo Permit2 / Robinhood testnet
# X402_GAS_MAX_FEE_ETHEREUM=3000000000000000 # native base units per settlement
# X402_GAS_DAILY_BUDGET_ETHEREUM=50000000000000000
# MPP on Tempo (mppx): USDC.e on mainnet, pathUSD on Moderato.
# MPP_SECRET_KEY= # >= 32 bytes, e.g. openssl rand -base64 32
# MPP_TEMPO_RECIPIENT=0x...
# TEMPO_NETWORK=mainnet
# --- Onchain billing (subscriptions, Base escrow, refunds) --------------------
# ONCHAIN_BILLING_OPERATOR_PRIVATE_KEY=0x... # EVM operator (pull spender, escrow operator, refund sender)
# ONCHAIN_BILLING_SOLANA_SECRET= # Solana SPL delegate + refund sender
# ONCHAIN_BILLING_CHECKOUT_URL=https://pay.example.com # renewal-invoice links
# ONCHAIN_BILLING_NETWORKS=base,arbitrum,solana,hypercore,zcash # default: every enabled network
# ONCHAIN_BILLING_ESCROW=off # disable Base commerce-payments escrow
# The hosted checkout calls /v1/onchain-billing server-side with this token
# (same value on the API and the checkout; 32+ chars, e.g. openssl rand -hex 32).
# Accepted ONLY under /v1/onchain-billing, with X-SettleKit-Organization.
# SETTLEKIT_SERVICE_TOKEN=
# Checkout: signs buyer "manage subscription" links (/s/<token>).
# CHECKOUT_MANAGE_SECRET=
# HYPERCORE_ENABLED=true # also enables HyperCore refunds (operator usdSend)
# HYPERCORE_REFUND_PRIVATE_KEY=0x... # optional: HyperCore refund account (default: operator key)
# =============================================================================
# Worker (apps/worker) — background jobs. Required integrations fail boot if
# missing. File-delivery uses FILE_DELIVERY_* (note: different prefix from API).
# =============================================================================
# --- Worker: file delivery (FILE_DELIVERY_*) ----------------------------------
FILE_DELIVERY_BASE_URL=http://localhost:8787/v1/files/download
FILE_DELIVERY_SECRET=settlekit-dev-file-secret
FILE_DELIVERY_EXPIRES_SEC=3600
FILE_DELIVERY_MAX_DOWNLOADS=5
# --- Worker: subscription / dunning tuning ------------------------------------
# Grace window (days) applied when a renewal is missed (1-365).
SUBSCRIPTION_GRACE_DAYS=3
# Send a renewal reminder when currentPeriodEnd is within this many days (1-365).
SUBSCRIPTION_RENEWAL_REMINDER_DAYS=7
# --- Worker: job intervals (milliseconds) -------------------------------------
WORKER_DELIVERY_INTERVAL_MS=5000
WORKER_PAYMENT_INTERVAL_MS=10000
WORKER_ACCESS_SYNC_INTERVAL_MS=300000
WORKER_RENEWAL_INTERVAL_MS=600000
WORKER_WEBHOOK_RETRY_INTERVAL_MS=30000
WORKER_RECEIPT_EMAIL_INTERVAL_MS=60000
WORKER_RENEWAL_REMINDER_INTERVAL_MS=3600000
WORKER_DUNNING_EMAIL_INTERVAL_MS=3600000
WORKER_ACCESS_EMAIL_INTERVAL_MS=60000
# How often the worker reconciles executed-but-unsettled payouts against Circle.
# Requires the worker to also have CIRCLE_WALLETS_* set (shared with the API);
# unset Circle wallets makes the job a no-op.
WORKER_PAYOUT_RECONCILE_INTERVAL_MS=60000
# Port for the worker's liveness/readiness/metrics HTTP server
# (GET /health, /ready, /metrics).
WORKER_HEALTH_PORT=8788
# =============================================================================
# Services — standalone Rust/Go binaries. Each loads its own env at startup.
# =============================================================================
# --- x402-gateway (Go, default :8402) -----------------------------------------
# TCP address the gateway binds to.
LISTEN_ADDR=:8402
# Origin paid requests are reverse-proxied to (required, valid URL).
UPSTREAM_URL=http://localhost:9000
# Decimal major-unit price per call, e.g. 0.005 (required).
PRICE=0.005
# Settlement asset — only USDC is supported.
CURRENCY=USDC
# Chain to settle on: arc | base | ethereum (required).
NETWORK=arc
# Destination address payments must be sent to (required).
PAY_TO=0x0000000000000000000000000000000000000000
# Product id attributing the gated call for usage accounting (required).
PRODUCT_ID=prod_replace_me
# Canonical identifier of the protected resource (required).
RESOURCE=https://api.example.com/premium
# Optional remote verifier; must respond {"ok":true}.
# VERIFY_URL=https://verify.example.com/x402
# Optional stable nonce. If empty, an HMAC-derived nonce is used instead.
# NONCE=
# Secret that signs derived nonces. Either NONCE or X402_HMAC_SECRET must be set.
X402_HMAC_SECRET=replace_with_x402_hmac_secret
# --- arc-indexer (Rust) -------------------------------------------------------
# Reuses ARC_RPC_URL / ARC_USDC_ADDRESS and SETTLEKIT_API_URL / SETTLEKIT_API_KEY below.
# Payout address to watch as the `to` of relevant USDC Transfer events (required).
WATCH_ADDRESS=0x0000000000000000000000000000000000000000
# Seconds between RPC polls (>0).
POLL_INTERVAL_SECS=12
# Confirmations required before a transfer is posted to the API.
CONFIRMATIONS=3
# Optional starting block; unset starts at the chain head.
# START_BLOCK=0
# --- license-gateway (Rust, default :8090) ------------------------------------
# SETTLEKIT_API_KEY (below) is required; SETTLEKIT_API_URL defaults to localhost:8787.
# TCP port the license gateway binds to.
LICENSE_GATEWAY_PORT=8090
# How long a cached verification result remains valid (seconds).
CACHE_TTL_SECS=30
# Timeout applied to each upstream HTTP request (seconds, >0).
REQUEST_TIMEOUT_SECS=10
# --- webhook-relay (Rust, default :8091) --------------------------------------
# TCP port the webhook relay binds to.
WEBHOOK_RELAY_PORT=8091
# HMAC-SHA256 secret applied to every outbound delivery body (>= 8 chars, required).
SIGNING_SECRET=replace_with_webhook_relay_signing_secret
# Max delivery attempts per subscriber before giving up (>0).
MAX_RETRIES=5
# Base delay (ms) for the exponential backoff schedule (>0).
RETRY_BASE_MS=500
# =============================================================================
# SDKs / CLIs — Node, Python, Go (agentpay). Constructor args override these.
# =============================================================================
# Base URL of the SettleKit HTTP API (default http://localhost:8787).
SETTLEKIT_API_URL=http://localhost:8787
# Bearer token sent as Authorization: Bearer <key>. Required for authed calls.
SETTLEKIT_API_KEY=sk_replace_with_api_key
# Python SDK x402 example helpers (sdks/python/examples only):
# SETTLEKIT_PAY_TO=0xYourMerchantWalletAddress
# SETTLEKIT_NETWORK=base
# SETTLEKIT_VERIFY_MODE=accept
# =============================================================================
# Autonomous operator (Tameion, Arc testnet) — packages/operator, apps/api
# /v1/operator/*, worker operator tick, apps/operator-console.
# The operator runs only with OPERATOR_VAULT_ADDRESS (real OperatorVault) or
# OPERATOR_SIMULATION=1 (labelled simulation, no chain).
# =============================================================================
# Org the operator acts for (defaults to the API's default org).
# OPERATOR_ORG_ID=org_your_business
# Deployed OperatorVault (contracts/script/DeployOperator.s.sol).
# OPERATOR_VAULT_ADDRESS=0xYourOperatorVault
# OPERATOR_SIMULATION=1
# Operator signer: Circle DCW address (needs CIRCLE_API_KEY + CIRCLE_ENTITY_SECRET)
# or a raw key; OPERATOR_SIGNER=viem forces the key when both are set.
# OPERATOR_WALLET_ADDRESS=0xAgentDcwAddress
# OPERATOR_PRIVATE_KEY=0x...
# OPERATOR_SIGNER=viem
# Owner signer for approve / reject / expire / caps / allowlist transactions.
# OWNER_WALLET_ADDRESS=0xOwnerDcwAddress
# OWNER_PRIVATE_KEY=0x...
# 32-byte hex entity secret registered with Circle (DCW contract execution).
# CIRCLE_ENTITY_SECRET=replace_with_registered_entity_secret_hex
# CIRCLE_W3S_BASE_URL=https://api.circle.com
# Arc testnet overrides (defaults: rpc.testnet.arc.network, chain 5042002, native USDC).
# ARC_RPC_URL=https://rpc.testnet.arc.network
# ARC_USDC_ADDRESS=0x3600000000000000000000000000000000000000
# ARC_EXPLORER_URL=https://testnet.arcscan.app
# Claude decision engine (deterministic heuristic engine when unset).
# ANTHROPIC_API_KEY=sk-ant-replace
# OPERATOR_MODEL_ROUTINE=claude-sonnet-5
# OPERATOR_MODEL_CRITICAL=claude-opus-5-5
# Default policy; caps must equal the vault's (PUT /v1/operator/policy refuses drift).
# OPERATOR_SPLIT_OPERATING_BPS=7000
# OPERATOR_SPLIT_YIELD_BPS=2000
# OPERATOR_SPLIT_REFUND_BPS=1000
# OPERATOR_TAX_RATE_BPS=2500
# OPERATOR_PER_TX_CAP_USDC=1000
# OPERATOR_DAILY_CAP_USDC=1500
# OPERATOR_ESCALATE_ABOVE_USDC=500
# OPERATOR_MIN_FLOAT_USDC=0
# OPERATOR_YIELD_TARGET_USDC=0
# OPERATOR_MAX_X402_PER_DAY=20
# OPERATOR_ALLOWLIST=0xVendorA,0xVendorB
# API key ids (besides the bootstrap key and dashboard sessions) that may
# approve/reject escalations and change policy.
# OPERATOR_OWNER_KEY_IDS=key_abc123
# x402 purchases from a Circle wallet (all four required).
# OPERATOR_X402_WALLET_ID=wallet-id
# ARC_USDC_TOKEN_ID=circle-token-id-for-arc-usdc
# OPERATOR_X402_ALLOWED_HOSTS=api.example.com
# Escalation alerts (email via RESEND_API_KEY above, and/or Discord).
# OPERATOR_ALERT_EMAIL=owner@example.com
# OPERATOR_ALERT_FROM=SettleKit Operator <operator@settlekit.dev>
# OPERATOR_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
# OPERATOR_CONSOLE_URL=http://localhost:3009
# --- apps/operator-console (server-side only; never NEXT_PUBLIC_) -------------
# OPERATOR_API_URL=http://localhost:8787
# Owner-capable API key (API_BOOTSTRAP_KEY or an id in OPERATOR_OWNER_KEY_IDS).
# OPERATOR_CONSOLE_API_KEY=replace_with_owner_api_key
# CONSOLE_OWNER_PASSWORD=replace_with_a_long_password
# At least 32 characters; login is disabled otherwise.
# CONSOLE_SESSION_SECRET=replace_with_32_plus_random_characters
# CHECKOUT_URL=http://localhost:3000
# --- Fiat pricing (products priced in EUR, GBP, ...) --------------------------
# Live ECB reference rates from a frankfurter service (lineofflight/frankfurter,
# MIT). Self-host it (docker image) and point FX_RATES_URL at it, or leave the
# public instance. Checkout fails closed when no valid rate is available.
# FX_RATES_URL=https://api.frankfurter.dev/v1
# FX_RATES_TTL_SECONDS=600
# --- Team invitations ----------------------------------------------------------
# Dashboard public URL used in invitation emails (/invite/<token>).
# DASHBOARD_PUBLIC_URL=https://dashboard.example.com
#
# --- Webhook delivery ------------------------------------------------------------
# Disable an endpoint after this many failed attempts in a row (worker).
# WEBHOOK_DISABLE_AFTER_FAILURES=100
# --- Cash out to a bank (off-ramp hand-off, no custody) -----------------------
# The dashboard Balances page opens a partner's sell flow with the amount,
# network and the merchant's own wallet prefilled. A partner shows only when
# its public key is set. Open the partner accounts first.
# TRANSAK_API_KEY=
# TRANSAK_ENV=staging # sandbox; omit for production
# MOONPAY_PUBLISHABLE_KEY=
# MOONPAY_SECRET_KEY= # signs sell URLs (server-side only)
# RAMP_HOST_API_KEY=
# --- Hosted storefront custom domains (apps/checkout) ------------------------
# This checkout's own hosts; "/" on any other host shows that domain's store.
# CHECKOUT_PRIMARY_HOSTS=pay.example.com,localhost