Setup guide · Gatsby
Turn a Gatsby site into an installable PWA (2026)
Gatsby 5+ PWA recipe — manifest, service worker (gatsby-plugin-offline) and cross-platform install prompt.
Key takeaways
- `gatsby-plugin-manifest` generates manifest.webmanifest at build time.
- `gatsby-plugin-offline` registers a Workbox service worker automatically.
- iOS Safari still needs a manual install prompt — use InstantPWA.
Before you start
- Gatsby 4+
- HTTPS origin
- 512px source icon
manifest.webmanifest
{
"name": "Your product",
"short_name": "Product",
"start_url": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#111827",
"icons": [
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
]
}Step-by-step for Gatsby
- Step 1Install the plugins
Run `npm i gatsby-plugin-manifest gatsby-plugin-offline`.
- Step 2Configure gatsby-config.js
Order matters — offline must come after manifest.
module.exports = { plugins: [ { resolve: 'gatsby-plugin-manifest', options: { name: 'Your app', short_name: 'App', start_url: '/', display: 'standalone', icon: 'src/images/icon.png' } }, 'gatsby-plugin-offline', ], }; - Step 3Add the install popup
Inject the InstantPWA snippet via gatsby-ssr.js onRenderBody.
Minimal sw.js
// public/sw.js
self.addEventListener('install', (e) => self.skipWaiting());
self.addEventListener('activate', (e) => self.clients.claim());
self.addEventListener('fetch', () => {});Common Gatsby gotchas
- Do not enable offline in `gatsby develop` — it caches stale HTML. Test with `gatsby build && gatsby serve`.
- Purge the CDN when icons change; Gatsby fingerprints assets but not the manifest URL.
FAQ
Do I need a native app if my Gatsby site is a PWA?
No. Once your Gatsby site meets the three PWA criteria (HTTPS, a manifest, a service worker), Chromium browsers offer to install it and iOS Safari 16.4+ supports the full standalone experience — including web push.
Will a service worker slow my Gatsby site down?
Not measurably on first load. The worker installs asynchronously after the page becomes interactive. On repeat visits it typically improves LCP and TTFB because assets are served from cache.
Can I still deploy my Gatsby site to Vercel, Netlify or Cloudflare?
Yes. Any static or edge host works — the manifest and service worker are plain files served from the origin. No build-time integration is required.
Skip the setup — drop in one line
InstantPWA handles the install prompt across iOS, Android and desktop. Free forever for one popup.
Get started free