New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fastify-refresh

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastify-refresh

Browser auto-refresh for Fastify, enabling seamless development.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

fastify-refresh

Gradually restores Fastify's MP. +3mp/tick

Canonical URL: https://alexstevovich.com/r/fastify-refresh-nodejs.


A Fastify plugin for live browser refresh using WebSockets.

Technique

FastifyRefresh automatically injects a WebSocket client to enable live browser refresh—no setup required.


Usage

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:

Suggested Usage

if (isDev) {
    app.register(fastifyWebsocket);
    const fastifyRefresh = new FastifyRefresh(app);

    chokidar
        .watch(publicDir, { ignoreInitial: true })
        .on('all', (event, filePath) => {
            fastifyRefresh.refresh();
        });
}

Installation


npm  install  fastify-refresh

License

Licensed under the Apache License 2.0.

Keywords

fastify

FAQs

Package last updated on 02 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts