Skip to content

devlanes is in beta and not ready for production use.Report an issue

Hello Node

A small TypeScript server built with Hono. devlanes gives it a port and routes https://example-hello-node.localhost to it. A second Git worktree runs a second copy as lane 1 at https://example-hello-node1.localhost. Start here if devlanes is new to you.

  • devlanes, with devlanes setup run once
  • Node 22 or later
Terminal window
cd basics-hello-node
devlanes start

On a terminal, devlanes start opens the TUI and follows the start there. devlanes start --no-ui prints the start as text:

example-hello-node@0 (main): 1/1 ready
ready web http://127.0.0.1:20400 https://example-hello-node.localhost

Open https://example-hello-node.localhost. The page says This is lane 0 of example-hello-node. and lists the lane, branch, service, port and URL that answered. https://example-hello-node.localhost/lane returns the same values as JSON.

devlanes calls each worktree of the repository a lane. A fresh clone on main is lane 0, named main.

  1. The first start of a lane runs the install task (npm install), because a new worktree has no node_modules.
  2. devlanes reserves a block of ports for the lane and picks one for the web service.
  3. It runs npm run dev, which is tsx watch src/index.ts, with PORT and HOST=127.0.0.1 set.
  4. The ready check requests /healthz on that port until the server answers 200 ok. Only then is web ready and the start done.
  5. The proxy routes https://example-hello-node.localhost to the port.

The page takes its URL from the X-Forwarded-Host header the proxy adds, so a request that skips the proxy shows not through the proxy there instead.

  • devlanes status lists the lane and the service:

    example-hello-node
    LANE BRANCH STATE SERVICES CPU MEM URL
    0 main running 1/1 0.0% 87.4 MiB https://example-hello-node.localhost
  • devlanes logs web prints what the server wrote:

    web#2 > dev
    web#3 > tsx watch src/index.ts
    web#4
    web#5 hello-node listening on http://127.0.0.1:20400
  • Edit the heading in src/views/HomePage.tsx and save. tsx watch restarts the server, devlanes logs web shows a [tsx] change in ... Restarting... line, and a reload of the page shows the change.

  • devlanes url open web opens the page in your browser.

  • Start a second lane: git worktree add ../examples-checkout -b feat/checkout, then cd ../examples-checkout/basics-hello-node && devlanes start. Its page at https://example-hello-node1.localhost says This is lane 1 of example-hello-node., with another port and lane colour, while lane 0 keeps running.

  • devlanes stop in this folder stops lane 0. Reload the page: the proxy answers with its own Service not running page (503, DL201 service-idle) and the command that starts the lane again.

  • devlanes lane clean 0 --yes stops lane 0 and deletes its data and logs. Run it with 1 for the second worktree’s lane.