Neon CLI command: dev
Run Neon Functions locally with a dev server
The dev command runs Neon Functions locally with a dev server and hot reload. Serve one function from its entry module, or every function declared in your neon.ts policy.
neon dev [--source <path>] [options]Options
Section titled “Options”| Option | Description | Type | Default | Required |
|---|---|---|---|---|
--port |
Port to listen on (single-function mode only, with --source). Fails if taken. Without it (and without a PORT env var) a free port is chosen automatically. | number | — | No |
--source |
Path to a single function entry module. Omit to serve every function declared in neon.ts. | string | — | No |
Examples
Section titled “Examples”Serve one function on a free port with hot reload:
neon dev --source ./functions/hello.tsServe every function declared in neon.ts (one dev server each):
neon devServe one function on an explicit port (fails if the port is taken):
neon dev --source ./functions/hello.ts --port 3000WebSockets
Section titled “WebSockets”neon dev serves WebSocket upgrades locally, so you can test real-time functions before you deploy. Connect a client to the dev server's ws://localhost:<port> URL. See WebSockets and SSE for the function-side code.