The hoox gateway is the public-facing entry point of the trading ecosystem. Running as an ultra-low-latency Cloudflare Worker, the gateway is responsible for authorizing incoming trade signals (TradingView alerts, email routing, manual commands), executing rate-limiting checks, locking transaction trace IDs via Durable Objects to prevent duplicate fills, and routing validated events privately to background compute nodes.
🏗️ Architectural Topology
⚡ 1. Declared Wrangler Configurations & Bindings
The gateway’s wrangler.jsonc defines its private service binding links and resource bounds:
🔑 2. Environmental Variables & Encrypted Secrets
For security, build-time credentials are never stored in plain text. They are bound at deploy time as encrypted secrets:
WEBHOOK_API_KEY: The custom authentication passkey expected inside incoming signal payloads.
INTERNAL_KEY_BINDING: The shared bearer authorization token used by requireInternalAuth middleware to invoke internal V8 isolates.
Local Development Mocking (.dev.vars)
When running tests or starting local Wrangler dev, create a gitignored .dev.vars file in the gateway directory:
🛜 3. API Route Specifications
Note: For the canonical endpoint directory with full request/response examples across all workers, see /docs/devops/api/endpoints.
The gateway exposes three public entryways:
A. Ingest Signal Webhook
- Endpoint:
/webhook
- Method:
POST
- JSON Payload:
- Success Response (200 OK):
B. Gateway Health Diagnostics
- Endpoint:
/health
- Method:
GET
- Success Response (200 OK):
If exchange APIs experience high latency or go offline, the gateway intercepts
the timeout error, serializes the payload, and pushes it to the TRADE_QUEUE
producer in less than 2 milliseconds, returning a "status": "Enqueued"
(202 Accepted) response to TradingView.
🔗 Next Steps