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

@electron-releases/adapter-nextjs

v0.1.0

Published

Next.js adapter for serving Electron auto-updates

Downloads

12

Readme

@electron-releases/adapter-nextjs

Next.js App Router adapter for serving Electron auto-updates. Drop-in solution for Squirrel-compatible update servers.

Installation

npm install @electron-releases/adapter-nextjs @electron-releases/provider-github
# or
yarn add @electron-releases/adapter-nextjs @electron-releases/provider-github
# or
bun add @electron-releases/adapter-nextjs @electron-releases/provider-github

Quick Start

1. Create a catch-all API route:

// app/api/releases/[[...path]]/route.ts
import { configureNextjsAdapter } from "@electron-releases/adapter-nextjs";
import { configureGithubProvider } from "@electron-releases/provider-github";

const githubProvider = configureGithubProvider({
  token: process.env.GITHUB_TOKEN!,
  owner: "your-org",
  repo: "your-app",
});

export const GET = configureNextjsAdapter({
  releases: githubProvider.releases,
  assets: githubProvider.assets,
});

2. Configure your Electron app:

// In your Electron main process
import { autoUpdater } from "electron";

autoUpdater.setFeedURL({
  url: "https://your-domain.com/api/releases/update/darwin/" + app.getVersion(),
});

autoUpdater.checkForUpdates();

That's it! Your Electron app now has auto-updates.

Available Endpoints

Once configured, these endpoints are available (relative to /api/releases):

| Endpoint | Description | |----------|-------------| | GET / | List releases. Use ?channel=beta to filter. | | GET /download | Auto-redirect based on User-Agent. | | GET /download/:platform | Download for specific platform. | | GET /update/:platform/:version | Check for updates (Squirrel format). | | GET /update/win32/:version/RELEASES | Squirrel.Windows RELEASES file. |

Configuration Options

configureNextjsAdapter({
  // Required: Provider for release metadata
  releases: githubProvider.releases,

  // Required: Provider for download URLs  
  assets: githubProvider.assets,

  // Optional: Release channels (default: ["alpha", "beta", "stable"])
  channels: ["alpha", "beta", "stable"],
});

Channel Support

Support multiple release channels for staged rollouts:

// Your API route supports channels automatically
export const GET = configureNextjsAdapter({
  channels: ["alpha", "beta", "stable"],
  releases: githubProvider.releases,
  assets: githubProvider.assets,
});

In your Electron app:

// Check for beta updates
autoUpdater.setFeedURL({
  url: `https://your-domain.com/api/releases/update/darwin/${version}?channel=beta`,
});

Channel detection from versions:

  • 1.0.0 → stable
  • 1.0.0-beta.1 → beta
  • 1.0.0-alpha.3 → alpha

Platform Support

The adapter supports all major Electron platforms:

| Platform | Identifier | Aliases | |----------|------------|---------| | macOS (Intel) | darwin | mac, macos, osx | | macOS (Apple Silicon) | darwin_arm64 | mac_arm64 | | Windows | exe | win32, windows, win | | Windows ARM | exe_arm64 | win32_arm64 | | Linux DEB | deb | debian | | Linux RPM | rpm | fedora | | Linux AppImage | AppImage | appimage |

Squirrel Integration

macOS (Squirrel.Mac)

import { autoUpdater } from "electron";

autoUpdater.setFeedURL({
  url: `https://your-domain.com/api/releases/update/darwin/${app.getVersion()}`,
});

autoUpdater.on("update-available", () => {
  console.log("Update available!");
});

autoUpdater.on("update-downloaded", () => {
  autoUpdater.quitAndInstall();
});

autoUpdater.checkForUpdates();

Windows (Squirrel.Windows)

import { autoUpdater } from "electron";

autoUpdater.setFeedURL({
  url: `https://your-domain.com/api/releases/update/win32/${app.getVersion()}`,
});

autoUpdater.checkForUpdates();

Using electron-updater

If you're using electron-builder with electron-updater:

import { autoUpdater } from "electron-updater";

autoUpdater.setFeedURL({
  provider: "generic",
  url: "https://your-domain.com/api/releases",
});

autoUpdater.checkForUpdatesAndNotify();

Direct Download Links

Provide download links on your website:

<!-- Auto-detect platform -->
<a href="https://your-domain.com/api/releases/download">Download</a>

<!-- Specific platforms -->
<a href="https://your-domain.com/api/releases/download/mac">Download for macOS</a>
<a href="https://your-domain.com/api/releases/download/win32">Download for Windows</a>
<a href="https://your-domain.com/api/releases/download/mac_arm64">Download for Apple Silicon</a>

<!-- Specific channel -->
<a href="https://your-domain.com/api/releases/download/mac?channel=beta">Download Beta</a>

API Response Examples

List Releases

GET /api/releases
{
  "channel": "stable",
  "version": "1.2.3",
  "date": "2024-01-15T10:30:00Z",
  "files": {
    "darwin": {
      "name": "MyApp-1.2.3-mac.zip",
      "url": "https://github.com/.../MyApp-1.2.3-mac.zip",
      "size": 85.2
    },
    "exe": {
      "name": "MyApp-1.2.3-win.exe", 
      "url": "https://github.com/.../MyApp-1.2.3-win.exe",
      "size": 72.1
    }
  }
}

Check for Updates

GET /api/releases/update/darwin/1.0.0

Update available:

{
  "name": "1.2.3",
  "notes": "## What's New\n- Bug fixes\n- Performance improvements",
  "pub_date": "2024-01-15T10:30:00Z",
  "url": "https://your-domain.com/api/releases/download/darwin?update=true&channel=stable"
}

No update (returns 204 No Content)

Private Repositories

For private GitHub repos, ensure your GITHUB_TOKEN has repo scope:

const githubProvider = configureGithubProvider({
  token: process.env.GITHUB_TOKEN!, // Needs repo scope for private repos
  owner: "your-org",
  repo: "your-private-app",
});

The adapter automatically generates signed URLs for private asset downloads.

Error Handling

The adapter returns appropriate HTTP status codes:

| Status | Meaning | |--------|---------| | 200 | Success | | 204 | No update available | | 302 | Redirect to download | | 400 | Invalid request (bad platform/version) | | 404 | Not found | | 500 | Server error |

Environment Variables

# Required for GitHub provider
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

TypeScript Support

Full TypeScript support with exported types:

import type {
  AdapterConfig,
  ReleaseInfo,
  PlatformAsset,
  ReleasesProvider,
  AssetsProvider,
} from "@electron-releases/adapter-nextjs";

Related Packages

License

MIT