Hoox Docs

🧬 Infrastructure Bindings Index

In Cloudflare’s serverless architecture, bindings represent the declarative bridges linking your isolate compute logic to other internal microservices and storage platforms. This document serves as the absolute, production-grade reference registry for all resource bindings configured in the Hoox monorepo.


1. Secrets & Environment Variables Matrix

These parameters represent encrypted variables injected directly into V8 execution isolates at runtime.

Variable NameTypeBound WorkersOperational Impact
INTERNAL_KEY_BINDINGSecrethoox, trade-worker, d1-worker, telegram-worker, email-workerCryptographic auth key used by the requireInternalAuth middleware to validate service-to-service calls.
TG_BOT_TOKEN_BINDINGSecrettelegram-workerSecret bot token issued by @BotFather to authenticate Telegram API commands and alerts.
TELEGRAM_SECRET_TOKENSecrettelegram-workerWebhook verification token to authorize Telegram push events.
WEBHOOK_API_KEYSecrethooxGeneral passkey validated during incoming webhook signal requests.
BYBIT_API_KEY / _SECRETSecrettrade-workerCredentials used to execute cryptographically signed order routes to Bybit’s APIs.
BINANCE_API_KEY / _SECRETSecrettrade-workerCredentials used to execute trade routes to Binance’s APIs.
MEXC_API_KEY / _SECRETSecrettrade-workerCredentials used to execute trade routes to MEXC’s APIs.
CF_API_TOKENSecretreport-workerAccess token used to invoke the Cloudflare Puppeteer Browser Rendering APIs.

2. Service Bindings (Compute Connectors)

Service Bindings link workers’ V8 runtimes together locally in memory, with microsecond latency and zero external internet hops.

Binding NameIngesting WorkerTarget ServicePurpose
TRADE_SERVICEhoox, agent-worker, email-workertrade-workerHandles leverage calculation, size scaling, and execution.
TELEGRAM_SERVICEhoox, trade-worker, agent-worker, report-workertelegram-workerDispatches real-time alerts and parses slash commands.
D1_SERVICEtrade-worker, agent-worker, report-worker, dashboardd1-workerServes as the high-integrity proxy SQL data manager.
AGENT_SERVICEdashboardagent-workerTriggers risk audits, chat streams, and telemetry updates.

3. KV Namespace Caches

Key-Value caches store parameters that require sub-millisecond read access.

Binding NameBound WorkersPurpose
CONFIG_KVAll Workers + DashboardPrimary cache for the 16-key runtime manifest, rate-limiter, and Kill Switch.
SESSIONS_KVhoox GatewayStores active webhook session credentials and token cookie states.

4. Asynchronous Queues

Queues guarantee message delivery during times of heavy exchange network congestion or API rate limits.

Binding NameIngesting WorkerQueue NameTypeOperational Action
TRADE_QUEUEhoox Gatewaytrade-executionProducerSerializes and enqueues signal payloads during failover.
TRADE_QUEUEtrade-workertrade-executionConsumerPulls enqueued signals and retries executions with backoff.

5. SQLite-Backed Durable Objects

Durable Objects enforce exactly-once execution, preventing catastrophic double-trading.

Binding NameBound WorkerTarget Class NamePurpose
IDEMPOTENCY_STOREhoox GatewayIdempotencyStoreMutex locking engine with local SQLite and auto-alarm garbage collection.

6. R2 Object Storage Buckets

R2 Buckets store heavy files with zero bandwidth egress retrieval fees.

Binding NameBound WorkersBucket NameTarget Asset Payload
REPORTS_BUCKETtrade-worker, report-workertrade-reportsCompiled PDF daily/weekly portfolio reports.
SYSTEM_LOGS_BUCKETtrade-workerhoox-system-logsVerbose exchange API request-response logs.
UPLOADS_BUCKETtelegram-workeruser-uploadsUser chart screenshots and conversation images.

7. D1 SQLite Databases

Binding NameBound WorkersDatabase Instance NamePurpose
DBd1-workertrade-data-dbPrimary transactional trade database storage.

8. Workers AI & Vectorize Indexes

Binding NameBound WorkersTarget Asset NameOperational Purpose
AIhoox, trade-worker, agent-worker, telegram-workerEdge LLM ModelsRuns LLaMA-3 inference, risk analysis, and chat.
VECTORIZE_INDEXtelegram-workerrag-indexCustom semantic search vector DB for RAG queries.

🌐 9. Puppeteer Browser Rendering

The report-worker invokes Cloudflare’s Browser Rendering Chrome isolates using a secure REST API (no binding required):

  • Route: POST https://api.cloudflare.com/client/v4/accounts/{account_id}/browser-rendering/pdf
  • Headers:
    Authorization: Bearer <CF_API_TOKEN_BINDING>
    Content-Type: application/json
  • JSON Payload:
    {
      "html": "<html>...</html>",
      "options": {
        "format": "A4",
        "printBackground": true
      }
    }

Tip: Adding new bindings to your workers? Always update your wrangler.jsonc manifest at the workspace root, and then execute hoox deploy update-internal-urls to sync bindings and URLs globally!

🔗 Next Steps