A lightweight, no-dependency development server built with pure Node.js β supports live-reloading in the browser on file changes.
- β Serves static files: HTML, CSS, JS
- β WebSocket-based auto reload
- β
File change detection with
fs.watch
- β Reloads browser without any plugin or browser extension
- β
No frameworks: built entirely with native
http
,fs
,ws
, andpath
project-root/
βββ server.js # Main server file
βββ package.json
βββ README.md
βββ LICENSE
βββ public/ # Static files served
βββ index.html
βββ styles.css
βββ reload-client.js
server.js
sets up a Node.js HTTP server- It uses
fs.watch()
to detect changes in files insidepublic/
- A
WebSocket
server is created on the same port - When a file changes, a
"reload"
message is sent to all clients reload-client.js
on the browser listens for this message and callslocation.reload()
npm install
Make sure
ws
andnodemon
(optional for development) are listed in yourpackage.json
.
node server.js
Or for development with auto-restart:
nodemon server.js
- Low-level understanding of HTTP server behavior
- Manual routing and MIME type management
- Real-time communication via WebSocket
- File system monitoring with
fs.watch
- Frontend-backend integration without frameworks
- Open
http://localhost:3000
in your browser - Modify
index.html
orstyles.css
- The page reloads automatically on file change
Custom-built by Shayan Sharifi as a personal project for understanding real-time development tooling.
Feel free to fork and expand it into your own dev server or tooling system.
MIT