dev-code-proxy

Workflows

Share online

dcp finds the dev servers running on this machine and gives each one a link online, through Tailscale, Cloudflare or both. Tailscale is on by default: a link for anyone, or private to your Tailscale network. Cloudflare is off until you turn it on: a public link under your own domain. Sharing stays on: the local HTTPS proxy runs it from boot, next to the .localhost names. Each link is the same every time.

https://bigfoot.tail1234.ts.net/web/pricing

https://
Tailscale's certificate, valid in every browser.
bigfoot.tail1234.ts.net
This machine's name on your Tailscale network. It doesn't change between runs, reboots or networks.
/web/
The project folder the dev server runs from. dcp finds the server by its port; nothing to configure.
pricing
Everything after the project reaches the app unchanged: here, /pricing.
Anyone with the link, or only your tailnetMade by dcp service install

Share what is running

Start your dev servers the way you always do, each from its own project folder. After dcp service install (once per machine, the same step as the local HTTPS names), every one of them is online:

$ dcp status
✓ tailscale   online       https://bigfoot.tail1234.ts.net, anyone with a link (3 apps)
  cloudflare  off          dcp cloudflare on --zone example.com turns it on
Every app with its links: dcp ls, or https://dcp.localhost

dcp status prints one line per provider: online, not online with the problem, its fix and a help link, or off with the command that turns it on. It exits 1 when a provider that is on is not online; --json prints the same for scripts. A plain dcp prints it too.

$ dcp ls
NAME  PORT   PROVIDER    STATE        URL
api   4100   local       up           https://api.localhost
api   4100   tailscale   online       https://bigfoot.tail1234.ts.net/api/
docs  3001   local       up           https://docs.localhost
docs  3001   tailscale   online       https://bigfoot.tail1234.ts.net/docs/
web   4000   local       up           https://web.localhost
web   4000   tailscale   online       https://bigfoot.tail1234.ts.net/web/

dcp ls prints one line per app and link, so grep finds what you need; dcp ls web keeps the apps whose name, folder or URL has web in it, and --json has every field. For one URL:

dcp url web                  # the best link: Cloudflare, else Tailscale, else local
dcp url api --tailscale      # or --local, --cloudflare
curl $(dcp url api --cloudflare)/health
dcp open web --tailscale     # in the browser

dcp url exits 1 when the link is not online yet. A server that starts later is online within a scan (20 seconds by default), and one that restarts keeps its link. Each link also shows next to the app's .localhost name on the dashboard and in the desktop app, with Copy.

dcp tailscale off && dcp cloudflare off   # every provider off

Tailscale

On by default. Every app gets https://<machine>.<tailnet>.ts.net/<project>/, and the proxy keeps dcp's Funnel entry in place: after a reboot, a Tailscale restart or a settings change it is put back within seconds. It needs Tailscale signed in on this machine (Install).

dcp tailscale on --tailnet      # your tailnet only (Tailscale Serve)
dcp tailscale on --public       # anyone with a link (Tailscale Funnel, the default)
dcp tailscale on --https-port 8443
dcp tailscale off               # dcp's entry is removed, the links stop working
Funnel (the default, --public)Serve (--tailnet)
Who can open the linkanyone on the internetyour devices and people on your Tailscale network
Webhooks from Stripe, GitHub, Slackyesno: they are outside your network
Your phone, a teammateyesyes, with Tailscale on their device
HTTPS port443, 8443 or 10000any
Extra setupFunnel allowed in the admin console (Install)none

