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

@lerix-dev/lerix-js

v1.1.0

Published

Lerix Web Push SDK, browser push notifications with no backend of your own.

Readme

Lerix Web Push SDK

Browser push notifications for Lerix — no Firebase, no OneSignal, just VAPID (Web Push standard), matching the same Lerix.notifications.* API the Flutter SDK already has.

1. Install

npm install @lerix-dev/lerix-js

Or drop the pre-built script directly into a page with no build step:

<script src="https://unpkg.com/@lerix-dev/lerix-js/dist/lerix.global.js"></script>

2. Copy the service worker

Web Push requires a service worker file served from your site's own origin — copy node_modules/@lerix-dev/lerix-js/sw/lerix-sw.js to your site's public root so it's reachable at https://yoursite.com/lerix-sw.js (or any path; you pass it to subscribe() if it's not at the default).

The SDK registers it on its own /lerix/ scope, so it works alongside any service worker your app already has at / (a PWA, next-pwa, Workbox).

3. Generate a Web Push key

From the dashboard: Notifications → Settings → Web Push → Generate keys. This is a one-click step — Lerix generates and stores the key pair for you; there's nothing to copy into your code.

4. Use it

import { Lerix } from "@lerix-dev/lerix-js";

Lerix.init({
  apiKey: "your-api-key",
  projectId: "your-project-slug",
});

await Lerix.notifications.init();

Lerix.notifications.setOnNotificationReceived((payload) => {
  // Fired while a tab is open.
  console.log(payload.title, payload.body);
});

Lerix.notifications.setOnNotificationTapped((payload) => {
  // Fired when the user clicks the notification — including one that
  // opened the page from a fully closed tab.
  const screen = payload.metadata.screen;
});

// Prompts for permission and subscribes this browser.
const deviceId = await Lerix.notifications.subscribe();
// `deviceId` is what you pass in `deviceTokens` when sending a notification
// to this browser specifically, from the dashboard or the REST API.

// After login: link this browser to your own user id, so your server can send
// to `externalUserIds` and reach every device that user is signed in on.
await Lerix.setUser(user.id, { identityHash }); // identityHash only if verification is on
// On logout:
await Lerix.clearUser();

identityHash is hex(HMAC-SHA256(identity secret, externalId)), computed by your backend. The id is stored locally and re-sent if this browser registers a new Lerix user.

API

| Method | Description | |---|---| | Lerix.init(config) | Configures the SDK. Call once. | | Lerix.notifications.init() | Registers this app/user with the backend. Call before anything else on notifications. | | requestPermission() | Prompts for notification permission. Returns true if granted. | | checkPermissionStatus() | "granted", "denied", "default", or "unsupported". | | subscribe(swPath?) | Registers the service worker and subscribes to push. Returns the device id. | | getDeviceId() | The device id from the last subscribe() call, if any. | | setOnNotificationReceived(cb) | Fired while a tab is open. | | setOnNotificationTapped(cb) | Fired on click — delivered reliably even from a closed-tab tap. | | setUser(externalId, { identityHash? }) | Links this browser to your own user id (also Lerix.setUser). Safe before init(). | | clearUser() | Unlinks this browser from its user (also Lerix.clearUser). | | getExternalUserId() | The id passed to setUser, or null. |

Browser support

Chrome, Firefox, and Edge support Web Push fully. Safari requires macOS 13+ / iOS 16.4+ — older Safari doesn't support the standard at all.