@vite-pwa/astro
@vite-pwa/astro
Role
Turns every site in the family into an installable Progressive Web App at build time. Produces:
manifest.webmanifest(name, icons, theme color, display mode, start URL, share target where relevant).- Workbox-generated service worker (
sw.js) with offline cache strategy. <link rel="manifest">injection.- Install-prompt component glue (the kit's
<InstallPrompt />forward reference handles the UX).
Locked as the family-wide PWA layer in
decisions/architecture/distribution-and-queues-locked.md.
Free tier
- MIT-licensed npm package.
- No backend, no API, no quota.
- Generates artifacts at
astro buildtime, dropped intodist/.
Card / subscription required?
NO. Pure build-time tool. No service backend, no account.
Configuration
// astro.config.mjs
import AstroPWA from "@vite-pwa/astro";
export default {
site: "https://blog.oriz.in",
integrations: [
AstroPWA({
registerType: "autoUpdate",
manifest: {
name: "oriz-blog",
short_name: "blog",
theme_color: "#0b0f17",
icons: [
{ src: "/icon-192.png", sizes: "192x192", type: "image/png" },
{ src: "/icon-512.png", sizes: "512x512", type: "image/png" },
{ src: "/icon-maskable.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
],
},
workbox: {
globPatterns: ["**/*.{js,css,html,svg,png,webp,woff2}"],
runtimeCaching: [
{
urlPattern: /^https:\/\/api\.oriz\.in\//,
handler: "NetworkFirst",
options: { cacheName: "api-cache", expiration: { maxAgeSeconds: 86400 } },
},
],
},
}),
],
};
The kit ships a default config preset; sites only override name /
short_name / icons.
Alternatives
- Hand-rolled service worker — every site reimplements the same Workbox boilerplate.
next-pwa/nuxt-pwa— wrong framework. The family is Astro-only per.- Capacitor / Tauri native wrappers — walked back per
decisions/architecture/distribution-and-queues-locked.md. PWA-only is the explicit floor. Re-open only if a native-only feature need arises (e.g. iOS background sync, hardware sensor access).
Swap cost
Low — output is the standard manifest.webmanifest + sw.js
contract any browser reads. Replacing the integration is one config
swap inside one site repo.
Why this is our pick
Native to the framework every site already uses. Wraps Workbox so the offline + caching primitives are battle-tested. MIT, no backend, no card. Adds installability + offline survival to every site for the cost of one config block.
Cross-refs
- Distribution + queues locked decision
- PWA bucket index
- Cloudflare Pages for all sites
- — `
` forward reference - No card-on-file rule