devwarp
v0.1.0
Published
One-command dev server launcher that maps your git branch to <branch>.localhost with a built-in reverse proxy (no permanent daemon).
Maintainers
Readme
devwarp
One-command dev launcher that maps your current git branch to <branch>.localhost without thinking about ports. No permanent daemon required.
Features
- Auto-picks a free port, injects it into your dev command, and registers
<branch>.localhost→ port. - On-demand reverse proxy bound to
:80(starts when needed, stops when last route is removed). - Works with any dev command (Vite/Next/Expo/Wrangler, etc.).
- Routes stored at
~/.devwarp/routes.json; no repo pollution.
Install / Run
npx devwarp <your dev command>Examples:
npx devwarp pnpm run devnpx devwarp npm run dev -- --host 0.0.0.0- Expo (web):
npx devwarp pnpm run web -- --web→ uses--web-portautomatically
Then open http://<branch>.localhost in your browser. DevWarp prints the exact URL; if :80 is unavailable it falls back to :8080 and shows http://<branch>.localhost:8080.
Demo (Hono + Wrangler)
This repo ships with three small demo apps under demo/feature-* (シンプルなToDo UI付き Hono アプリ)。
cd demo/feature-a && npm installnpm run dev- Open the URL printed by DevWarp (e.g.,
http://main.localhostor:8080if:80is blocked).
Use demo/run-all.sh to start all demos in parallel; demo/run-all.sh stop stops them and the proxy.
How it works
- Resolve git branch (
git rev-parse --abbrev-ref HEAD) and slugify →<branch>.localhost. - Pick a free local port.
- Spawn your dev command with
PORT/DEVWARP_PORTand--port <picked>injected (if not already present). - Register the mapping in
~/.devwarp/routes.json. - Ensure a reverse proxy is running on
:80; if not, startdevwarp --proxy(tries sudo first, then plain node if:80is allowed). - On exit, remove your route; if no routes remain and we started the proxy, stop it.
Options
--proxy-port <port>: run the proxy on a custom port (default 80). Helpful if sudo不可な環境で:80が塞がっている場合。--gc: garbage-collect stale routes (removes entries whose ports are not listening).--stop-proxy: stop the running proxy (uses pidfile at~/.devwarp/proxy.pid).
Expo note
- Metro uses
--port、Expo Webは--web-portを要求するため、自動判別して適切なポートフラグを挿入します(--webまたは--web-onlyが args にある場合は--web-portを追加)。
Permissions
- Binding to
:80may require sudo on your OS.devwarptriessudo -nfirst, then plainnode; if neither works, it warns and you can start the proxy manually with elevated privileges:sudo devwarp --proxy.
Cleanup
- Stop your dev command normally (Ctrl+C). Routes are removed automatically.
- If routes get stale, delete
~/.devwarp/routes.jsonor run your dev commands again to refresh.
Version
0.1.0
License
MIT
