Hoox Docs

๐Ÿ—๏ธ System Topology & Overview

Hoox is an enterprise-grade, serverless algorithmic trading platform built entirely on Cloudflareโ€™s Edge V8 isolates and globally distributed resources. By using a modular, service-oriented architecture, Hoox decomposes complex trading processes into ten highly specialized micro-workers.

These workers communicate privately in microseconds, auto-scale globally near exchange servers, and store transaction logs in localized databasesโ€”all while running within Cloudflareโ€™s $0 free tiers.


๐Ÿ—บ๏ธ High-Level System Architecture

The ecosystem splits public-facing ingress points from private internal compute layers:

graph TB
    %% โ”€โ”€ Styling โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    classDef external fill:#f5f5f5,stroke:#999,stroke-width:2,color:#333
    classDef waf fill:#fff8e1,stroke:#f9a825,stroke-width:2
    classDef worker fill:#e8f5e9,stroke:#43a047,stroke-width:2,color:#1b5e20
    classDef storage fill:#e3f2fd,stroke:#1e88e5,stroke-width:2,color:#0d47a1
    classDef compute fill:#f3e5f5,stroke:#8e24aa,stroke-width:2,color:#4a148c
    classDef dash fill:#fff3e0,stroke:#ef6c00,stroke-width:2,color:#bf360c

    %% โ”€โ”€ Ingress Layer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    subgraph Ingress["๐ŸŒ Public Ingress Layer"]
        TV["๐Ÿ“Š TradingView Webhooks"]:::external
        TG["๐Ÿ’ฌ Telegram Bot Commands"]:::external
        EM["๐Ÿ“ง Email Signal Senders"]:::external
        WAF["๐Ÿงฑ Cloudflare WAF / Firewall"]:::waf
        GW["๐Ÿ” hoox Gateway Isolate"]:::worker
    end

    %% โ”€โ”€ Private Compute Layer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    subgraph Compute["โšก Private Internal Edge Compute"]
        TW["๐Ÿ“ˆ trade-worker (Execution Engine)"]:::worker
        D1W["๐Ÿ—„๏ธ d1-worker (SQL Hub)"]:::worker
        AW["๐Ÿง  agent-worker (AI Risk Manager)"]:::worker
        TGW["๐Ÿ’ฌ telegram-worker (Notifications)"]:::worker
        EMW["๐Ÿ“ง email-worker (Email Parser)"]:::worker
        W3W["๐ŸŒ web3-wallet (DeFi Swaps)"]:::worker
        ANW["๐Ÿ“Š analytics-worker (observability)"]:::worker
        RPW["๐Ÿ“„ report-worker (PDF Generator)"]:::worker
    end

    %% โ”€โ”€ Storage & Resource Layer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    subgraph Storage["๐Ÿ’พ Persistent Edge Storage"]
        KV[("KV Config Namespace")]:::storage
        DB[("D1 SQLite Database")]:::storage
        R2[("R2 Logs & PDF Bucket")]:::storage
        VEC[("Vectorize RAG Index")]:::storage
        DO{{"๐Ÿ”’ Durable Objects mutex"}}:::compute
        Q{{"๐Ÿ“จ Queues Queue"}}:::compute
        BR{{"๐ŸŒ Browser Rendering Chrome"}}:::compute
    end

    %% โ”€โ”€ Flow Connections โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    TV --> WAF
    WAF --> GW
    EM --> EMW
    TG --> TGW

    GW -->|Service Binding| TW
    GW -->|Service Binding| TGW
    GW -->|Service Binding| ANW
    GW -->|Durable Object Lock| DO
    GW -->|Queue Failover| Q

    TW -->|Service Binding| D1W
    TW -->|Service Binding| TGW
    TW -->|Service Binding| ANW
    TW -->|DeFi Execution| W3W
    TW -.->|Config Read| KV
    TW -.->|Write Trade Logs| R2

    D1W -.->|SQLite queries| DB
    TGW -.->|Semantic RAG search| VEC
    TGW -->|Service Binding| ANW

    AW -->|Cron 5m / Position Scale| TW
    AW -->|Service Binding| TGW
    AW -->|Service Binding| D1W

    RPW -->|Cron 2x/day / Render PDFs| BR
    RPW -.->|Save Reports| R2
    RPW -->|Push PDF Link| TGW

๐Ÿ“Š Comprehensive Micro-Worker Catalog

Worker NameRuntime ScopeCron TriggerPublic RoutingSmart PlacementPrimary Observability
hooxGateway RouterNoYes (/webhook)Yes (Fast path)Time-series Telemetry
trade-workerOrder ExecutionNoNo (Isolated)Yes (Exchange Proxied)Execution Logs
agent-workerRisk ManagementCron */5No (Isolated)Yes (Account Auditing)Alert Logs
telegram-workerAlerts & ChatNoNo (Isolated)Yes (Telegram APIs)Command Logs
d1-workerSQLite ManagerNoNo (Isolated)Yes (SQLite Bound)Query Latency
report-workerPuppeteer PDFCron 06,18No (Isolated)Yes (Rendering APIs)Print Status
email-workerIMAP ParsingCron */5No (Isolated)NoParse Statistics
web3-walletDeFi Swap EngineNoNo (Isolated)NoTx Sign Logs
analytics-workerObservabilityNoNo (Isolated)NoMetrics Dataset

๐Ÿ›ก๏ธ The 5-Layer Security Architecture

Security is designed as concentric protective corridors:

[ WAF: IP Range Allow-list ] -> [ Gateway: Webhook Passkey ] -> [ Isolation: Service Bindings ] -> [ Worker Auth: INTERNAL_KEY ] -> [ Mutex: Durable Objects ]

Layer 1: Edge-Level Firewall & WAF

Cloudflareโ€™s global WAF drop connections immediately at the edge if:

  • The payload does not originate from verified TradingView webhook IP ranges.
  • The request rate exceeds threshold ceilings (10 requests/minute).

Layer 2: Webhook Passkey Authentication

The hoox gateway validates that the payload apiKey string exactly matches the encrypted webhooks:api_key stored inside your CONFIG_KV namespace. Mismatched signals are instantly dropped with a 401 Unauthorized response.


Layer 3: Service Binding Encrypted Isolation

Internal workers (trade-worker, d1-worker, agent-worker) expose zero public HTTP endpoints. They cannot be targeted or accessed from the public internet. They can only be invoked internally by other V8 isolates using Cloudflare Service Bindings.


Layer 4: Standardized Internal Authorization

To prevent internal bypass or privilege escalation, all internal microservice boundaries enforce a strict bearer authorization check:

  • All internal workers (hoox, trade-worker, d1-worker, agent-worker, telegram-worker) are bound to the same INTERNAL_KEY_BINDING secret.
  • Every service-to-service invocation is audited by the shared requireInternalAuth middleware from @jango-blockchained/hoox-shared/middleware, dropping unauthorized calls.

Layer 5: Durable Object Idempotency Locks

If the network drops after an order fill, TradingView will resend the webhook. The gateway uses a single-threaded Durable Object to lock the request trace ID. If the transaction ID has already been logged, the duplicate is dropped before hitting exchange APIs, preventing double-ordering.


Tip: Smart Placement is enabled across all critical execution paths. This ensures that even though your webhook might hit a Cloudflare edge node in London, the actual transaction logic automatically shifts to Frankfurt or Tokyo (wherever the exchange APIs reside), eliminating network slippage entirely.

๐Ÿ”— Next Steps