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

@emito/provider-fcm

v0.1.0

Published

Firebase Cloud Messaging push provider plugin for Emito.

Readme

@emito/provider-fcm

Firebase Cloud Messaging push provider plugin for Emito.

License Types

TypeScript Zod

What it is

@emito/provider-fcm is a push delivery adapter that sends Emito notifications through Firebase Cloud Messaging. It wraps the official firebase-admin SDK in a ProviderPlugin — the common interface Emito uses to dispatch a notification to any channel — so the engine can hand it a push payload with one or more device tokens and get back a normalized DeliveryResult.

Provider plugins keep Emito provider-agnostic: the core engine never talks to Firebase directly. It only knows the ProviderPlugin contract, and this package translates that contract into FCM send calls and maps Firebase's failures back into Emito's typed error model.

Install

@emito/provider-fcm is a workspace package in the Emito monorepo and is not yet published to npm. Inside the monorepo, depend on it with the workspace protocol and add firebase-admin, which is required at runtime:

// package.json
{
  "dependencies": {
    "@emito/provider-fcm": "workspace:*",
    "firebase-admin": "^13.0.0"
  }
}

firebase-admin is the official Firebase Admin SDK. The plugin is designed to be registered with the Emito core engine alongside other channel providers. Standalone publishing to npm is planned.

Usage

createFcmProvider validates its config, initializes a dedicated Firebase Admin app with the supplied service-account credentials, and returns a ProviderPlugin bound to the push channel. Register the returned plugin with the Emito engine, which calls deliver with each push payload.

import { createFcmProvider } from "@emito/provider-fcm";

const provider = createFcmProvider({
  projectId: process.env.FCM_PROJECT_ID!,
  clientEmail: process.env.FCM_CLIENT_EMAIL!,
  privateKey: process.env.FCM_PRIVATE_KEY!,
});

// The engine invokes this; shown here directly for illustration.
const result = await provider.deliver({
  channel: "push",
  tokens: ["fcm-device-token-1", "fcm-device-token-2"],
  title: "Build complete",
  body: "Your deployment finished successfully.",
  data: { url: "/deployments/123" },
  metadata: {
    notificationId: "ntf_123",
    subscriberId: "sub_456",
    eventType: "deploy.succeeded",
  },
});

console.log(result.success, result.providerMessageId, result.invalidTokens);

Each token is sent independently. If at least one send succeeds, deliver resolves with { success: true }, a providerMessageId of the form "<succeeded>/<total>", and an optional invalidTokens array listing tokens Firebase reported as no longer registered. If every token fails it throws an EmitoError (from @emito/types) with a classified code — the engine uses these for retry and routing decisions. An empty tokens array is treated as a no-op success.

API surface

| Export | Kind | Description | | --- | --- | --- | | createFcmProvider(config) | function | Returns a ProviderPlugin for the push channel backed by Firebase Cloud Messaging. | | FcmProviderConfigSchema | z.ZodObject | Zod schema used to validate provider config. | | FcmProviderConfig | type | Inferred config type: projectId, clientEmail, and privateKey. |

Configuration

| Field | Type | Required | Description | | --- | --- | --- | --- | | projectId | string | yes | Firebase project ID from the service account. | | clientEmail | string | yes | Service-account client email. | | privateKey | string | yes | Service-account private key. |

Error mapping

Firebase messaging errors are translated into EmitoError codes from @emito/types so the engine can act on them consistently:

| Condition | Code | Retryable | | --- | --- | --- | | Unregistered / invalid registration token | DELIVERY_INVALID_ADDRESS | no | | Rate / message-rate limits | RATE_LIMITED | yes | | Server unavailable / internal / unknown error | PROVIDER_UNAVAILABLE | yes | | Invalid argument / mismatched credential, other rejections | DELIVERY_REJECTED | no | | Non-FCM / unrecognized error | PROVIDER_UNAVAILABLE | yes | | Invalid config | CONFIG_INVALID | — (thrown at construction) |

When a token fails with an invalid-address code, it is collected into result.invalidTokens rather than aborting the whole batch — callers can prune those tokens from their subscriber records.

Part of Emito

@emito/provider-fcm is one package in the Emito monorepo — self-hosted, provider-agnostic notification infrastructure for Node.js and TypeScript.

License

MIT — part of the Emito project.