Developer guide

Everything your web app can do inside a WebWrap app, and how to get it into the App Store and Google Play. Most of it you can paste straight into Lovable, Bolt or Replit.

How it works

Your app is a native iPhone and Android app that shows your website. When you change your site, the app changes too, with no rebuild and no App Store review. You only rebuild when you change something on the app itself: its name, icon, colour, tabs or features.

Apps are built on Expo's servers under your Expo account, and published under your Apple and Google accounts. You can download the full project code from your dashboard at any time.

Using native features

Inside the app, your site gets a window.WebWrap object. In a normal browser it isn't there, so always check first:

if (window.WebWrap) {
  // Running inside your iPhone or Android app
  console.log(window.WebWrap.platform); // "ios" or "android"
}

Calls don't return values directly. Ask for something, then listen for the answer with WebWrap.on(event, callback):

CallAnswer eventWhat it does
requestPushPermission()PUSH_TOKENAsks to allow notifications. { granted, token }
setUserId(id)Links this phone to your signed-in user, so you can notify just them. Call with null on sign-out.
signInApple()AUTH_RESULTNative Sign in with Apple. { success, provider, token, email, name }
signInGoogle()AUTH_RESULTNative Google sign-in. { success, provider, token }
getProducts()PRODUCTS_RESULTYour RevenueCat offering. { success, packages }
purchaseProduct(id)PURCHASE_RESULTBuys a product (store product ID or RevenueCat package ID). { success, entitlements }
restorePurchases()PURCHASE_RESULTRestores earlier purchases (Apple requires a button for this).
getEntitlements()ENTITLEMENTS_RESULTWhat the user has paid for. { success, entitlements }

If a feature is switched off for your app, the answer comes back with success: false and an error saying so, so your site is never left waiting.

Things that work with no code at all: links to other websites open in a sheet with a Done button, mailto: and tel: links open the right app, file and photo uploads, date pickers, and the bar behind the clock matches the top of your page.

Push notifications

Switch on Push Notifications for your app. By default the app asks for permission the first time it opens; you can turn that off and ask at a better moment with WebWrap.requestPushPermission().

Phones that allow notifications appear in your dashboard, where you can send a message to everyone or to one user. A notification can open a page of your site when tapped.

To send to one user, tell the app who's signed in. Paste this into your AI builder:

When a user signs in (and when the app loads with a user already signed in), run:
  if (window.WebWrap) window.WebWrap.setUserId(String(user.id));
When they sign out, run:
  if (window.WebWrap) window.WebWrap.setUserId(null);

One-time setup

Apple and Google each need a key before notifications reach phones. You add these to your project on expo.dev (the project WebWrap created in your Expo account), not to WebWrap.

iPhone

  1. On developer.apple.com > Keys, create a key with Apple Push Notifications service (APNs) ticked, and download it.
  2. On expo.dev, open your app's project, then Credentials > iOS > your bundle ID > Push Key, and add the key.

Android

In your app's settings, turn on Push notifications and click Set up with Google. Sign in with your Google account and pick Create a new Firebase project (or a Firebase project you already have). WebWrap sets up Firebase in your own Google account and gives Expo the key it needs, so there's nothing to copy. It's included the next time your app builds.

WebWrap only uses your Google sign-in once, for the setup, and doesn't keep it. It creates a service account called webwrap-push in that project, which can only send push notifications.

If your Google account is a work account that blocks this, you can set it up by hand instead:

  1. In the Firebase console, create a project (free), then Add app > Android with your app's package name. It's shown under Push Notifications in your WebWrap app settings.
  2. Download google-services.json, click Paste my own google-services.json instead in your app settings, paste it, then save (this rebuilds the app).
  3. In Firebase, open Project settings > Service accounts > Generate new private key. On expo.dev, open your project, then Credentials > Android > FCM V1 service account key, and upload that file.

Send from your server

Send notifications from your backend, for example when an order ships. Your app's secret key is in the dashboard under Push notifications.

curl -X POST https://webwrap.dev/api/push/send \
  -H "Authorization: Bearer sk_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{"title": "Your order shipped", "body": "Tap to track it", "url": "/orders/123", "userId": "42"}'
