Skip to main content

Cache and storage

The client exposes a reactive cache:

Cache interface

invalidate(pattern) removes all cache entries whose key contains the given string. For example, cache.invalidate('browse') clears all collection browse results.

Storage adapters

Custom adapter. Implement StorageAdapter:
The fileStorage adapter accepts a minimal FileSystem interface so you can pass Node’s fs module directly:

Custom fetch

The SDK uses the global fetch by default. You can provide a custom fetch implementation for SSR, testing, or environments where fetch is not available:
The SDK also exports xhrFetch, an XMLHttpRequest-based fetch alternative for environments where fetch is blocked by ad blockers or browser extensions:

Signals

The SDK provides framework-agnostic reactive primitives (via @preact/signals-core). These work in any JavaScript environment with no framework dependency required:
You don’t need to use signals directly. Every controller provides a subscribe() method and the SDK exports a standalone subscribe() utility that work without any signal imports. See Framework Integration for patterns in React, Vue, Svelte, and more.

Singleton access

After initialization, access the client anywhere:

Technical details

  • Runtime: Browser (ESM)
  • TypeScript: Full type definitions included
  • Dependencies: @preact/signals-core
  • Bundle: Tree-shakeable ES modules
  • Caching: Built-in LRU cache with configurable TTL

Next steps