Edge-Native Trading
Ten V8 isolates on 330+ PoPs. Smart Placement sits next to the exchange — 30–60% less geo RTT.
- ~22 ms median
- 330+ PoPs
- 10 isolates
- Smart Placement
A production-grade stack built on Cloudflare Workers. Signals are validated and executed in V8 isolates colocated with exchange APIs, delivering median signal-to-ack latencies of 22 ms from 330+ global points of presence.
Edge Locations
Global Latency
Edge Components
Monthly Cost
An edge-native trading architecture that collapses the traditional signal-to-execution path. All inter-component communication occurs via Cloudflare Service Bindings with sub-millisecond overhead: no public internet traversal, no TLS handshakes, and no DNS resolution between microservices. The modules below describe what that topology yields in production.
Ten V8 isolates on 330+ PoPs. Smart Placement sits next to the exchange — 30–60% less geo RTT.
Service Bindings: V8-to-V8, sub-ms, no public east-west path.
The agent-worker executes on a fixed 5-minute cron. It maintains portfolio state, applies trailing-stop logic, enforces drawdown limits via the Global Kill Switch, and invokes a multi-provider LLM gateway (5 endpoints) with automatic failover and Vectorize-backed retrieval over historical trades.
Every trade signal is assigned a unique trace ID. The IdempotencyStore Durable Object — backed by SQLite with TTL-based cleanup — checks if that ID was already processed. Duplicate webhooks are silently dropped even across cold starts.
Cloudflare Queues provide guaranteed-delivery fallback when the fast-path Service Binding is unavailable. Failed messages retry with exponential backoff — 30 seconds to 15 minutes — ensuring no signal is lost during exchange downtime.
A 10-trades-per-minute rate limiter persisted in CONFIG_KV, surviving worker cold starts. When KV is unreachable the limiter falls back to in-memory state without dropping requests. Prevents API bans from misconfigured strategies.
trade-worker and d1-worker have zero public HTTP endpoints — accessible only via Service Bindings from the hoox gateway. API keys are injected directly into the V8 isolate at runtime, never stored in plaintext or logs.
Execute across Binance, Bybit, and MEXC through a unified ExchangeRouter abstraction. Routing is stored in CONFIG_KV — redirect any symbol to a different exchange instantly without code deployment or downtime.
Built entirely on Cloudflare's free tier: 100K Worker requests/day, 1GB D1 global SQLite, 1GB R2 object storage, 1M KV reads/day, 10 min/day Browser Rendering, and unlimited Analytics Engine writes. $0/month.
The telegram-worker embeds a RAG-powered assistant backed by Cloudflare Vectorize (384-dimensional embeddings). /search queries documentation semantically, /ask provides answers with citations, /latest retrieves market intelligence summaries.
Manage an ethers.js v6 wallet for on-chain operations directly from the edge. Execute DEX swaps, call smart contracts, and interact with DApps via Cloudflare Browser Rendering — all through the same Service Binding mesh as CEX trading.
Every API call, trade execution, and worker health event is tracked as a time-series event via Cloudflare Analytics Engine — free on all plans. R2 offloads verbose logs to preserve D1 write limits for critical financial data.
Bun monorepo with 28 CLI command groups and 100+ subcommands covering onboard, dev, deploy, infra, config, secrets, check, repair, test, db, monitor, trace, perf, waf, and more. Interactive TUI hot-reloads all 10 workers simultaneously. 58 CLI test files, 1,000+ assertions.
Six constraints that kill VPS bot stacks — and how HOOX is built around them.
Twelve cooperating components — ten V8 isolates plus two storage bindings — form a zero-trust microservice mesh. Inter-worker traffic is carried exclusively through Cloudflare Service Bindings, achieving microsecond-scale latency with no east-west exposure on the public internet. Concerns are isolated so that failure of any single component does not compromise trade execution or risk management.
The topology implements a formal seven-stage signal lifecycle across a ten-worker mesh plus two storage bindings. Service Bindings provide direct V8-to-V8 invocation with no public routing. State is maintained through globally replicated D1, KV, R2, and Vectorize indexes, with idempotency enforced at the Durable Object layer.
Routes authenticated signals to the execution layer via Service Bindings, with Queue failover for reliability. Uses Durable Objects for idempotent trade execution — prevents duplicate orders even on webhook retries. Validates TradingView webhook signatures, enforces IP allowlists, and applies rate limiting.
Receives validated signals and executes market/limit orders across MEXC, Binance, and Bybit. Implements dynamic position sizing, handles partial fills, maintains full order state in D1, and streams execution confirmations to Telegram.
Autonomous AI agent on 5-minute cron schedules. Each cycle recomputes portfolio PnL, adjusts trailing stops, and re-evaluates drawdown — near-real-time risk control with an evaluation window of up to 5 minutes, not sub-second reactive. Generates market intelligence via multi-provider LLM gateway with Vectorize RAG for semantic search across trade history. Triggers emergency kill-switches when drawdown exceeds thresholds.
Next.js 16 React dashboard deployed to Cloudflare Workers via OpenNext. Real-time portfolio monitoring, position management, risk parameter configuration, and comprehensive trade history visualization.
Instant trade confirmations and AI-generated market analysis delivered directly to Telegram. Supports rich formatting, position updates, and emergency alerts. Configurable notification preferences per trade type.
Handles all SQL operations against Cloudflare D1. Manages trade history persistence, aggregates performance metrics via Analytics Engine, maintains audit logs, and provides query endpoints for the dashboard and report-worker.
Cloudflare KV namespace storing runtime configuration. Exchange credentials, IP allowlists, risk parameters, and feature flags. Changes propagate globally within seconds.
Cloudflare R2 bucket for large object storage. Trade logs, backtest results, and historical market data archived for analysis and compliance.
Manages an ethers.js wallet for on-chain operations. Supports DApp interaction via Browser Rendering, executes token swaps, and interacts with smart contracts. Private key or mnemonic stored securely in Cloudflare Secrets Store.
Parses incoming trading signals from email via Mailgun webhooks. Configurable regex patterns for coin/signal detection stored in KV. Direct JSON endpoint also available for programmatic access. Forwards validated signals to the execution layer.
Tracks trades, API calls, worker performance, signals, and notifications as time-series data via Cloudflare Analytics Engine. Powers the dashboard with real-time metrics and historical performance data.
Generates detailed trade reports via Browser Rendering with scheduled delivery via Cron Triggers (06:00, 18:00 UTC). Streams PDF reports to R2 for compliance archiving and notifies via Email Worker when finalized. Uses Analytics Engine for historical performance aggregation.
Direct V8 isolate calls — no HTTP, TLS, or DNS
Latency reduction via proximity routing, $0 cost
V8 isolate initialization, no container warmup
10 workers + 2 storage bindings (KV, R2)
Not a fixed provider list — a pluggable orchestration layer. Swap LLMs in a single configuration file, introduce new providers without migration, and run inference on cron schedules or on-demand via API. Strategy code addresses one interface; the gateway resolves routing, fallbacks, and provider health.
Background analysis runs on your schedule — market scans, report generation, portfolio rebalancing checks.
No polling, no manual triggers. Set it once, it runs forever.
$hoox cron add "*/5 * * * * market-scan"Triggered by signals, API calls, or user actions. React to events in real time with streaming responses.
SSE streaming, batch inference, or single-shot queries.
$hoox agent call market-scan --livePluggable by design. Add a provider in one config file. No vendor lock-in, no migration pain.
Edge-native Workers mesh versus the stacks operators actually run: open-source bots on a VPS, SaaS bot platforms, and DIY Docker. Read each row left to right — metric → HOOX → named field — and judge latency, cost, control, and failure isolation on the same terms.
Field column below = typical posture of these stacks (not a sponsored vendor bake-off).
HOOX figures measured on Cloudflare's global edge (Smart Placement path). Competitor names describe the common class of stack — not an independent third-party benchmark of each product. MAHORAGA is the closest architectural match (also CF Workers) but runs single-exchange only.
The data layer is constructed from six Cloudflare edge primitives chosen for complementary latency, durability, and consistency characteristics. D1 provides globally replicated SQLite for trade state; KV delivers sub-millisecond configuration; R2 offers zero-egress object storage; Vectorize supplies embeddings for semantic retrieval; Analytics Engine records time-series metrics; and Queues guarantee at-least-once delivery with built-in backoff.
Atomic, persistent storage for all trade records, open positions, and performance metrics. R2 offloads verbose logs to preserve write limits for financial data.
Stores exchange credentials, IP allowlists, risk parameters, routing tables, rate-limiter state, and the Global Kill Switch toggle. Changes propagate globally without redeployment.
Stores generated PDF trade reports, system logs offloaded from D1, and historical market data archives. Zero egress charges on retrieval via Cloudflare CDN.
Embeds trade documentation and market intelligence for retrieval-augmented generation. Powers the Telegram /search and /ask commands with source-cited answers.
Tracks API call latency, trade execution times, error rates, and worker health as structured time-series blobs. Powers the Command Center dashboard and performance reporting. Free on all plans.
Provides a guaranteed-delivery fallback for trade signals when the fast-path Service Binding is unavailable. Exponential backoff policy ensures delivery survives exchange downtime and API rate-limit windows.
These primitives are available within Cloudflare's Workers free tier. For typical retail volumes (under 100,000 requests per day), complete trading infrastructure can operate at zero marginal cost.
Every architectural decision in this project is enforced at the type level. From animation orchestration to color tokens, the compiler validates what production depends on. No runtime checks for what the type system already guarantees.
TypeScript strict mode across all 200+ modules. No ‘@ts-ignore’, no ‘as any’ casts. Every API boundary, every animation tween, every route handler carries full type information inferred from source.
tsconfig strict: true · isolatedModules · noUncheckedIndexedAccess · exactOptionalPropertyTypesAll ingress data (webhooks, configs, env vars, form payloads) passes through ZOD schemas before reaching business logic. Parse failures produce structured error types — no undefined-at-runtime surprises.
z.object({ ... }).parse() · safeParse · discriminated unions · branded typesEvery renderable node is a client component. Animations drive the entire experience; there is no server-side rendering path for UI. This eliminates the Server/Client boundary tax and keeps the mental model uniform.
“use client” on every component · no RSC · no serialization gap · single runtimeThese patterns are enforced by convention and reviewed at every merge. The type system is the single source of truth for architecture — documentation follows the compiler, not the other way around.