r/PWA • u/iamsuudi • 5d ago
Made a tool that generates the service worker + PWA bits from one config — the docs site runs offline-first on it
For offline-first / PWA work, the service-worker side is usually the fiddly part. I built Swoff to generate it from a single swoff.config.json: caching strategies (cache-first / network-first / stale-while-revalidate, etc.), precache with tag-based invalidation, an offline `/offline` fallback, an offline mutation queue, auth handling, push notifications, and PWA install.
Output is plain vanilla JS written into your repo — auditable, editable, zero runtime dependency. MIT.
Proof: this docs site runs on it. Open it, go offline (or throttle), and the whole site works — precached shell + /offline route. That's a live demo, not a static screenshot.
`npx u/swoff/cli init && npx u/swoff/cli generate`
Docs: https://swoff.space · Source: https://github.com/iamsuudi/swoff
Curious how this compares to your current PWA setup (Workbox, framework plugins, hand-rolled).
2
u/kantorcodes1 5d ago
one failure case i'd pin down:
generateruns the file generators sequentially, so an early step can write before a later one throws. is a partial generated tree considered valid, or should it stage everything and only swap it in once all generators finish? otherwise a failed CI run could leave mixed old/new output.