Skip to content

Commit 60cdc3c

Browse files
zachdunnclaude
andauthored
Add portless for local-dev HTTPS subdomains (#799)
* Add portless for local-dev HTTPS subdomains Replaces port-juggling on bun run dev:* with stable named URLs: web at https://releases.localhost, workers at https://{api,mcp,discovery}.releases.localhost. Each script wraps the underlying tool with `portless <name>` and forwards the assigned PORT to wrangler / next so the proxy can route to the ephemeral port. * Add PORTLESS_NAME override and document portless dev setup Switches dev:* scripts from the positional `portless <name>` form to `portless run --name <name>`, which preserves worktree-prefix detection per the CLI help. The name now expands `${PORTLESS_NAME:-releases}` so a single env var swaps the base across all four services. AGENTS.md gets a Local development section covering subdomains, worktrees, the override, and the wrangler --port wiring. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent efcb6af commit 60cdc3c

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ Changelog indexer and registry for AI agents and developers. The user-facing CLI
1919
- Format: `bun run format:check`
2020
- **Evals (`tests/evals/`) are manual and on-demand only.** They call AI APIs, cost money, and take minutes. `bun run eval:evaluation` is the only in-repo suite (URL evaluation, ~30s). Parsing + discovery evals live in the OSS CLI repo.
2121

22+
## Local development
23+
24+
The four `dev:*` scripts (`dev:web`, `dev:api`, `dev:mcp`, `dev:discovery`) run each service through [portless](https://github.com/vercel-labs/portless) so they're reachable on stable HTTPS subdomains instead of port numbers — `https://releases.localhost` for the web frontend, `https://{api,mcp,discovery}.releases.localhost` for the workers. First run trusts a local CA and starts a daemon on port 443; subsequent runs reuse it. Apps mapping lives in `portless.json` for direct `portless` invocations from a workspace dir; the actual dev scripts pass `--name` explicitly so `portless run` picks up the override even outside a workspace.
25+
26+
- **Worktrees:** linked git worktrees are detected automatically and the branch name is prepended (`feat-x.releases.localhost`, `feat-x.api.releases.localhost`, …) so multiple checkouts coexist without collision. No config needed — this is built into `portless run`.
27+
- **Override:** set `PORTLESS_NAME=foo` to swap the base name across all four services in one go (`foo.localhost`, `api.foo.localhost`, …). Useful when sharing a machine, demoing on a custom domain, or sidestepping a stuck route. Worktree prefixing still applies on top.
28+
- **Ports:** wrangler is invoked with `--port $PORT --ip 127.0.0.1` so it binds to the ephemeral port portless assigns; Next.js gets `--port $PORT` via `bun run dev`. Don't hard-code dev ports in wrangler.jsonc — portless's auto-assignment is what avoids conflicts when multiple services run simultaneously.
29+
2230
## Workspaces and carved-out packages
2331

2432
Root `package.json` declares `workers/api`, `web`, and `packages/*` as workspaces. `workers/discovery/`, `workers/mcp/`, and `workers/webhooks/` are intentionally excluded — wrangler manages their dependencies independently.

bun.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"description": "Changelog indexer and registry for AI agents and developers",
66
"type": "module",
77
"scripts": {
8-
"dev:web": "cd web && bun run dev",
9-
"dev:api": "wrangler dev --config workers/api/wrangler.jsonc",
10-
"dev:discovery": "wrangler dev --config workers/discovery/wrangler.jsonc",
11-
"dev:mcp": "wrangler dev --config workers/mcp/wrangler.jsonc",
8+
"dev:web": "cd web && portless run --name ${PORTLESS_NAME:-releases} bun run dev -- --port $PORT",
9+
"dev:api": "portless run --name api.${PORTLESS_NAME:-releases} wrangler dev --config workers/api/wrangler.jsonc --port $PORT --ip 127.0.0.1",
10+
"dev:discovery": "portless run --name discovery.${PORTLESS_NAME:-releases} wrangler dev --config workers/discovery/wrangler.jsonc --port $PORT --ip 127.0.0.1",
11+
"dev:mcp": "portless run --name mcp.${PORTLESS_NAME:-releases} wrangler dev --config workers/mcp/wrangler.jsonc --port $PORT --ip 127.0.0.1",
1212
"deploy:api": "wrangler deploy --config workers/api/wrangler.jsonc",
1313
"deploy:discovery": "wrangler deploy --config workers/discovery/wrangler.jsonc",
1414
"deploy:mcp": "wrangler deploy --config workers/mcp/wrangler.jsonc",
@@ -89,6 +89,7 @@
8989
"husky": "^9.1.7",
9090
"lint-staged": "^17.0.2",
9191
"oxlint": "^1.63.0",
92+
"portless": "^0.12.0",
9293
"prettier": "^3.8.3",
9394
"typescript": "^6.0.3",
9495
"wrangler": "^4.88.0"

portless.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "releases",
3+
"apps": {
4+
"web": { "name": "releases" },
5+
"workers/api": { "name": "api.releases" },
6+
"workers/mcp": { "name": "mcp.releases" },
7+
"workers/discovery": { "name": "discovery.releases" }
8+
}
9+
}

0 commit comments

Comments
 (0)