Field
title, bodyRequired. Up to 100 and 500 characters.
urlOptional. A page path like /orders or a full https:// address to open when tapped.
userIdOptional. Only phones linked with setUserId to this user. Leave out to send to everyone.

The answer is { "success": true, "sent": 12, "failed": 0, "devices": 12 }. Keep the secret key on your server; never put it in your website's code.

Apple & Google sign-in

Sign-in buttons already on your site (Supabase, Firebase, Clerk and so on) keep working: the sign-in page opens in a sheet over your app and comes back when it's done. You don't need to change anything.

For the native Apple and Google sign-in sheets, switch on Apple / Google Sign-In and call WebWrap.signInApple() or WebWrap.signInGoogle(). Apple gives you an identity token and Google an access token, to verify on your server. Google's native sign-in needs a web client ID from your Google Cloud project, entered in your app settings.

Apple requires apps that offer Google sign-in to offer Sign in with Apple too.

In-app purchases

Apple and Google require digital goods inside apps to be sold through their own payment systems. WebWrap uses RevenueCat, which is free until you earn $2,500 a month.

  1. Apple: in App Store Connect, sign the Paid Apps agreement and add your bank and tax details (Business). Products won't load in the app until this is active. Then create a subscription group and its subscriptions, each with a price, a display name and a review screenshot.
  2. Google: set up a payments profile in the Play Console. Google only lets you create subscriptions after your first upload, so do the first build and upload (see Publishing: Google Play) before creating them under Monetize > Subscriptions.
  3. In RevenueCat, add an iOS and an Android app, import the products, put them in an offering, and create an entitlement such as premium.
  4. Copy the public API keys (appl_... and goog_...) into your app settings in WebWrap, then save and rebuild.
  5. After sign-in, call WebWrap.setUserId(String(user.id)). Purchases then belong to that user, so your backend and RevenueCat's webhooks see the same ID, and a subscription follows them to other phones. Purchase, restore and entitlement calls made after it wait until the switch is done, and the app sends USER_ID_SET when it is.
WebWrap.on('PRODUCTS_RESULT', (r) => showPlans(r.packages));
WebWrap.getProducts();

WebWrap.on('PURCHASE_RESULT', (r) => {
  if (r.success) unlockPremium();
});
WebWrap.purchaseProduct('$rc_monthly'); // the package identifier

WebWrap.restorePurchases(); // Apple requires a Restore button

Getting through review. Your paywall must show the price and length of each plan, a Restore button, and links to your terms and privacy policy. Submit your first subscriptions together with an app version. If your site sells digital goods with Stripe or another web checkout, hide that checkout inside the app (if (window.WebWrap)), or Apple will reject the app.

Publishing: App Store

  1. Connect your Apple developer account in the dashboard.
  2. In App Store Connect, click + > New App and pick your app's bundle ID (shown in the dashboard). If the bundle ID isn't in the list yet, click Rebuild once in WebWrap; the first iPhone build registers it.
  3. Click Build for the stores in the dashboard. Expo builds the app and uploads it to App Store Connect.
  4. In App Store Connect, fill in the listing: screenshots (6.7" and 6.5" iPhone), description, keywords, support URL, privacy policy URL, age rating and the App Privacy questions.
  5. Choose the build under Build, then click Add for Review.

Getting through review. Apple rejects apps that feel like a website in a frame (guideline 4.2). Help yours by switching on native features you actually use, adding a tab bar if your site has a few main sections, and making sure every page works well on a phone. If your app needs an account, give Apple a demo login in the review notes.

Publishing: Google Play

  1. Create the app in the Play Console with your app's package name (shown in the dashboard).
  2. Click Build for the stores. Google only lets an app's very first upload happen by hand: download the .aab file and upload it under Test and release > Internal testing.
  3. Connect Google Play in the dashboard. From then on, each store build uploads to internal testing automatically.
  4. Fill in the store listing, content rating, data safety and target audience, then promote the release to production.

