Infrastructure / Cloudflare
Static docs at the edge. Prices straight from the book.
Nexwest Docs is built for Cloudflare Workers with OpenNext. The docs are prerendered, and the live market ticker connects directly from the browser to the market data feed — no Worker in the data path.
Docs at the edge
100+ prerendered pages, static assets, global cache. No database or runtime content dependency.
Prices in the browser
The ticker connects to the market feed directly. Cloudflare serves the page; it does not relay every tick.
Relay only if needed
Use a Worker + Durable Object per market when you need normalization, auth, or fan-out.
01 / Build
Deploy the docs
The project includes wrangler.jsonc and open-next.config.ts. Next.js 16.4.5 is supported by @opennextjs/cloudflare 1.20.16. The SSG site uses the Workers Static Assets incremental cache, so no R2 bucket, D1 database, or queue is required.
# Build the Cloudflare Worker bundle
npm run build:cf
# Preview locally with workerd
npm run preview
# Deploy to your Cloudflare account
npm run deploy{
"name": "nexwest-docs",
"main": ".open-next/worker.js",
"compatibility_date": "2026-11-01",
"compatibility_flags": ["nodejs_compat"],
"assets": {
"directory": ".open-next/assets",
"binding": "ASSETS"
}
}Windows note: both the OpenNext build and the Wrangler preview completed on Windows. WSL remains recommended for production deploys.
02 / Real-time
Where Workers fit
Browser ── WSS ────────────────► Market data feed
│
└── HTTPS ──► Cloudflare Worker ──► Static docs / HTML
Optional relay:
Browser ── WSS ──► Worker /ws ──► Durable Object per market
└── outbound WSS ──► VenueRecommended
Direct WebSocket
Lowest latency, no per-message Worker cost, and no extra point of failure. Set NEXT_PUBLIC_MARKET_WS_URL to point the ticker at the Nexwest feed.
Optional
Worker + Durable Object
Use one Durable Object per market to hold the upstream connection and fan out. Outbound WebSockets prevent hibernation, so budget for duration and reconnect logic.
03 / Configuration
Environment
| Variable | Purpose |
|---|---|
NEXT_PUBLIC_SITE_URL | Canonical origin for metadata, sitemap, and AI files |
NEXT_PUBLIC_APP_URL | Trading app origin for the Launch app button |
NEXT_PUBLIC_MARKET_WS_URL | WebSocket URL for the live ticker; unset uses the demo feed |