Adding Push Notifications to a Lovable App

By the jocapps team4 min read

Short answer

A Lovable app is a web app, so you have two ways to send push notifications: web push, which works in browsers and on iOS only for web apps added to the home screen, or native push through iOS and Android apps built with a wrapper or Capacitor. In both cases you need a server-side component, such as a Supabase Edge Function, that stores device tokens and triggers the messages.

Push notifications are one of the first features founders ask for after launching a Lovable app, and one of the first places where "it is just a web app" starts to matter. Lovable can generate the UI for notification settings in minutes, but delivering a message to a locked phone depends on platform rules that no prompt can change. Here is how the options compare and how to implement each one.

The three routes at a glance

RouteReachesEffortMain limitation
Web push (service worker + Push API)Desktop browsers, Android browsers, iOS/iPadOS 16.4+ only when the web app is added to the home screenLow to mediumMost iPhone users never install a web app to the home screen, so iOS reach is small
Native wrapper (WebView app with push support)iOS and Android app usersLow with a template, medium otherwiseRequires publishing apps in both stores
Capacitor with a push pluginiOS and Android app usersMedium to highYou maintain native projects and build pipelines yourself

Our recommendation: if notifications are central to your product (reminders, chat, order updates), plan for native apps. Web push is a good complement for desktop users, but it is not a reliable channel to iPhone owners.

What every route needs on the backend

Regardless of how the notification reaches the device, the logic looks the same:

  1. Ask for permission at a meaningful moment, for example after a user creates their first reminder, not on the first page load. A denied permission is hard to win back.
  2. Store the token or subscription per user and device in a table, for example push_subscriptions with user_id, platform, token and timestamps. Protect it with Row Level Security.
  3. Trigger sends server-side. A Supabase Edge Function or database webhook reacts to an event (new message, status change) and calls the push service. Never send pushes from the browser; it would expose your credentials.
  4. Handle failures. Remove tokens that the push service reports as invalid, and log delivery errors.
  5. Respect preferences. Let users choose categories and quiet hours, and store those choices server-side.

Route 1: web push in a Lovable app

Web push requires a service worker, a web app manifest and VAPID keys. The flow:

  • Add a manifest and service worker so the app is an installable PWA. You can prompt Lovable to set this up, but review the generated service worker carefully; caching mistakes can serve stale versions of your app.
  • Generate a VAPID key pair. The public key goes into the frontend; the private key stays in your Edge Function secrets.
  • Subscribe the user with the Push API and save the subscription object to your database.
  • Send messages from the Edge Function using a web push library.

On iPhone and iPad, the permission prompt only appears after the user has added the web app to the home screen and opened it from there. Plan an in-app hint explaining that step, and expect low adoption.

Route 2: native push through a wrapper

Wrapping your Lovable app in native iOS and Android shells gives you the standard system notification channels: Apple Push Notification service (APNs) on iOS and Firebase Cloud Messaging (FCM) on Android. Push providers such as OneSignal or Firebase sit on top and give you one API for both platforms. Setup steps typically include:

  • Creating an APNs authentication key in your Apple Developer account and uploading it to the push provider.
  • Creating a Firebase project and adding the Android app configuration.
  • Linking the device's push identifier to the logged-in user, usually by passing the user ID from the web app to the native layer after login.
  • Deep-linking notification taps to the right screen of your web app.

Templates such as WebViewGold include push notification support out of the box, which removes most of the native work. Native push also strengthens your App Store case: Apple's Guideline 4.2 rejects apps that are merely a repackaged website, and genuine native features like notifications are part of the answer (see how to fix a 4.2 rejection).

Route 3: Capacitor

Capacitor turns your Vite build into native projects for Xcode and Android Studio. The official push notifications plugin registers the device and delivers tokens to your JavaScript code, which you then store in Supabase. This route gives developers the most control, including custom notification actions and fine-grained handling of foreground messages, but someone has to maintain the native projects, signing and plugin updates. We compare it in detail in Capacitor vs. WebView wrapper vs. rebuild.

Pitfalls we see repeatedly

  • Asking for permission too early. Users decline reflexively; on iOS you cannot simply ask again.
  • Tokens tied to devices, not users. When a user logs out, unlink the token, or the next person on that device receives their notifications.
  • Sensitive content in the notification text. Lock screens are public. Say "You have a new message", not the message itself, for health, finance or HR apps.
  • No unsubscribe path. Marketing pushes without opt-out invite store complaints and, in the EU, consent problems.
  • Testing only on simulators. Push delivery must be verified on real devices, including when the app is closed.
  • Missing privacy disclosures. Device tokens and identifiers belong in your App Store privacy label and Google Play data safety form.

Choosing quickly

Use web push alone if your users are mainly on desktop. Use a wrapper if you want both stores and push within days and your app works well as a web app. Use Capacitor or a native rebuild if you need deep device integration beyond notifications. For the store side of the wrapper route, our guide on turning a Lovable app into iOS and Android apps continues where this article ends. If you would rather have the setup done for you, WeSetupYourWebViewApp delivers store-ready apps with full source code.

Frequently asked questions

Can a Lovable web app send push notifications to iPhones?

Only via web push, and only after the user adds the web app to the home screen on iOS or iPadOS 16.4 or later. For reliable reach to iPhone users, you need a native app with APNs.

Which push service should I use with a Lovable app?

Firebase Cloud Messaging and OneSignal are common choices for native apps; web push uses VAPID keys and a web push library. Pick one provider that covers all platforms you need.

Where should the push sending logic live?

Server-side, for example in a Supabase Edge Function triggered by database events. The browser should only request permission and register the device.

Do push notifications help with App Store approval?

They are one of several native features that show an app offers more than a website, which matters under Guideline 4.2. They will not fix an app that has little functionality otherwise.

Want a second opinion on your project?

Book a free 30-minute call with our team. We look at your idea, prototype or app and tell you honestly which route makes sense – whether you work with us or not.

Book a free call or write to [email protected]