Add nodemon.json for full hot-reload (backend + frontend)

nodemon now watches both server.js and client/src/. On any change,
it rebuilds the React app and restarts Express — so git push makes
both backend AND frontend changes visible on the hot domain.

- dev script simplified to "nodemon" (reads nodemon.json config)
- dev:local added for human developers who want Vite HMR
This commit is contained in:
SAAC Daemon
2026-02-18 16:48:02 +01:00
parent 5b37f88477
commit bb1a05af07
3 changed files with 11 additions and 2 deletions

View File

@@ -36,9 +36,12 @@ React + shadcn/ui + Express + PostgreSQL + Redis scaffold for SAAC deployment.
# Install all dependencies (postinstall auto-installs client deps) # Install all dependencies (postinstall auto-installs client deps)
npm install npm install
# Run backend + frontend concurrently (nodemon + Vite HMR) # Run in dev mode (watches server.js + client/src, auto-rebuilds on changes)
npm run dev npm run dev
# Or for local development with Vite HMR (browser hot-reload):
npm run dev:local # Express :3000 + Vite :5173 concurrently
# Or run separately: # Or run separately:
npm run dev:server # Express on :3000 (with nodemon auto-restart) npm run dev:server # Express on :3000 (with nodemon auto-restart)
npm run dev:client # Vite on :5173 (proxies /api to :3000) npm run dev:client # Vite on :5173 (proxies /api to :3000)

5
nodemon.json Normal file
View File

@@ -0,0 +1,5 @@
{
"watch": ["server.js", "client/src"],
"ext": "js,ts,tsx,jsx,css,json",
"exec": "npm run build && node server.js"
}

View File

@@ -5,9 +5,10 @@
"main": "server.js", "main": "server.js",
"scripts": { "scripts": {
"start": "node server.js", "start": "node server.js",
"dev": "concurrently \"nodemon server.js\" \"cd client && npm run dev\"", "dev": "nodemon",
"build": "cd client && npm run build", "build": "cd client && npm run build",
"postinstall": "[ -d client ] && cd client && npm install || true", "postinstall": "[ -d client ] && cd client && npm install || true",
"dev:local": "concurrently \"nodemon server.js\" \"cd client && npm run dev\"",
"dev:server": "nodemon server.js", "dev:server": "nodemon server.js",
"dev:client": "cd client && npm run dev" "dev:client": "cd client && npm run dev"
}, },