Local Development

Run a local V8 isolate dev server with hot reload.

Local Development

ccp dev starts a local HTTP server running your function in a real V8 isolate — the same runtime used in production.

Start the Dev Server

ccp dev
# ◼ Dev Server started!
# › http://127.0.0.1:1234

The server watches your entry file for changes and hot-reloads automatically — no restart needed.

Options

FlagDefaultDescription
--port <port>1234Port to listen on
--hostname <host>127.0.0.1Hostname to bind to
--env <path>.envPath to a custom env file
--public-dir <path>Serve static assets from this directory
--client <path>Include a client-side script
--allow-code-generationfalseAllow eval() and new Function()
--prod / --productionfalseSet process.env.NODE_ENV to "production"

Environment Variables

CCP automatically loads a .env file from the project root if one exists:

# .env
API_KEY=sk-abc123
DEBUG=true
ccp dev
# Automatically loaded .env file...
# ◼ Dev Server started!

Point to a different env file with --env:

ccp dev --env .env.staging

Variables are available in your handler via process.env:

export function handler(request: Request): Response {
  const key = process.env.API_KEY;
  return new Response(`Key: ${key}`);
}

Static Assets

For static sites, pass the public directory:

ccp dev --public-dir public

Static files are served directly. Non-matching paths fall through to your handler. See Static Sites for more details.

Logs

console.log(), console.error(), and console.warn() output directly to your terminal with level prefixes:

INFO Hello from the handler
ERROR Something went wrong
WARN Deprecated API usage

Timeouts

The local dev server applies the same timeouts as production:

  • Tick timeout: 500ms per I/O tick
  • Total timeout: 30 seconds per request

On this page