To convert a React application into a Progressive Web App, you need to follow these steps:
Create a manifest.json file that provides metadata about the app, including icons, colours, and a short name.
This file helps browsers identify and display your app as an installable PWA.
Include the <link> tag to the manifest.json file in the <head> section of your HTML. This allows browsers to discover your app as a PWA.
Implement a service worker, which is a JavaScript file that runs in the background and controls how your app behaves.
It enables features like offline access and background syncing.
In your React app's main file (e.g., index.js), register the service worker using the serviceWorker.register() method.
This should be done after your app has loaded.
Use the service worker to cache important resources such as HTML, CSS, JavaScript, and assets (images, fonts) in the browser's cache.
This allows your app to work offline and load faster on subsequent visits.
Create an offline page that displays when the user is offline and tries to access your app.
This page can provide basic information and a user-friendly experience.
Implement an app shell architecture, which involves caching the minimal HTML, CSS, and JavaScript required to display the basic app structure.
This shell loads quickly and is then populated with dynamic data.
PWAs require a secure origin (HTTPS) to ensure data security. Make sure your app is hosted on a secure server.
Optimize your app's performance by minimizing code, optimizing images, and using techniques like lazy loading.
If you want to enable push notifications, you need to integrate a push notification service like Firebase Cloud Messaging (FCM) or another compatible service.
How would you add a web manifest to an existing React app and make sure it’s referenced correctly?
What steps do you take to register a service worker using create‑react‑app’s default setup?
If the ‘Add to Home Screen’ prompt never appears on Android, what are the common things you would check?
We enabled a service worker but some API calls still fail when the network is offline. Walk me through how you’d debug the caching strategy.
Why might a service worker stop updating after we changed the build folder structure, and how would you fix it?
When converting a React app to a PWA, what trade‑offs do you consider between using Workbox versus writing a custom service worker?
Design a caching strategy for a React e‑commerce PWA that balances fresh product data with offline availability. What patterns would you use and why?
How would you handle large image assets in a PWA to avoid exceeding storage quotas on low‑end devices?
If the PWA is served from a CDN with HTTP/2, what impact does that have on service‑worker registration and manifest delivery?
Our organization has multiple legacy React apps that need to be migrated to PWAs over the next year. How would you architect a shared solution that minimizes duplication while supporting team autonomy?
Discuss the long‑term maintenance implications of using Workbox plugins versus hand‑rolled service‑worker code across many micro‑frontends.
What metrics would you put in place to monitor PWA performance and reliability after rollout, and how would you use them to drive future improvements?