Description
What
A site's Runs on could be Node.js, next to PHP-FPM and FrankenPHP: Flock runs the project's npm run dev (or a command of the site's own) with the site's Node.js version, on a loopback port of its own like a FrankenPHP site, restarts it when it exits, and serves the site's domains and HTTPS from it.
cd ~/Code/my-next-app
flock node serve # npm run dev -- --port <port>, PORT set too
flock node serve --command "pnpm dev --port {port}"
flock node restart
flock node unserve # back to PHP
In the apps: Node.js (npm run dev) under Settings → Sites → Server → Runs on, with the dev server's state (running on Node.js 22.x, starting, or why not), Restart, Show Log and an optional Command; the panel shows the Node.js version instead of the PHP one.
Why
Many Laravel developers also keep Next.js, Nuxt or Vite apps in the same projects folder. Today, Flock parks them as PHP sites with no index, and Flock has no way to serve them. With #73 (flock proxy) they can be reached at a .test name, but a proxy only knows a port: it has no project folder, so none of what a site has applies. There's no Node.js version (.nvmrc / isolate / pin), no worktrees and no Share, and the developer still starts and restarts the dev server by hand on a port they pick.
Flock already has all the pieces:
- per-project Node.js versions;
- a supervisor that runs a process per site on a loopback port (FrankenPHP);
- worktrees;
- shares.
Possible approach
- config / daemon:
server: "node"and an optionalcommandon a site. The daemon:- runs
npm run dev -- --port <port>with the site's Node.js (node.Resolve+ npm's env); - passes
--hostname 127.0.0.1fornext dev, which otherwise listens on the LAN; - tells Vite the site's domains (
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS); - proxies the site's names to
localhost:<port>, with WebSocket upgrades (hot reload).
- runs
- supervisor: stop the dev server's whole process group/tree, since npm's child holds the port.
- worktrees: a Node.js site's worktrees run dev servers of their own, at their own addresses.
- share: a share of a Node.js app goes to its dev server. It gets the site's own name as Host and Origin, so Vite and Next.js take the tunnel's requests. Forwarded headers are set as for PHP, and
.env*and.git/are never served. Visitors see the dev server, error overlay included, and the share says so. - status / API / MCP:
node_serveron a site's status,PATCH /v1/sites/{name}withserver/command,update_siteset_server: node. - apps: macOS, Windows and Linux.
I have this working locally on macOS, on top of #87 (flock proxy, for #73), and can send it as a PR of its own if this fits the project.
Activity
onairmarc commentedon Nov 3, 2026
Assigned to you @omarabulkhair-66! Have at it! Just make sure that any UI changes are made in all three OS platforms
babul commentedon Nov 7, 2026
This would be fantastic! I could use Flock for my Astro sites then, which I cannot do from Herd 💪🏽