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

custom-push

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-push

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

latest
Source
npmnpm
Version
1.10.0
Version published
Weekly downloads
88
-37.59%
Maintainers
1
Weekly downloads
 
Created
Source

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

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:

PropertyTypeDescription
tokenstring | nullThe unique FCM device token.
messagesPushMessage[]Array of foreground notifications received.
isSupportedbooleanWhether the browser supports Web Push.
isPermissionGrantedbooleanCurrent 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() => voidClears 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

Keywords

firebase

FAQs

Package last updated on 27 Mar 2026

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