npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rayweefa/electron-fetch-server

v0.1.4

Published

Remix adapter for Electron's protocol handler using Web Fetch API

Readme

@remix-run/electron-fetch-server

Remix adapter for Electron's protocol.handle() API. This package allows you to run Remix applications inside Electron using custom protocol handlers with the Web Fetch API.

Installation

npm install @remix-run/electron-fetch-server

Quick Start

// main.js (Electron main process)
const { app, protocol, BrowserWindow } = require("electron");
const { createRequestListener } = require("@remix-run/electron-fetch-server");

app.whenReady().then(async () => {
    // Create and register the protocol handler
    protocol.handle(
        "myapp",
        createRequestListener((request) => {
            // Your handler logic here
            return new Response("Hello from Electron!");
        })
    );

    // Create window and load your app
    const mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
    });

    mainWindow.loadURL("myapp:///");

    if (process.env.NODE_ENV === "development") {
        mainWindow.webContents.openDevTools();
    }
});

With @remix-run/fetch-router

// Example: Using with @remix-run/fetch-router
import { app, BrowserWindow, protocol } from "electron";
import { createRouter, html, json, route } from "@remix-run/fetch-router";
import { logger } from "@remix-run/fetch-router/logger-middleware";
import { createRequestListener } from "@remix-run/electron-fetch-server";

// Create a simple router
const router = createRouter();

const routes = route({
    home: "/",
    about: "/about",
    api: "/api/data",
});

// Route handlers
const showHome = () => {
    return html(`
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>Remix + Electron</title>
        <style>
          body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 40px;
          }
          h1 { color: #3178c6; }
          a {
            color: #3178c6;
            text-decoration: none;
            margin-right: 20px;
          }
          a:hover { text-decoration: underline; }
        </style>
      </head>
      <body>
        <h1>Welcome to Remix + Electron! 🚀</h1>
        <nav>
          <a href="/">Home</a>
          <a href="/about">About</a>
          <a href="/api/data">API</a>
        </nav>
        <p>This is a Remix app running inside Electron using custom protocol handlers.</p>
      </body>
    </html>
  `);
};

const showAbout = () => {
    return html(`
    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <title>About - Remix + Electron</title>
        <style>
          body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 40px;
          }
          h1 { color: #3178c6; }
          a { color: #3178c6; text-decoration: none; }
          a:hover { text-decoration: underline; }
        </style>
      </head>
      <body>
        <h1>About</h1>
        <p><a href="/">← Back to Home</a></p>
        <p>This demonstrates @remix-run/electron-fetch-server with @remix-run/fetch-router.</p>
        <p>Using Electron version: ${process.versions.electron}</p>
        <p>Using Chrome version: ${process.versions.chrome}</p>
      </body>
    </html>
  `);
};

const getApiData = () => {
    return json({
        message: "Hello from Remix in Electron!",
        versions: process.versions,
        platform: process.platform,
    });
};

// Map routes
router.use(logger());
router.map(routes.home, showHome);
router.map(routes.about, showAbout);
router.map(routes.api, getApiData);

// other routes
// router.map(routes.resource, handlers)

function createWindow() {
    const mainWindow = new BrowserWindow({
        width: 1200,
        height: 800,
        webPreferences: {
            nodeIntegration: false,
            contextIsolation: true,
        },
    });

    mainWindow.loadURL("myapp:///");
}

app.whenReady().then(async () => {
    try {
        // Use createRequestListener with the router
        protocol.handle(
            "myapp",
            createRequestListener((request) => {
                try {
                    return router.fetch(request);
                } catch (e) {
                    console.error("Router error:", e);
                    return new Response("Something went wrong", {
                        status: 500,
                    });
                }
            })
        );

        createWindow();

        app.on("activate", () => {
            if (BrowserWindow.getAllWindows().length === 0) {
                createWindow();
            }
        });
    } catch (error) {
        console.error("Failed to setup app:", error);
        app.quit();
    }
});

app.on("window-all-closed", () => {
    if (process.platform !== "darwin") {
        app.quit();
    }
});