Gradually restores Fastify's MP. +3mp/tick
A zero-config, automatic browser refresh tool for Fastify.
Designed for seamless live updates while developing your front-end.
Github: https://www.github.com/alexstevovich/fastify-refresh.
Tech Summary: FastifyRefresh automatically injects a WebSocket client to enable live browser refresh—no setup required.
import fastifyWebsocket from '@fastify/websocket';
import { FastifyRefresh } from 'fastify-refresh';
// Register WebSockets
app.register(fastifyWebsocket);
// Create FastifyRefresh instance
const fastifyRefresh = new FastifyRefresh(app);
// Trigger refresh manually when needed
fastifyRefresh.refresh();
You decide when you trigger the refresh. I usually just trigger it with something like chokidar:
if (isDev) {
app.register(fastifyWebsocket);
const fastifyRefresh = new FastifyRefresh(app);
chokidar
.watch(publicDir, { ignoreInitial: true })
.on('all', (event, filePath) => {
fastifyRefresh.refresh();
});
}
"No configuration, no extra steps—just drop it in and it works."
- Zero Config - Just use it, and it auto-injects everything for you.
- Unopinionated - Trigger it manually or automate it with a file watcher.
- Minimal - Lightweight, atomic, and dependency-free.
npm install fastify-refresh
Licensed under the Apache License 2.0.