New personal Play Console accounts must run a closed test with at least 12 testers for 14 days before they can publish to production. Company accounts don't.

Moving from another app builder

If your site was set up for another app builder, such as Natively, Despia or Median, it still calls that builder's code, which does nothing inside a WebWrap app. Everything else on your site works as normal. Paste this into Lovable, Bolt or Replit to switch over. It works whichever builder you used before:

This app is moving to WebWrap from another native app builder (for example Natively, Despia
or Median). Find that builder's SDK and remove it: its script tag or npm package (such as
natively-frontend, despia-native or median-js-bridge) and every call to it (such as
window.natively and Natively* classes, despia(...), window.median, or median:// and gonative://
links). If you find a different builder's SDK, treat it the same way.
Replace each call with WebWrap, which adds window.WebWrap inside the app (it is undefined in a
normal browser, so always check `if (window.WebWrap)` first):
- Push: WebWrap.requestPushPermission(); WebWrap.on('PUSH_TOKEN', r => ...). After sign-in call
  WebWrap.setUserId(String(user.id)); on sign-out WebWrap.setUserId(null).
- Apple sign-in: WebWrap.signInApple(); Google: WebWrap.signInGoogle();
  WebWrap.on('AUTH_RESULT', r => { if (r.success) verify r.token on the server; Apple gives an identity token, Google an access token }).
- Purchases (RevenueCat): WebWrap.getProducts() -> 'PRODUCTS_RESULT' { packages };
  WebWrap.purchaseProduct(packageId) and WebWrap.restorePurchases() -> 'PURCHASE_RESULT'
  { success, entitlements }; WebWrap.getEntitlements() -> 'ENTITLEMENTS_RESULT'.
- External links: just use normal links; WebWrap opens other sites in an in-app browser sheet.
- Anything with no WebWrap equivalent: keep the normal web version.
Keep the web (non-app) behaviour exactly as it is.

Using Capacitor too

If your site uses Capacitor (Lovable sometimes adds it for mobile), nothing breaks in a WebWrap app: Capacitor works the way it does on your website. But features like push notifications, in-app purchases and Apple or Google sign-in then only get their web version. To make them native in WebWrap, add WebWrap's calls next to Capacitor's. You can keep Capacitor if you also build your app with it. Paste this into Lovable, Bolt or Replit:

This app uses Capacitor and will also run inside a WebWrap app. Keep Capacitor exactly as it
is. Inside WebWrap, Capacitor reports the 'web' platform, so add a WebWrap path wherever the
app uses Capacitor for push notifications, in-app purchases or Apple/Google sign-in.
WebWrap adds window.WebWrap inside its app (it is undefined everywhere else), so: if
Capacitor.isNativePlatform() use Capacitor, else if (window.WebWrap) use WebWrap, else use the
web version.
- Push: WebWrap.requestPushPermission(); WebWrap.on('PUSH_TOKEN', r => ...). After sign-in call
  WebWrap.setUserId(String(user.id)); on sign-out WebWrap.setUserId(null).
- Apple sign-in: WebWrap.signInApple(); Google: WebWrap.signInGoogle();
  WebWrap.on('AUTH_RESULT', r => { if (r.success) verify r.token on the server; Apple gives an identity token, Google an access token }).
- Purchases (RevenueCat): WebWrap.getProducts() -> 'PRODUCTS_RESULT' { packages };
  WebWrap.purchaseProduct(packageId) and WebWrap.restorePurchases() -> 'PURCHASE_RESULT'
  { success, entitlements }; WebWrap.getEntitlements() -> 'ENTITLEMENTS_RESULT'.
Don't change anything else, and keep the web (non-app) behaviour exactly as it is.

Your code

Download your app's Expo project from the dashboard (Your code > Download code). It's a standard Expo app: settings are in webwrap.config.json and app.json. To build it yourself:

npm install
npx expo run:ios                 # run in the iPhone Simulator (Mac)
npx eas-cli build --platform all # build on Expo's servers
npx eas-cli submit               # send to the stores

If you stop using WebWrap, your apps stay in the stores and keep working, and the code and Expo project stay yours.