To make an Astro site a PWA, add a manifest.webmanifest file to public/, link it from your base layout’s <head> with <link rel="manifest">, and provide 192 px and 512 px icons. Astro copies everything in public/ to the build unchanged, so no integration is needed for the manifest. Offline support is a separate step: a service worker, covered in the service worker tip.
Key Takeaways
- The manifest is a static JSON file; put it in
public/and link it in<head>.- Ship at least a 192 px and a 512 px PNG icon, plus a maskable version for Android.
theme_colorin the manifest and atheme-colormeta tag color the browser UI.- A manifest makes the site installable in more browsers; a service worker adds offline behavior.
The manifest file
{
"name": "Example Studio",
"short_name": "Studio",
"description": "Design and development for small teams.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#ffffff",
"theme_color": "#0f172a",
"icons": [
{ "src": "/icons/icon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/icons/icon-512.png", "sizes": "512x512", "type": "image/png" },
{ "src": "/icons/maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
]
}
Save it as public/manifest.webmanifest. Key fields:
| Field | What it does |
|---|---|
name / short_name |
Shown on the install prompt and under the home screen icon |
start_url |
The page that opens when the app is launched |
display |
standalone hides the browser toolbar; browser keeps it |
theme_color |
Color of the title bar or status bar |
background_color |
Splash screen color while the page loads |
icons |
App icons; maskable icons fill Android’s icon shapes |
A maskable icon keeps its important content inside the central 80% safe zone, because Android crops it into a circle or rounded square. If you deploy under a subpath with Astro’s base option, set start_url and scope to that path too.
Link it from the head
---
// src/components/BaseHead.astro
---
<link rel="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#0f172a" />
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png" />
iOS uses apple-touch-icon (180 px is the common size) for the home screen icon rather than the manifest icons. If your site has a dark mode, you can add a second theme-color tag with media="(prefers-color-scheme: dark)". The folder structure docs show where public/ sits in a theme project, and our meta tags component guide covers the rest of the head.
Check it in DevTools
Build and preview, since that is what you deploy:
# Terminal
npm run build && npx astro preview
In Chrome, open DevTools, go to Application, then Manifest. It shows the parsed fields, the icons it found, and any warnings, such as a missing 512 px icon or a start_url outside scope. Lighthouse no longer has a separate PWA category, so DevTools is the place to check.
Do you need an integration?
For a manifest alone, no. If you also want a generated service worker with precaching, @vite-pwa/astro builds one with Workbox and can write the manifest from config. It is worth it for app-like sites that should work offline. For a content site that just wants an install icon and a colored toolbar, the static file above is simpler and has nothing to update.
Every theme in our Astro theme catalog builds to static files, so a manifest in public/ works with any of them without changes to the build.
FAQ
Is an Astro site a PWA by default?
No. Astro does not generate a manifest or service worker. Add manifest.webmanifest to public/ and link it, then add a service worker if you need offline support.
What icon sizes does a PWA need?
At minimum 192x192 and 512x512 PNG icons in the manifest, plus a maskable 512x512 icon for Android and a 180x180 apple-touch-icon for iOS.
Should the manifest be .json or .webmanifest?
Either works if it is linked with rel="manifest". The .webmanifest extension is the registered one and most hosts serve it with the application/manifest+json type.
Can I generate the manifest from my site config?
Yes. Create src/pages/manifest.webmanifest.ts with a GET endpoint that returns JSON.stringify(...) built from your site settings. Astro prerenders it to a static file at build time.