Offline Infrastructure Toolkit

Offline Infrastructure
For Any Stack

A config-driven code generator for offline-first web apps. One swoff.config.json drives caching, auth, offline queue, push, and PWA — with any frontend, backend, or build tool. The output is auditable vanilla JS you own, with zero runtime dependencies.

Try it in 2 minutes

terminal
# 1. Init config (or --yes for defaults)
npx @swoff/cli init

# 2. Generate your swoff/ runtime
npx @swoff/cli generate

# 3. Build step — embed your assets
node swoff/sw/generator.mjs

# 4. Include the injector in your HTML
Bundler:
    import { initServiceWorker } from "./swoff/client-injector";
    initServiceWorker();
No-bundler:
    <script src="/swoff/client-injector.bundle.js"></script>

Capabilities

Not just a service worker — a complete offline-first platform generated from a single config file.

Caching

Six strategies with per-route pattern overrides, HTML cache isolation, request batching, and reactive stale-time refreshes.

Offline Mutations

IndexedDB write queue with reconnect replay, exponential backoff, and batch processing.

Auth-Aware

Cookie, bearer, or custom auth with token refresh, 401 detection, SW bypass, and cross-tab clearAuth().

Push & PWA

Notifications from config, installability, and full PWA asset generation from a single SVG source.

Real-Time & GraphQL

SSE/WebSocket server push in the SW scope, plus body-hash caching and op-name tag invalidation for GraphQL.

Cross-Tab Sync

Invalidation, auth, and mutation events broadcast to every tab through the SW message hub.

Works with Everything

Swoff operates at the fetch event layer — below frameworks and bundlers. Compatible with any frontend, any backend, any build tool.

Frontend

ReactVueSvelteHTMXSolid
Full list →

Meta-frameworks

Next.jsNuxtSvelteKitTanStack StartAstro
Full list →

Backend & Runtimes

LaravelDjangoRailsGoNode.js
Full list →
Standalone Package

Need just PWA assets?

@swoff/assets generates 50+ production-ready PWA assets from a single source image — or a wordmark — including manifest and HTML head tags. No service worker, no build tool, no framework required.

Explore the Buildernpx @swoff/assets --source ./logo.svg

Then paste the generated swoff-head-tags.html into your HTML <head> (or meta-framework head API) — the manifest and icons only take effect once linked.