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

custom-push

v1.10.0

Published

All-in-one push notification package — npm library + CLI scaffolder with Safari support

Readme

Custom Push CLI

Professional backend scaffolding for Firebase Cloud Messaging with seamless React integration

npm version License: MIT Node.js Version

Custom Push is a production-grade CLI tool that scaffolds robust Firebase Cloud Messaging (FCM) infrastructure. It focuses on zero-fluff backend scaffolding (Express/NestJS) while providing an elite React package for frontend integration, including full support for Next.js App Router.

Features

  • Zero-Config Frontend - Automatically scaffolds a ready-to-use notification handler
  • Backend-focused - Scaffolds production-grade FCMHelper and routes
  • Package-based Frontend - Core logic handled by the custom-push React package
  • App Router Support - Fully compatible with Next.js 13+ (includes 'use client' directives)
  • Service Worker Engine - Integrated on-demand service worker registration
  • Proactive Validation - Mandatory dependency checks for both firebase-admin and firebase
  • Minimal Prompts - Intelligent project detection reduces setup to maximum 4 questions

Quick Start (3 Minutes)

1. Initialize

npx custom-push init

2. Wrap your application (Recommended)

The CLI automatically generates a src/NotificationHandler/ directory. Use it to wrap your app:

import { CustomPushProvider } from 'custom-push';
import { pushConfig } from './src/NotificationHandler/pushConfig';
import { PushNotificationManager } from './src/NotificationHandler/PushNotificationManager';

function RootLayout({ children }) {
  return (
    <CustomPushProvider config={pushConfig}>
      {/* 💎 This component handles all foreground notifications and toasts */}
      <PushNotificationManager />
      {children}
    </CustomPushProvider>
  );
}

3. Add an "Enable Notifications" Button

Check the generated src/NotificationHandler/USAGE.md for a professional, copy-pasteable permission toggle button.

Advanced Frontend Integration

For developers who need full control or prefer not to use the scaffolded handler:

1. Install the package

npm install custom-push

2. Manual Config

import { CustomPushProvider } from 'custom-push';

const pushConfig = {
  apiKey: "your-api-key",
  projectId: "your-project-id",
  vapidKey: "your-vapid-key"
  // ...
};

function Root() {
  return (
    <CustomPushProvider config={pushConfig}>
      <App />
    </CustomPushProvider>
  );
}

3. Core Frontend API

The usePushMessage hook provides a complete interface:

| Property | Type | Description | |----------|------|-------------| | token | string \| null | The unique FCM device token. | | messages | PushMessage[] | Array of foreground notifications received. | | isSupported | boolean | Whether the browser supports Web Push. | | isPermissionGranted | boolean | Current notification permission status. | | requestPermission | () => Promise<boolean> | Triggers the browser permission prompt (Required for Safari). | | sendMessage | (title, body, data?) => Promise<void> | Sends a push via your configured backend. | | clearMessages | () => void | Clears the local messages state. |

Backend Scaffolding

The CLI generates a high-performance FCMHelper in your src/helper/ directory.

import { sendPushNotification } from './helper/FCMHelper';

await sendPushNotification({
  token: 'user-device-token',
  title: 'Order Shipped!',
  body: 'Your package is on its way.',
  route: '/orders/123',
  icon: '/icons/shipping-192.png'
});

Configuration

All local configuration is stored in our_pkg.json. This acts as the single source of truth.

{
  "stack": { "language": "typescript", "scope": "both", "backendFramework": "express" },
  "firebase": { "apiKey": "...", "vapidKey": "..." },
  "backend": { "registerUrl": "http://localhost:3000/push/register" }
}

Documentation

License

MIT © [Your Name]


Made with ❤️ for the React & Node.js communities