---
title: "coding.sh serve · coding.sh docs"
description: "Production server: OTLP + native ingest, viewer, health and metrics on one port. Every option of coding.sh serve and its subcommands, from its own --help."
canonical: https://coding.sh/docs/cli/serve
human_url: https://coding.sh/docs/cli/serve
markdown_url: https://coding.sh/docs/cli/serve.md
agents_url: https://coding.sh/agents.md
llms_url: https://coding.sh/llms.txt
updated: 2026-11-11
---

# coding.sh serve

Production server: OTLP + native ingest, viewer, health and metrics on one port. Every option of coding.sh serve and its subcommands, from its own --help.

coding.sh serve --help

```
coding.sh serve [action] [options]

  Production server: OTLP + native ingest, viewer, health and metrics on one port

Commands
  keygen        Print a new ingest (or read) key once, plus the sha256 line for a config file
  healthcheck   Exit 0 when the server answers 200, 1 otherwise (Docker HEALTHCHECK)

Options
      --host <HOST>    Interface to bind (also CODING_SH_HOST) (default: 127.0.0.1)
  -p, --port <PORT>    Port to listen on, 0 = any free port (also CODING_SH_PORT, PORT) (default: 4318)
      --config <FILE>  Config file instead of ~/.coding.sh/config.toml
      --role <ROLE>    viewer: a read replica with no ingest and no writer lock (default: all)
      --insecure       Allow a non-loopback bind with no keys (also CODING_SH_INSECURE=1)

Examples
  coding.sh serve
  CODING_SH_STORE_URL=postgres://… CODING_SH_INGEST_KEYS=demo:$KEY CODING_SH_READ_KEYS='*:'$READ coding.sh serve --host 0.0.0.0
  coding.sh serve --role viewer --host 0.0.0.0

Notes
  Routes: POST /v1/traces, /v1/logs, /v1/metrics (OTLP/HTTP), POST /v1/ingest (native), GET / and /api/* (viewer), /healthz, /readyz, /metrics.
  Precedence: flags > env > --config file > defaults. See docs/PRODUCTION.md for every setting.
  A non-loopback bind needs an ingest key and a read key (or basic auth), or --insecure; on loopback with no keys, ingest is open to project default.
  Prints the URL (or one JSON document with --json) on stdout once ready; logs go to stderr. SIGTERM/SIGINT drain the queue (25s) and exit 0.
```

## `coding.sh serve keygen`

Print a new ingest (or read) key once, plus the sha256 line for a config file.

coding.sh serve keygen --help

```
coding.sh serve keygen [options]

  Print a new ingest (or read) key once, plus the sha256 line for a config file

Options
  --project <ID>  Project the key belongs to (read keys: * for all) (default: default)
  --read          A read key (viewer, /api, /metrics) instead of an ingest key

Examples
  coding.sh serve keygen --project demo
  coding.sh serve keygen --read --project '*'
```

## `coding.sh serve healthcheck`

Exit 0 when the server answers 200, 1 otherwise (Docker HEALTHCHECK).

coding.sh serve healthcheck --help

```
coding.sh serve healthcheck [options]

  Exit 0 when the server answers 200, 1 otherwise (Docker HEALTHCHECK)

Options
  --url <URL>     URL to probe (default http://127.0.0.1:<port>/healthz)
  --timeout <MS>  Give up after this many milliseconds (default: 3000)

Examples
  coding.sh serve healthcheck
  coding.sh serve healthcheck --url http://127.0.0.1:4318/readyz
```

[All commands](https://coding.sh/docs/cli) · [Global options](https://coding.sh/docs/cli#global)

To set coding.sh up for a user, follow the agent workflow at [/agents.md](https://coding.sh/agents.md).
