Hoox Docs

🔌 Internal Endpoints Map

This document catalogs all internal REST, service-to-service, and queue endpoints exposed across the Hoox microservice monorepo. Because internal workers have zero public IP footprints and are completely isolated by Cloudflare’s Zero Trust service bindings, this map serves as the primary integration blueprint for routing, debugging, and dashboard interactions.


🏗️ Interactive Compute & Routing Flow

All external webhooks flow through the public hoox gateway, which authenticates payloads and routes them to private workers inside localized V8 engine isolates:

graph TD
    %% Ingress
    Client[TradingView / User] -->|1. Public HTTPS Ingress| GW[hoox Gateway]

    %% Gateway Service Bindings
    GW -->|2. Service Binding| TW[trade-worker]
    GW -->|2. Service Binding| TGW[telegram-worker]
    GW -->|2. Async Failover Queue| Q[trade-execution Queue]

    %% Internal Workers Services
    TW -->|3. Service Binding| D1W[d1-worker]
    TW -->|3. Service Binding| W3[web3-wallet-worker]
    TGW -.->|RAG Queries| VEC[(Vectorize Index)]
    Q -->|4. Async Consumer| TW
    D1W -.->|SQLite read/write| DB[(D1 Database)]

🗂️ Endpoints Directory by Worker

Every internal HTTP request between V8 isolates must transmit the standard bearer header: X-Internal-Auth-Key: <INTERNAL_KEY_BINDING>


🔐 1. hoox (Gateway Router)

  • Status: Public Ingress Node
  • Bindings Mounts: TRADE_SERVICE, TELEGRAM_SERVICE, ANALYTICS_SERVICE, CONFIG_KV, TRADE_QUEUE
RouteMethodDescriptionRequest ShapeSuccess Response
/webhookPOSTPrimary webhook receiver for TradingView alerts.WebhookSignal JSON200 OK (Orderfilled metadata)
/healthGETProbes gateway, D1 connectivity, and DO status.N/A{"status": "ok"}
/telegram-webhookPOSTProcesses chat commands pushed from Telegram.Telegram Updates200 OK

📈 2. trade-worker (Execution Engine)

  • Status: Private Compute Node (No Public URL)
  • Bindings Mounts: D1_SERVICE, TELEGRAM_SERVICE, ANALYTICS_SERVICE, CONFIG_KV
RouteMethodDescriptionRequest ShapeSuccess Response
/webhookPOSTDirect fast-path execution trigger.WebhookSignal JSON200 OK (Fill detail JSON)
/dexPOSTDispatches EVM orders on-chain via web3 wallet.DexTrade JSON200 OK (Tx Hash metadata)
/api/signalsGETRetrieves recent signal logs from D1.Query params filters200 OK (Array of signals)
/healthGETProbes CPU thread state and exchange connections.N/A{"status": "ok"}

🗄️ 3. d1-worker (SQLite Hub)

  • Status: Private Data Proxy (No Public URL)
  • Bindings Mounts: DB (D1 SQLite database binding)
RouteMethodDescriptionRequest ShapeSuccess Response
/queryPOSTExecutes a single SQL query against the SQLite database.{"query": "SELECT * FROM trades", "params": []}{"success": true, "results": [...]}
/batchPOSTExecutes multiple transactional SQL operations.{"queries": [{"query": "...", "params": []}]}{"success": true, "results": [...]}
/api/dashboard/statsGETComputes aggregated Win Rate, drawdown, and daily totals.N/A{"success": true, "stats": {...}}
/{tableName}GETLists rows inside a specific SQLite table (with filters).Query params{"success": true, "rows": [...]}

🧠 4. agent-worker (AI Risk Manager)

  • Status: Private Compute Node (Runs primarily on Cron schedule */5 * * * *)
  • Bindings Mounts: TRADE_SERVICE, D1_SERVICE, TELEGRAM_SERVICE, AI
RouteMethodDescriptionRequest ShapeSuccess Response
/agent/chatPOSTStarts a conversational market/risk query (SSE supported).{"prompt": "...", "stream": true}text/event-stream stream
/agent/visionPOSTAnalyzes image bytes using multimodal AI models.{"image": "base64...", "prompt": "..."}{"analysis": "..."}
/agent/statusGETReturns active trailing stops and current drawdowns.N/A{"status": "active", "stops": []}
/healthGETProbes AI model availability and Cron loop timers.N/A{"status": "ok"}

💬 5. telegram-worker (Push alerts)

  • Status: Private Compute Node
  • Bindings Mounts: ANALYTICS_SERVICE, AI, VECTORIZE_INDEX
RouteMethodDescriptionRequest ShapeSuccess Response
/alertPOSTSends a push trade fill notification or daily digest.{"chatId": "...", "message": "..."}{"success": true}
/healthGETProbes Telegram API connection.N/A{"status": "ok"}

Tip: Every internal-to-internal transaction automatically inherits the requestId trace UUID generated by the gateway. This trace ID is attached as the X-Request-Id header, allowing you to trace a single webhook alert across D1 database writes, R2 log outputs, and Telegram alerts instantly!

🔗 Next Steps