Instruction file imported from EdgeDesk-MB/EdgeDesk (
.cursor/rules/dev-server.mdc). Copyright stays with the author.
Dev server (Edgeways)
Sam needs continual localhost uptime. Treat the running Next server as sacred.
Do
- If nothing listens on
:3000, start withnpm run dev:detachedfromedgeways/(supervised, survives agent-shell cleanup). Confirm with a quick curl. - Prefer reading
edgeways/data/dev-keep.pid/dev-keep.logover restarting. - Leave a healthy server alone while you edit code (HMR handles it).
Do not
- Do not
pkill -f "next"/pkill -f "next dev"/ kill listeners on 3000 unless Sam explicitly asked you to restart the server. - Do not
rm -rf edgeways/.nextwhile a server is running (causes ENOENT storms and dead pages). - Do not start a second
npm run devthat steals another port (3001…). - Do not rely on an agent background shell as the long-lived server; use
dev:detachedor tell Sam to runnpm run devin their own terminal.
Why the site dies after ~15 minutes
Next.js 16 exits the worker when heap crosses ~80% (Server is approaching the used memory threshold, restarting…). That is normal. Downtime happens when the
parent process tree is gone (agent shell abort, blanket pkill). The keep
supervisor in edgeways/scripts/dev-keep.mjs exists to bring it back.