Back to ShipLog
🛠️ Engine RoomJanuary 28, 20265 min read

Why We Run on Cloudflare Workers

Edge-first architecture, Durable Objects for WebSocket, R2 for email storage, and zero cold starts.

By TradeStance Engineering
Cloudflarearchitectureperformance

The Problem

Traditional server architectures struggle with the global nature of trade. A trader in Istanbul requesting price data shouldn't wait 300ms for a round trip to a US-East server. And real-time WebSocket connections for live price tickers need stateful, persistent infrastructure.

The Solution

TradeStance runs entirely on Cloudflare Workers — a V8 isolate-based runtime deployed to 300+ edge locations worldwide. Our API routes execute within 20ms of the user. Durable Objects power the TradePulse WebSocket protocol for real-time price updates, and R2 stores email attachments with zero egress fees.

Architecture highlights:

  • Zero cold starts — Workers are always warm at the edge.
  • Durable Objects — Stateful WebSocket rooms with hibernation API.
  • R2 storage — Raw emails, attachments, and BIMI SVGs stored globally.
  • Queues — Background AI extraction jobs decoupled from request path.
  • Cron Triggers — 6-hourly news aggregation and sentiment scoring.

The Benefit

Sub-50ms API responses globally, $0 egress costs, and a single codebase that scales automatically. No containers, no Kubernetes, no infrastructure management.

Was this update useful?

#Cloudflare#architecture#performance