← knowledge.oriz.in

@vite-pwa/astro

service servicespwaastroviteprimary

@vite-pwa/astro

Role

Turns every site in the family into an installable Progressive Web App at build time. Produces:

Locked as the family-wide PWA layer in decisions/architecture/distribution-and-queues-locked.md.

Free tier

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

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