Local Development
Run the web, server, and docs locally with Wrangler or Bun
Last updated: Jan 23, 2026
This guide covers local development for the API, web app, and docs site. Ports are fixed to match production defaults.
Prerequisites
- Install dependencies:
bun install - Wrangler env files live in
apps/server/.dev.varsandapps/web/.dev.vars
Quick Start (Node.js)
The fastest way to develop locally using Next.js and Bun dev servers:
# Start all apps in parallel
bun run dev- API:
http://localhost:3000 - Web:
http://localhost:3001
Run in Workers Runtime (Cloudflare)
Use this to test your app in the actual Cloudflare Workers runtime before deploying.
Web (Next.js + OpenNext)
# Production config
bun --cwd apps/web run preview
# Staging config
bun --cwd apps/web run preview:staging- URL:
http://localhost:8787
The preview command builds with OpenNext and starts wrangler dev.
API (Hono)
bun --cwd apps/server run preview- URL:
http://localhost:3000
Docs (Fumadocs)
bun --cwd apps/fumadocs run preview- URL:
http://localhost:4000
Production Builds (Node.js)
Build and run production bundles locally without Cloudflare:
API build
bun --cwd apps/server run build
bun --cwd apps/server run startWeb build
bun --cwd apps/web run build
bun --cwd apps/web run startDocs build
bun --cwd apps/fumadocs run build
bun --cwd apps/fumadocs run startEnvironment Files
For local Wrangler development, create .dev.vars files:
apps/server/.dev.vars
DATABASE_URL=postgresql://...
BETTER_AUTH_SECRET=your-secret
BETTER_AUTH_URL=http://localhost:3000
CORS_ORIGIN=http://localhost:3001apps/web/.dev.vars
NEXT_PUBLIC_SERVER_URL=http://localhost:3000See Cloudflare Deployment for the full list of environment variables.