Skip to content

Feature request: serve a Node.js app (Next.js, Nuxt, Vite) as a site, with Flock running its dev server #97

Description

@omarabulkhair-66

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 optional command on 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.1 for next 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).
  • 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_server on a site's status, PATCH /v1/sites/{name} with server / command, update_site set_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

  1. added
    help wanted
    and removed on Nov 3, 2026
  2. added theissue type on Nov 3, 2026
  3. added this to the v1.x milestone on Nov 3, 2026
  4. onairmarc commented on Nov 3, 2026

    @onairmarc
    Member

    Assigned to you @omarabulkhair-66! Have at it! Just make sure that any UI changes are made in all three OS platforms

  5. modified the milestone: v1.1.0 on Nov 7, 2026
  6. babul commented on Nov 7, 2026

    @babul

    This would be fantastic! I could use Flock for my Astro sites then, which I cannot do from Herd 💪🏽

  7. removed
    help wanted
    on Nov 8, 2026
  8. added this to the v1.1.0 milestone on Nov 8, 2026
  9. removed this from the v1.1.0 milestone on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions