Cloudflare® Workers Bindings & Environment Variables

Comprehensive reference for Cloudflare® bindings (D1, R2, KV, DO, Queues, Workers AI, Vectorize, Analytics Engine) used across Hoox workers.

This page

This document provides a comprehensive reference for all bindings, environment variables, and secrets used in the Cloudflare® Workers project.

Table of Contents

Secrets & Environment Variables

VariableTypeWorkersDescription
INTERNAL_KEY_BINDINGSecrettelegram-worker, hoox, trade-worker, and mesh isolatesInternal authentication key for worker-to-worker communication
OPERATOR_API_KEYSecrethooxBearer for operator /v1/* and /wallet/*. Client sends the same value as HOOX_API_TOKEN.
TG_BOT_TOKEN_BINDINGSecrettelegram-workerTelegram Bot API token
TG_CHAT_ID_BINDINGSecrettelegram-workerTelegram chat ID for notifications
TELEGRAM_SECRET_TOKENSecrettelegram-workerWebhook verification token for Telegram
AUTHORIZED_CHAT_IDSSecrettelegram-workerComma-separated chat IDs: inbound webhook fail-closed when unset; outbound /alert allowlist (else only TG_CHAT_ID_BINDING)
TELEGRAM_ALLOWED_CHAT_IDSSecrethooxComma-separated chat IDs for webhook notify (fail-closed when unset); alias AUTHORIZED_CHAT_IDS; optional CONFIG_KV telegram:allowed_chat_ids
WEBHOOK_API_KEY_BINDINGSecrethooxAPI key for webhook endpoints
WALLET_PK_SECRETSecretweb3-wallet-workerPrivate key for Web3 wallet operations
WALLET_MNEMONIC_SECRETSecretweb3-wallet-workerMnemonic phrase for wallet generation
WALLET_EXECUTE_KEY_BINDINGSecrettrade-worker, web3-wallet-worker, hooxMesh key for DEX /swap. hoox setup generates it (same value as INTERNAL_KEY_BINDING unless you already set one).
SOLANA_PRIVATE_KEYSecretweb3-wallet-workerSolana signing seed (auto-generated if unset)
JUPITER_API_KEYSecretweb3-wallet-workerJupiter Swap V2 API key
EXCHANGE_KEY_BINDINGSecrettrade-workerCanonical CEX API key (Binance / Bybit / MEXC). Set with hoox secrets set trade-worker EXCHANGE_KEY_BINDING.
EXCHANGE_SECRET_BINDINGSecrettrade-workerCanonical CEX API secret
EXCHANGE_TESTNET_KEY_BINDINGSecrettrade-workerOptional unified testnet API key (test: true)
EXCHANGE_TESTNET_SECRET_BINDINGSecrettrade-workerOptional unified testnet API secret
BINANCE_KEY_BINDING / BINANCE_SECRET_BINDINGSecrettrade-workerDeprecated alias. trade-worker still reads these (and BYBIT_* / MEXC_*) as fallbacks. Prefer EXCHANGE_*.
API_KEYSecretpyne-workerX-API-Key for PYNE evaluate / management
CLOUDFLARE_API_TOKENSecretanalytics-workerCF API token for Analytics SQL queries

Service Bindings

BindingWorkerConnected ServiceDescription
TRADE_SERVICEhoox, agent-worker, email-worker, pyne-workertrade-workerAccess to trading functionality
WEB3_WALLET_SERVICEtrade-worker, hoox, dashboardweb3-wallet-workerDEX spot swaps (Uniswap / Jupiter)
TELEGRAM_SERVICEhoox, trade-worker, agent-worker, web3-wallet-worker, report-workertelegram-workerTelegram notifications
D1_SERVICEtrade-worker, agent-worker, report-worker, dashboardd1-workerCentralized D1 database service
AGENT_SERVICEdashboardagent-workerAgent worker access
PYNE_SERVICEdashboardpyne-workerPine Script™ edge evaluate

KV Namespace Bindings

BindingWorkerDescription
CONFIG_KVhoox, trade-worker, agent-worker, telegram-worker, d1-worker, email-worker, dashboardConfiguration + rate limiter state
SESSIONS_KVhooxWebhook session storage

R2 Bucket Bindings

BindingWorkerBucket NameDescription
UPLOADS_BUCKETtelegram-workeruser-uploadsStore user uploaded files
REPORTS_BUCKETtrade-workertrade-reportsStore trading reports and data

D1 Database Bindings

BindingWorkerDatabase NameDescription
DBd1-workertrade-data-dbOnly worker that binds D1. trade-worker, agent-worker, report-worker, and the dashboard call it through service binding D1_SERVICE.

AI Bindings

BindingWorkerDescription
AIhoox, agent-worker, telegram-worker, dashboardAccess to Cloudflare® Workers AI capabilities

Vectorize Bindings

BindingWorkerIndex NameDescription
VECTORIZE_INDEXhoox, telegram-workermy-rag-indexVector database for RAG applications

Analytics Engine Bindings

BindingWorkerDatasetDescription
ANALYTICS_ENGINEanalytics-workerhoox-analyticsTime-series metrics from all workers

Queue Bindings

BindingWorkerQueueDescription
TRADE_QUEUEhoox (producer), trade-worker (consumer)trade-executionAsync trade execution with retry / backpressure

Durable Object Bindings

BindingWorkerClassMigrationDescription
IDEMPOTENCY_STOREhooxIdempotencyStorev1Exactly-once trade fingerprint store
RATE_LIMITERhooxRateLimiterStorev2Atomic multi-isolate trade rate limits (MAX_TRADES_PER_MINUTE)

Both classes are exported from workers/hoox-worker/src/index.ts. wrangler deploy applies new migration tags once. Without RATE_LIMITER, the gateway falls back to CONFIG_KV / in-memory counters (best-effort).

Browser Rendering

report-worker declares a wrangler browser binding named BROWSER and calls env.BROWSER.quickAction("pdf", { html, options }). That path does not call the Browser Rendering REST API and does not need CF_API_TOKEN. If BROWSER or REPORTS_BUCKET is missing, the cron falls back to a text Telegram summary.

Local Development URLs

hoox dev pins these ports (LOCAL_PORTS in packages/cli/src/commands/dev/dev-command.ts). agent-worker, email-worker, report-worker, and analytics-worker are not pinned; they take 8800+ in enable order. Docker Compose publishes only 8787 and 8794 to the host.

Servicehoox dev portLocal URLCalled by
hoox (hoox gateway)8787http://localhost:8787Webhook clients
trade-worker8788http://localhost:8788hoox, agent-worker, email-worker
d1-worker8789http://localhost:8789trade-worker, agent-worker, report-worker, dashboard
telegram-worker8790http://localhost:8790hoox, trade-worker, agent-worker, web3-wallet, report
web3-wallet-worker8792http://localhost:8792trade-worker
dashboard8794http://localhost:8794Browser (hoox dev dashboard, not a wrangler port)
pyne-worker8799http://localhost:8799hoox / hoox pyne

Configuration

Each worker contains a .dev.vars file for local development which should be populated with the appropriate values. These files should not be committed to the repository.

Example setup for .dev.vars files can be found in the corresponding .dev.vars.example files in each worker directory.

Setting Up Secrets

Prefer the Hoox CLI so .dev.vars and Cloudflare® stay in sync:

bash
hoox secrets set trade-worker EXCHANGE_KEY_BINDING
hoox secrets set trade-worker EXCHANGE_SECRET_BINDING
hoox secrets sync --system    # mesh keys only (INTERNAL_KEY_BINDING, WALLET_EXECUTE_KEY_BINDING, …)

Raw Wrangler still works for a single isolate:

bash
wrangler secret put EXCHANGE_KEY_BINDING --config workers/trade-worker/wrangler.jsonc

Cloudflare® and the Cloudflare® logo are trademarks and/or registered trademarks of Cloudflare®, Inc. in the United States and other jurisdictions.