Swoff is a config-driven code generation toolchain for offline-first web apps. An interactive wizard builds your config, the CLI generates an auditable service worker and client runtime, and you own every line — zero runtime dependencies, no framework coupling.
One interactive session, one CLI command, one build step — and you own the output.
Run swoff init
interactive wizard builds your config
Run swoff generate
CLI produces auditable TS/JS source files
Run node swoff/sw/generator.mjs
inlines built assets into the final SW
Serve as static assets — no runtime library, no backend coupling
Not just a Service Worker — a complete offline-first platform generated from a single config file.
Define strategies, auth, offline queue, push, and PWA in a single swoff.config.json. The CLI generates the full SW + client runtime from it.
Cache-first, network-first, stale-while-revalidate, cache-only, network-only, and reactive. Per-route pattern overrides with 3-tier resolution.
StaleTime + refetchInterval for automatic background refreshes. Refetch on reconnect, refetch on focus — data stays fresh without manual invalidation.
HTML stored in a separate cache from JSON/API payloads. Prevents Content-Type corruption on hard refresh — no framework-specific hacks needed.
Auto-tags from URL paths with glob matching, cascading dependencies, and cross-tab sync via SW message hub. No query-key management.
Invalidation, auth state, and mutation events broadcast to all open tabs through the SW — no BroadcastChannel or manual coordination needed.
50ms coalescing window merges concurrent identical GET requests into a single fetch. In-flight dedup via promise cloning. Configurable and auto-discoverable.
Queue writes in IndexedDB when offline, replay on reconnect. Configurable retry with exponential backoff, jitter, and batch processing.
Cookie, bearer, and custom auth with token refresh and 401 detection. Auth routes bypass the SW automatically. clearAuth() cascades across all tabs.
Real-time cache invalidation via SSE or WebSocket. Connections live in the SW scope — survive navigation, tab close, and page refresh.
Built-in subscription management, VAPID key configuration, and SW push handler. Generated from config — no manual SW wiring for push events.
Install prompt management with configurable suppression. Storage estimation, manifest generation, and service worker lifecycle handled by generated code.
Generate icons, splash screens, favicons, Apple touch icons, and OG images from a single SVG source. Includes HTML meta-tag guide for your <head>.
Body-hash caching by query + variables, operation-name auto-tags, offline mutation queue, and multi-endpoint support.
Works with any frontend (React, Vue, Svelte, HTMX) and any backend (Laravel, Django, Rails, Go). No bundler or build-tool lock-in — output is plain JS.
@swoff/assets generates 31+ production-ready PWA assets from a single SVG — icons, splash screens, favicons, Apple touch icons, OG images, Microsoft tiles, manifest.json, and HTML head tags. No service worker, no build tool, no framework required.
npx @swoff/assets --source ./logo.svgSwoff operates at the fetch event layer — below frameworks and bundlers. Compatible with any frontend, any backend, any build tool.
No runtime deps, no framework lock-in, no package.json required. Just an interactive session and a CLI command — you own the code.