一键导入
dev-server
How to start a development server in the background and construct the public URL for port-forwarding in this homelab environment
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How to start a development server in the background and construct the public URL for port-forwarding in this homelab environment
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Architecture Decision Records following Nygard's lightweight template
Design patterns for authentication, routing, error handling, and forms
Architectural conventions and decision-making guidelines
Code style, patterns, and implementation conventions
Conventional Commits specification for structured commit messages
Automate browser interactions, test web pages and work with Playwright tests.
| name | dev-server |
| description | How to start a development server in the background and construct the public URL for port-forwarding in this homelab environment |
This environment runs inside a Kubernetes pod. Dev servers must be started detached (in the background) so the agent process can continue. Once a port is listening, the infrastructure automatically creates a public URL for it.
Always start dev servers in the background with output redirected so they don't block the agent:
# Generic pattern
nohup <start-command> > /tmp/dev-server.log 2>&1 &
echo "Dev server PID: $!"
# Vite (React, Vue, Svelte, etc.)
nohup npm run dev > /tmp/dev-server.log 2>&1 &
# Next.js
nohup npm run dev > /tmp/next-dev.log 2>&1 &
# Node.js / Express
nohup node server.js > /tmp/server.log 2>&1 &
# Bun
nohup bun run dev > /tmp/dev-server.log 2>&1 &
Wait a few seconds for the server to start before trying to access it:
sleep 3
# Verify it's listening
ss -tlnp | grep <port>
# or check logs
tail /tmp/dev-server.log
Only ports in the following allowlist are automatically exposed as public URLs:
| Port | Common Use |
|---|---|
| 3000 | Next.js, Express, React (CRA) |
| 3001 | Alternative dev port |
| 4321 | Astro |
| 5173 | Vite (default) |
| 5174 | Vite (alternative) |
| 8000 | Python http.server, Django, generic HTTP |
| 8080 | Generic HTTP, Webpack DevServer |
| 8888 | Jupyter Notebook |
If your framework defaults to a different port, configure it to use one of the ports above (e.g.
vite --port 5173,next dev --port 3000).
Once the server is listening, the public URL follows this pattern:
https://<port>-<session-hash>-oc.<domain>
The session hash is available as an environment variable:
echo $OPENCODE_SESSION_HASH
Both the session hash and domain are available as environment variables:
# Replace PORT with your actual dev server port
echo "https://PORT-${OPENCODE_SESSION_HASH}-oc.${OPENCODE_ROUTER_EXTERNAL_DOMAIN}"
If OPENCODE_SESSION_HASH=abc123def456 and OPENCODE_ROUTER_EXTERNAL_DOMAIN=no-panic.org, a Vite server on port 5173 is accessible at:
https://5173-abc123def456-oc.no-panic.org
| Variable | Description |
|---|---|
OPENCODE_SESSION_HASH | 12-character hex hash identifying this session |
OPENCODE_ROUTER_URL | Internal cluster URL of the router (not the public domain) |
OPENCODE_ROUTER_EXTERNAL_DOMAIN | Base domain for public URLs (e.g. no-panic.org) |
nohup … & — not just … &. Without nohup, the process dies when the terminal session ends.> file 2>&1) to avoid blocking on output.server.listen('localhost') is automatically rewritten to 0.0.0.0 — dev servers will be reachable from outside the pod without any extra flags.