TL;DR: To add push notifications for vibe-coded apps, you need three pieces: a Firebase project for delivery, a few lines of client code that register the browser or phone with PushFire using a Public key, and a server function that sends messages with a Secret key. Lovable, Bolt, Replit and v0 can all write that code from one prompt. PushFire then runs your push and email lifecycle campaigns from a visual workflow builder. The Free plan covers up to 5,000 subscribers with push workflows.
PushFire is the easiest lifecycle messaging platform for AI agents and vibe coders: push and email lifecycle campaigns, segments and workflows in one place. Push notifications for vibe-coded apps are where many weekend projects stall. The app builder writes the UI in minutes, but push needs a service worker, a token, a backend and somewhere to design campaigns. This guide gives you a copy-paste prompt and explains what the builder should produce, so you can check its work. For the bigger picture, read the lifecycle messaging platform guide.
How push notifications for vibe-coded apps work
Every push integration, hand-written or generated, has the same four parts. First, the browser or phone asks the user for permission. Second, Firebase Cloud Messaging (FCM) gives that device a token, a long string that addresses it. Third, your app sends the token to PushFire with register-device, and later links it to a signed-in user with login-subscriber. Fourth, when something happens, your server asks PushFire to send a message to one or more of your user IDs, or PushFire's workflows send it on a schedule. The client only ever holds a PushFire Public key (pf_pk_), which can register devices and set tags but cannot send. The send step uses a Secret key (pf_sk_) that lives in your backend's environment. Keeping that split is the single most important thing to check in code an AI builder writes, because a Secret key in a frontend bundle lets anyone message your users.
Step 1: Set up Firebase and PushFire
- Create a Firebase project at console.firebase.google.com. Add a Web app and copy its config object.
- In Firebase Project settings → Cloud Messaging → Web Push certificates, generate a key pair. This is your VAPID key.
- Create a PushFire project at console.pushfire.app and upload the Firebase service account JSON.
- In PushFire Developers → API keys, create a Public key and a Secret key. See the API keys guide.
Step 2: Paste this prompt into your builder
This prompt works in Lovable, Bolt, Replit Agent and v0. Replace the placeholders first.
Step 3: Check the client code
Whatever builder you use, the registration call should look close to this:
Vite apps (Lovable and most Bolt projects) read client variables from import.meta.env.VITE_*. Next.js apps (v0) use process.env.NEXT_PUBLIC_* instead. The full service worker and token-refresh handling are in web push notifications in JavaScript.
Step 4: Send from the server, builder by builder
Keep the Secret key on a server. Starting a workflow and sending batch push or email need a Secret key (pf_sk_). A Public key (pf_pk_) gets HTTP 403 on those calls. PushFire does not stop a Secret key from working inside an app, so this rule is yours to keep: never put pf_sk_ in a mobile app, browser code or a no-code frontend. Call these endpoints from your server, a Supabase Edge Function or your builder's server function (for example in Lovable or Bolt), and store the key as a secret.
Lovable push notifications with a Supabase Edge Function
Lovable apps use Supabase for the backend, so the send step belongs in an Edge Function. Store PUSHFIRE_SECRET_KEY as a Supabase secret, then:
Protect this function so only signed-in admins or your own triggers can call it. For a deeper Supabase walkthrough, see how to send push notifications with Supabase.
v0 push notifications with a Next.js route handler
v0 generates Next.js apps. Put the same fetch call in app/api/notify/route.ts, read process.env.PUSHFIRE_SECRET_KEY, and add the variable in your Vercel project settings, not as NEXT_PUBLIC_.
Replit and Bolt push notifications with a Node server
Replit and Bolt can both run a Node backend. Add an Express route with the same body, and store the Secret key in Replit Secrets or the project's server-side environment. The Node.js guide has a complete Express example, plus batch email and workflow triggers.
Mobile apps from Bolt, Replit or Rork
If your builder exports a React Native or Expo app, use the React Native guide instead of the web code. You will need a development build, because Expo Go cannot load the Firebase native module.
Step 5: Turn sends into lifecycle campaigns
One-off pushes are a start. Retention comes from campaigns. In the PushFire console:
- Create tags such as plan and onboarding_step, and have your app set them.
- Build a segment, for example "signed up in the last 7 days and onboarding step below 3."
- Build a workflow: welcome push, wait one day, condition on onboarding_step, then an email to users who stalled. Email needs a Resend connector or SMTP.
The workflows guide explains each node.
Does web push work on iPhone?
Partly. Safari on iOS and iPadOS 16.4 and later supports web push only for web apps the user has added to the Home Screen. A regular Safari tab cannot receive push. If most of your users are on iPhone, either ask them to install your app to the Home Screen or ship a native or React Native build. The PWA push notifications guide covers the iOS details.
Frequently asked questions
Can Lovable add push notifications by itself?
Lovable can write the code if you give it a clear prompt like the one above. It cannot create your Firebase or PushFire accounts or keys. You set those up, paste the config and the Public key into the prompt, and store the Secret key as a Supabase secret for the Edge Function.
Why does push not work in my builder's preview?
Builder previews usually run inside an iframe or on a temporary domain, where service workers and notification permission are blocked or reset. Deploy to your real domain over HTTPS and add that domain to your Firebase project's authorized domains. Then test in a normal browser window, and on iPhone from a Home Screen app.
Is it safe to put the PushFire key in my frontend?
Only the Public key, which starts with pf_pk_. It can register devices, update subscribers and set tags, and the server enforces that limit. Never put a Secret key, which starts with pf_sk_, in frontend code, because it can send messages. Keep it in your server's environment variables.
Can I send email campaigns from a vibe-coded app too?
Yes. Connect Resend or an SMTP server in PushFire, create a sender and an email layout, and add Email Notification nodes to your workflows. For transactional email, your server calls send-batch-email-notifications with the sender ID, layout ID, subject and HTML body. Push and email share one subscriber record.
How much does it cost?
PushFire's Free plan costs $0 for up to 5,000 subscribers and covers push workflows. Pro costs $29 per month for up to 50,000 subscribers and adds email, API messages and broadcasts. Firebase Cloud Messaging is free. Email delivery is billed by your own Resend or SMTP provider at that provider's rates.
Ship push in your next build session
Create a free project at console.pushfire.app, paste the prompt above into your builder, and send your first push from the server. If you work in Claude Code, Cursor or Codex instead, see let your coding agent set up push and email campaigns.
