llms.txt
Compare with other sites' llms.txt files →# Swoff Documentation
> Build offline-first web apps that feel like native apps
- [Overview](/docs): Generate offline-first infrastructure from config.
- [Getting Started](/docs/getting-started): Getting started with Swoff.
- **Separator**
- [Feature Map](/docs/guides): Every Swoff feature, module-by-module — what it gives you, how to enable it, and how it compares to other libraries.
- API Reference
- fetch
- [fetch/core](/docs/api/fetch): Core networking functions.
- [fetchWithCache](/docs/api/fetch/fetchWithCache): Unified fetch with caching, auth, offline queue, auto-invalidation.
- [prefetchCache](/docs/api/fetch/prefetchCache): Fire-and-forget cache warm.
- mutation
- [mutation](/docs/api/mutation): Offline mutation queue, mutation state tracking, and sync manager.
- [queueMutation](/docs/api/mutation/queueMutation): Register for offline replay (IndexedDB).
- [processMutationQueue](/docs/api/mutation/processMutationQueue): Drain the offline queue.
- [flushMutations](/docs/api/mutation/flushMutations): Manual flush, return results.
- [getPendingCount](/docs/api/mutation/getPendingCount): Number of pending mutations.
- [getQueuePosition](/docs/api/mutation/getQueuePosition): Position of a pending mutation by ID.
- [getQueueItems](/docs/api/mutation/getQueueItems): Full list of queued items.
- [startMutation](/docs/api/mutation/startMutation): Optimistic start.
- [trackMutation](/docs/api/mutation/trackMutation): Track mutation lifecycle with status and rollback.
- [getMutationState](/docs/api/mutation/getMutationState): Current mutation state by ID.
- [clearMutationState](/docs/api/mutation/clearMutationState): Remove mutation state.
- [onMutationStateChange](/docs/api/mutation/onMutationStateChange): Subscribe to mutation state changes.
- [syncWhenPossible](/docs/api/mutation/syncWhenPossible): Defer queue drain until online, then process.
- [retrySync](/docs/api/mutation/retrySync): Force retry of all failed mutations.
- cache
- [cache](/docs/api/cache): Cache invalidation and tag generation utilities.
- [invalidateByTag](/docs/api/cache/invalidateByTag): Invalidate all cache entries for a single tag.
- [invalidateByTags](/docs/api/cache/invalidateByTags): Invalidate multiple tags at once.
- [generateTags](/docs/api/cache/generateTags): Extract tags from a URL path.
- [generateTagsFromMethod](/docs/api/cache/generateTagsFromMethod): Method-prefixed tags from URL.
- [invalidateUrl](/docs/api/cache/invalidateUrl): Extract tags from URL and invalidate all matching cache entries.
- [invalidateByMethod](/docs/api/cache/invalidateByMethod): Invalidate using method-prefixed tags.
- [expandCascading](/docs/api/cache/expandCascading): Expand tags with cascading dependencies.
- [getUrlsForTag](/docs/api/cache/getUrlsForTag): Get all URLs cached under a tag.
- [getTagsForUrl](/docs/api/cache/getTagsForUrl): Get all tags for a given URL.
- [invalidateMatching](/docs/api/cache/invalidateMatching): Invalidate all cached responses matching a glob pattern.
- auth
- [auth](/docs/api/auth): Auth management — adapter, store, and state.
- [Auth Adapter](/docs/api/auth/adapter): Factory for provider-specific auth logic.
- [setAuth](/docs/api/auth/setAuth): Store auth data in memory and IndexedDB.
- [getAuth](/docs/api/auth/getAuth): Get auth data from memory, adapter, or IndexedDB.
- [clearAuth](/docs/api/auth/clearAuth): Clear auth from memory, IndexedDB, and SW caches.
- [clearMemoryAuth](/docs/api/auth/clearMemoryAuth): Null memory auth (used for cross-tab sync).
- [isAuthValid](/docs/api/auth/isAuthValid): Check if auth exists and is not expired.
- [ensureValidAuth](/docs/api/auth/ensureValidAuth): Get auth, returns null if invalid.
- [withAuthHeaders](/docs/api/auth/withAuthHeaders): Inject auth headers into a Headers object.
- [getAuthState](/docs/api/auth/getAuthState): Detect current auth state across online/offline x authenticated/not.
- connectivity
- [connectivity](/docs/api/connectivity): Online/offline detection, heartbeat monitoring, storage estimation, and system reset.
- server-push
- [server-push](/docs/api/server-push): Server-Sent Events client.
- [startPushEvents](/docs/api/server-push/startPushEvents): Start SSE connection.
- [stopPushEvents](/docs/api/server-push/stopPushEvents): Close SSE connection.
- [isPushConnected](/docs/api/server-push/isPushConnected): Check if SSE is connected.
- graphql
- [graphql/index](/docs/api/graphql): GraphQL fetch utilities built on top of fetch/core.
- [fetchWithGql](/docs/api/graphql/fetchWithGql): Raw GraphQL fetch via fetchWithCache.
- [queryGql](/docs/api/graphql/queryGql): Typed read query using fetchWithCache read strategy.
- [mutateGql](/docs/api/graphql/mutateGql): Typed mutation using fetchWithCache mutation strategy.
- pwa
- [pwa](/docs/api/pwa): PWA install prompt utilities.
- [isInstallable](/docs/api/pwa/isInstallable): Check if PWA can be installed.
- [promptInstall](/docs/api/pwa/promptInstall): Show PWA install prompt.
- push-notification
- [push-notification](/docs/api/push-notification): Push notification subscription utilities.
- [subscribeToPush](/docs/api/push-notification/subscribeToPush): Subscribe to push notifications.
- [unsubscribeFromPush](/docs/api/push-notification/unsubscribeFromPush): Unsubscribe from push notifications.
- [isSubscribed](/docs/api/push-notification/isSubscribed): Check if push-subscribed.
- [getPushSubscription](/docs/api/push-notification/getPushSubscription): Get current PushSubscription object.
- [requestNotificationPermission](/docs/api/push-notification/requestNotificationPermission): Request Notification permission from the user.
- reset
- [reset](/docs/api/reset): Reset swoff state.
- storage
- [storage](/docs/api/storage): Storage estimation utilities.
- [getStorageEstimate](/docs/api/storage/getStorageEstimate): Estimate used and available storage.
- [formatBytes](/docs/api/storage/formatBytes): Format byte values to human-readable string.
- [CLI Reference](/docs/cli): Full documentation for every @swoff/cli command and flag.
- Config
- [Service Worker](/docs/config/service-worker): Full schema for features.serviceWorker — SW lifecycle settings, plus features.caching.{strategy,navigation,precache}.
- [Connectivity](/docs/config/connectivity): Full schema for swoff.config.json features.connectivity — every field, its type, default, and description.
- [PWA](/docs/config/pwa): Full schema for swoff.config.json features.pwa — every field, its type, default, and description.
- [Build](/docs/config/build): Build output configuration — swOutput, swoffPath, swUrl, precacheDirs.
- [Auth](/docs/config/auth): Full schema for swoff.config.json features.auth — every field, its type, default, and description.
- [GraphQL](/docs/config/graphql): Full schema for swoff.config.json features.caching.graphql — every field, its type, default, and description.
- [Request Batching](/docs/config/request-batching): Full schema for swoff.config.json features.caching.requestBatchWindowMs — field, type, default, and description.
- [Refetch Queue](/docs/config/refetch-queue): Full schema for swoff.config.json features.caching.refetchQueue — every field, its type, default, and description.
- [Mutation Queue](/docs/config/mutation-queue): Full schema for swoff.config.json features.caching.mutationQueue — every field, its type, default, and description.
- [Tag Invalidation](/docs/config/tag-invalidation): Full schema for swoff.config.json features.caching.tagInvalidation — every field, its type, default, and description.
- [Push Notifications](/docs/config/push-notifications): Full schema for swoff.config.json features.pushNotifications — field, type, default, and description.
- [Server Push](/docs/config/server-push): Full schema for swoff.config.json features.caching.serverPush — every field, its type, default, and description.
- [Dependencies](/docs/config/dependencies): Feature dependencies and boolean sub-features in swoff.config.json.
- [Schema v2 Migration](/docs/config/migration-v2): What changed in swoff.config.json schema v2 and how to migrate your config.
- Frameworks
- [Ecosystem Compatibility](/docs/frameworks/ecosystem): Framework, backend, and rendering strategy compatibility.
- [Adapter Blueprint](/docs/frameworks/blueprint): All Swoff events and properties — create adapters for any framework.
- [Auth Libraries Reference](/docs/frameworks/auth-libraries): How popular auth libraries transmit identity under the hood — and whether you need to set headers.
- React
- [Adapters](/docs/frameworks/react/adapters): Swoff config and adapters for all React-based frameworks.
- [React SPA](/docs/frameworks/react/spa): react-router-dom, TanStack Router — fully offline out of the box.
- [TanStack Start](/docs/frameworks/react/tanstack-start): SSR with client hydration — mostly offline, with one getcha.
- [Next.js](/docs/frameworks/react/nextjs): App Router and Pages Router — RSC payloads, prerendered pages, and static assets.
- Astro
- [Adapters](/docs/frameworks/astro/adapters): Integrate Swoff with Astro, including islands architecture and static/SSR output.
- Vue
- [Adapters](/docs/frameworks/vue/adapters): Swoff config for Vue-based frameworks.
- Svelte
- [Adapters](/docs/frameworks/svelte/adapters): Swoff config for Svelte-based frameworks.
- HTMX
- [Adapters](/docs/frameworks/htmx/adapters): Integrate Swoff with HTMX and HTML-over-wire patterns.
- Vanilla (bundler)
- [Adapters](/docs/frameworks/vanilla/adapters): Integrate Swoff with vanilla JS projects using a bundler (Vite, esbuild, etc.).
- [No-Bundler](/docs/frameworks/no-bundler): Comprehensive integration guide for Go, Laravel, Rails, Django, Flask, plain HTML/JS, and any no-bundler project.
- [Library Comparison](/docs/comparisons): Comprehensive comparison with Workbox, Serwist, TanStack Query, and more.
- Architecture
- [Hybrid SW + Client Model](/docs/architecture/hybrid-model): Why Swoff splits responsibilities between service worker and client scopes.
- [Caching System](/docs/architecture/caching): How Swoff handles strategy resolution, caching internals, staleness, navigation modes, and config resolution.
- [Data Sync](/docs/architecture/data-sync): Request batching, refresh queue, mutation queue, and online recovery.
- [GraphQL & Server Push](/docs/architecture/graphql-and-push): Body-hash GraphQL caching and SSE/WebSocket server push transport.
- [Auth System](/docs/architecture/auth): Auth adapter plugin system, memory-only tokens, and auth flow.
- [Observability](/docs/architecture/observability): Resource monitoring, fetch timeout, and storage quota awareness.
- [Precaching Architecture](/docs/architecture/precaching): Background activation-first precaching with IndexedDB checkpoint resume, progress reporting, and version-aware reset.
- [Optimistic Updates](/docs/architecture/optimistic-updates): Why Swoff deliberately excludes optimistic updates.
- [Changelog](/docs/changelog): Release history for Swoff.