← Blog · August 8, 2026

Web push with Next.js and Firebase (FCM) — quickstart

Next.js apps can use Firebase Cloud Messaging for web push with a service worker and VAPID key. The plumbing is well documented but repetitive: register the worker, request permission at the right moment, store tokens, and batch sends past FCM's 500-token limit.

Minimal setup path

  • Create a Firebase web app and enable Cloud Messaging.
  • Add a service worker that imports Firebase messaging.
  • Request notification permission after user intent (not on first paint).
  • Register tokens to your backend — or Pushbrain via the web SDK snippet.

Once tokens flow into Pushbrain, you get scheduling, AI copy, audience health, and dashboard sends without building token pruning and campaign APIs yourself. See Firebase integration for the full guide.