Without the boot service (Windows, or a machine where you don't install it), dcp start shares Tailscale from the terminal while it runs: Ctrl-C takes the links down, and dcp start --bg keeps it running detached (logs in ./dcp.log). The desktop app shares by itself in that case. Cloudflare needs the local HTTPS proxy.

Cloudflare

Off by default. Every app gets a public link under a domain in your Cloudflare account, through a Cloudflare Tunnel: nobody needs Tailscale, and the link has no path prefix, so the app sees the same paths as on localhost.

https://web-bigfoot.example.com
         │   │       └ the zone: a domain in your Cloudflare account
         │   └ this machine's name (its Tailscale name, else its host name)
         └ the app's local name, dots as dashes (api.acme → api-acme)

Turn it on once, with a token in an env file (or --token-stdin):

$ dcp cloudflare on --zone example.com --env-file .env
→ checking the API token from .env: zone example.com, its tunnels and DNS…
✓ API token works: zone example.com (active) in the account Acme
✓ saved them to /Users/you/.dcp/secrets.json (only you can read it)
✓ cloudflare on: every app at <app>-bigfoot.example.com (e.g. https://web-bigfoot.example.com)
→ the local HTTPS proxy sets up the tunnel dcp-bigfoot, a DNS record per app and the connector (dcp logs -f shows each step)…
  ✓ tunnel dcp-bigfoot: healthy, 4 connections, 3 apps
→ checking each link from the outside (DNS via 1.1.1.1, the certificate, the answer); new records take up to a minute…
  ✓ https://api-bigfoot.example.com  200 · certificate Google Trust Services, valid until 2027-02-20
  ✓ https://docs-bigfoot.example.com  200 · certificate Google Trust Services, valid until 2027-02-20
  ✓ https://web-bigfoot.example.com  200 · certificate Google Trust Services, valid until 2027-02-20
✓ tailscale   online       https://bigfoot.tail1234.ts.net, anyone with a link (3 apps)
✓ cloudflare  online       https://*-bigfoot.example.com, anyone with a link (3 apps)
Every app with its links: dcp ls, or https://dcp.localhost

Each step goes to stderr, so stdout stays the result. dcp checks the credentials (an API token first, then a Global API Key with its email), saves what works to ~/.dcp/secrets.json, saves the settings, and waits for the local HTTPS proxy to bring the tunnel up. Then it opens each link from the outside. Running it again is safe.

What the proxy sets up, and keeps in place:

  • The tunnel dcp-<machine>, managed from Cloudflare's side (no local tunnel config). Its one ingress rule sends everything to dcp's host router on 127.0.0.1:<port+1> (18444 with the default port 18443), which picks the app by hostname and presents the request as a local one, as the Tailscale path router does.
  • One DNS record per app: a proxied CNAME to <tunnel-id>.cfargotunnel.com, with the comment dcp <machine>. dcp deletes only records that point at its own tunnel, and leaves a hostname alone when someone else already has a record for it (it says which, and the fix).
  • The connector cloudflared: the one on your PATH, else a copy downloaded into ~/.dcp/tools, checked against the release's SHA-256. Its log is ~/.dcp/logs/cloudflared.log.

The tunnel and DNS are checked every 5 minutes and whenever the set of apps changes; the tunnel's health every 30 seconds. dcp logs shows each step: cloudflare: tunnel created, DNS record added, cloudflared installed, connector started, tunnel healthy.

dcp cloudflare sync          # sync now instead of within 5 minutes (dcp reload does it too)
dcp cloudflare off           # stops the connector; the tunnel and DNS stay, so on again is fast
dcp cloudflare on            # on again, with the saved zone and credentials
dcp cloudflare off --purge   # also deletes the tunnel and the DNS records dcp made
dcp cloudflare off --forget  # also deletes the saved credentials

What dcp made in Cloudflare and how it last saw it (zone, tunnel and its health, the DNS records, which credentials work, when it last synced, the last error) is in ~/.dcp/cloudflare.json. dcp status prints it under the Cloudflare line, dcp status --json has it, and the dashboard and the desktop app show it.

The hostname comes from cloudflareHost (default {app}-{machine}; Configuration). One subdomain level, as the default gives, is covered by Cloudflare's free Universal SSL certificate. {app}.{machine} puts each app two levels deep, which needs Advanced Certificate Manager or Total TLS on the zone:

dcp cloudflare on --zone example.com --host '{app}-{machine}'

Cloudflare links are always public, so a project whose config says "share": "private" stays off Cloudflare.

The Cloudflare token

Cloudflare has two ways to sign in to its API, and dcp takes either; it says which it uses, and checks it:

CredentialsWhatdcp checks
API token, user (cfut_…) or account-owned (cfat_…)Scoped to the permissions and zones you pick; can expire or be limited to IPs. Cloudflare's recommendationthat it is active, and when it expires (/user/tokens/verify or /accounts/<id>/tokens/verify)
Global API Key (cfk_…) with your account's emailLegacy: everything your user can do, on every zone. One per user, no expirythat it can reach the zone

For a token, create one at dash.cloudflare.com/profile/api-tokens (an account-owned token: the account's Manage Account › API Tokens) with two permissions, for the zone the links go under (Cloudflare's guide):

PermissionFor
Account › Cloudflare Tunnel › Editthe tunnel dcp-<machine> and its connector token
Zone › DNS › Editone CNAME per app

Put it in an env file and pass it once; dcp keeps what works in ~/.dcp/secrets.json, readable only by you:

echo 'CLOUDFLARE_API_TOKEN=…' > .env
dcp cloudflare on --zone example.com --env-file .env
echo "$TOKEN" | dcp cloudflare on --zone example.com --token-stdin   # or from stdin

The env file can hold the Global API Key instead (CLOUDFLARE_API_KEY with CLOUDFLARE_EMAIL); with both, dcp tries the token first and falls back to the key, saying which works. CLOUDFLARE_API_TOKEN (or the key and email) in the environment overrides what is saved. To move from the Global API Key to a token, run dcp cloudflare on --env-file again with the token in the file.

What dcp shows, and how often it asks Cloudflare

$ dcp cloudflare
Cloudflare  ✓ online · https://*-bigfoot.example.com · anyone with a link · 6 apps

  credentials  user API token, saved in ~/.dcp/secrets.json
  token        active, expires 2027-06-30 (in 213 days)
  zone         example.com · account Acme
  tunnel       dcp-bigfoot · healthy · yyz04, yyz03, yyz06 · id 7918d3a1-…
  connector    cloudflared 2026.11.2 · pid 33352 · up 2h
               heartbeat: ready, 4 connections, 3s ago
  DNS          6 records: …
  sync         synced 2m ago, next in 3m
  API          4 of 300 calls in the last 5 minutes (Cloudflare allows 1200 per user)
  dashboard    DNS …/dns/records · tunnels …/networks/tunnels

The heartbeat comes from cloudflared itself (its /ready on this machine), every few seconds, without the API. Cloudflare's API allows 1,200 calls per 5 minutes per user, counted across the dashboard and every token, and blocks the user for 5 minutes past it, so dcp spends little: it looks the zone, account and tunnel up once and keeps their IDs, sets the tunnel's ingress and reads its token only when they change, checks a token's status hourly, and in a steady state makes two calls every 5 minutes (the tunnel's status and the DNS records), more only when the apps change or dcp cloudflare sync asks. It keeps itself to 300 calls per 5 minutes, and when Cloudflare answers 429 it stops for as long as Retry-After says. A tunnel deleted in the dashboard is made again, and dcp's own DNS records (they carry the comment dcp <machine>) move to it.

$ dcp check
✓ https://bigfoot.tail1234.ts.net/api/  200 · certificate Let's Encrypt, valid until 2027-01-14
✓ https://api-bigfoot.example.com  200 · certificate Google Trust Services, valid until 2027-02-20
… https://web-bigfoot.example.com  http: answers 530 (the tunnel is not connected yet)

It opens every link online from the outside, the way a browser elsewhere would: DNS asked of 1.1.1.1 (no cache on this machine hides a new record), the TLS certificate (who issued it, until when) and the HTTP answer. It exits 1 when one fails; --json prints each result with the step that failed.

dcp status, dcp doctor, the dashboard and the desktop app say what is wrong and the one step that fixes it.

ProblemFix
Tailscale: signed outtailscale up
Tailscale: Funnel not allowed in your tailnetthe admin page Tailscale names (Install), or dcp tailscale on --tailnet
Tailscale: changing Serve needs root (no operator)sudo tailscale set --operator=$USER
Tailscale: another Serve entry on the same portfree it (tailscale serve status, tailscale serve reset), or dcp tailscale on --https-port 8443
Cloudflare: credentials refused, or the zone is not visiblea token with the two permissions for that zone
Cloudflare: a hostname already has a DNS record dcp did not makechange cloudflareHost (dcp cloudflare on --host …), or remove that record
Cloudflare: cloudflared exitsits log, ~/.dcp/logs/cloudflared.log
Cloudflare: the link answers 530 or 502the tunnel is not connected yet: wait a few seconds, then dcp check
A port dcp needs is taken (the routing proxy's port, or the next one for the tunnel)dcp configure --port <free port> (the tunnel uses the next one)
The local HTTPS proxy is not runningdcp service install (Tailscale only: or dcp start in a terminal)
A 404 from dcpno dev server for that project runs: dcp ls

What gets found

Dev servers listening in the port range (3000–6000 by default) whose process is a web runtime: Node, Bun, Deno, Python (uvicorn, gunicorn), Ruby, PHP, go run, Java, .NET, Elixir, Perl, and Docker-published ports with --docker.

dcp ls                           # what is (or would be) shared, with each link
dcp configure --ports 3000-9000  # a wider range
dcp configure --all              # every listener in the range, compiled binaries included

The project name is the folder that holds the nearest package.json, go.mod, pyproject.toml, Cargo.toml or .git. If one folder runs two servers, the lower port gets /<project>/ and the other /<project>-<port>/, and dcp ls shows both.

A project can choose its own path and whether it is shared, in the same config that names it locally (Pick the name):

{ "name": "api.acme", "path": "api", "share": "private" }

share: "private" keeps it to your tailnet even while Tailscale sharing is public (Funnel callers get a 404 and never see it listed), and off Cloudflare. share: false leaves it out of both providers.

What your app sees

Requests arrive the way they would on localhost: Host: localhost:<port>, and through Tailscale the /<project> prefix removed, so CORS, cookies and host allow-lists behave as they do locally. Apps that build absolute URLs from the request (OAuth redirect URIs, canonical links) want the public host instead:

dcp --forward-host     # X-Forwarded-Host and X-Forwarded-Proto: https reach the app

Server-sent events stream and WebSockets upgrade, so hot reload works through the link too.

A real setup

Four services of one product, each in its own folder:

cd ~/work/acme/services/agent     && bun run dev    # :3087
cd ~/work/acme/services/crawler   && bun run dev    # :3120
cd ~/work/acme/services/workspace && bun run dev    # :3122
cd ~/work/acme/apps/web           && npm run dev    # :4501
dcp ls | grep tailscale
agent      3087   tailscale   online       https://bigfoot.tail1234.ts.net/agent/
crawler    3120   tailscale   online       https://bigfoot.tail1234.ts.net/crawler/
workspace  3122   tailscale   online       https://bigfoot.tail1234.ts.net/workspace/
web        4501   tailscale   online       https://bigfoot.tail1234.ts.net/web/

Next: point a webhook or an OAuth callback at one of them, in Webhooks & OAuth callbacks.