Skip to main content
Rehydra works seamlessly in browsers without special configuration. This guide covers browser-specific considerations.

Basic Example

Bundler Setup

Vite

No special configuration needed:

Webpack

Webpack 5+ handles conditional exports automatically:

esbuild

First-Use Downloads

On first initialization, Rehydra downloads: Show download progress to users:

Storage in Browsers

Model Storage (OPFS)

Large model files use the Origin Private File System:
  • Persistent across sessions
  • Not visible in DevTools
  • Quota managed by browser
  • Cleared with “Clear site data”

PII Map Storage (IndexedDB)

For session-based storage:

ONNX Runtime

The NER model requires onnxruntime-web. It’s loaded automatically:
For explicit bundling:

Browser Compatibility

Required APIs:

Offline Support

After initial download, everything works offline:

Memory Considerations

The NER model uses ~200-300 MB RAM when loaded. For memory-constrained environments:

Web Workers

For non-blocking UI, run Rehydra in a Web Worker:

CSP Considerations

If using Content Security Policy, ensure these are allowed:

What’s NOT Available in Browser

The browser build excludes:
  • SQLitePIIStorageProvider (use IndexedDBPIIStorageProvider)
  • Streaming anonymization (rehydra/streaming)
  • LLM proxy middleware (rehydra/proxy)
  • Node.js fs, path, os modules
  • Direct file system access

Next Steps

Sessions & Storage

IndexedDB storage for browsers

Installation

Bundler-specific setup