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

@msgly/fcm

v1.4.0

Published

Firebase Cloud Messaging adapter for Msgly — push notifications for Android, iOS and web

Readme

@msgly/fcm

📖 Docs & channel reference: https://ayushjain070401.github.io/msgly/

Firebase Cloud Messaging adapter for Msgly — push notifications for Android, iOS and web.

npm install @msgly/core @msgly/fcm
import { createHub } from '@msgly/core';
import { createFcmAdapter } from '@msgly/fcm';

const fcm = createFcmAdapter({
  projectId: process.env.FCM_PROJECT_ID!,
  serviceAccountEmail: process.env.FCM_CLIENT_EMAIL!,
  privateKey: process.env.FCM_PRIVATE_KEY!,
  defaultTitle: 'Acme',
});

const hub = createHub().register(fcm);

// contact.channelUserId is the device registration token
await hub.send({
  channel: 'fcm',
  account: { channel: 'fcm', channelAccountId: 'acme-app' },
  contact: { channel: 'fcm', channelUserId: deviceToken },
  content: { type: 'text', text: 'Your order shipped' },
  metadata: { title: 'Order update', data: { orderId: '42' } },
});

All three credentials come from the service account JSON (Firebase Console → Project settings → Service accounts). privateKey may contain escaped \n — the adapter normalises it, so an env var works.

Push is one-way

There is no inbound webhook. handleWebhook always returns an empty array, and verifySignature always returns true, because there is nothing to receive or verify. Delivery analytics come from FCM's BigQuery export, not a callback.

Dead tokens

An app uninstall leaves a registration token that fails forever. Retrying it wastes quota and inflates your failure rate, so the adapter marks those failures permanent:

| FCM error | Meaning | Permanent | | --- | --- | --- | | UNREGISTERED | App uninstalled, or token rotated | ✅ | | SENDER_ID_MISMATCH | Token belongs to another Firebase project | ✅ | | INVALID_ARGUMENT | Malformed token | ✅ | | UNAVAILABLE, QUOTA_EXCEEDED | Temporary | ❌ |

Feed them into core's suppression store so your token list cleans itself:

import { applyDeliveryReceipt } from '@msgly/core';

const receipt = await hub.send({ /* ... */ });
await applyDeliveryReceipt(receipt, 'fcm', suppression);

Note the adapter reads the real code from error.details[].errorCode — the top-level status is a generic gRPC name that cannot tell a dead token from a bad request.

Topics beat loops for broadcast

Sending to 100,000 device tokens one at a time is slow and burns quota. A topic reaches every subscriber in one call, with no per-device rate limit:

await fcm.sendToTopic('news', { title: 'Acme', body: 'Big news' });

Subscribe devices to topics from your app client. Use sendBulk only when messages are genuinely per-recipient.

Images

FCM has no media upload — the device fetches the image itself, so pass a public URL. A platform-id reference fails fast rather than being silently dropped.

License

MIT