Skip to main content

CLI

For terminal usage without writing code:
See the CLI Guide for commands and options.

Node.js

Install the SDK from npm:
The NER model requires onnxruntime-node, which is included as an optional dependency and will be installed automatically on supported platforms.

SQLite Storage (Optional)

For persistent PII map storage with SQLite:

Bun

Bun requires onnxruntime-web since onnxruntime-node is a native Node.js addon:
Usage is identical to Node.js — the library auto-detects the runtime.

Browser (with Bundler)

When using Vite, webpack, esbuild, or other modern bundlers:
The browser-safe entry point is automatically selected via conditional exports. This entry point excludes Node.js-specific modules like SQLite storage.

Vite Configuration

No special configuration needed. Vite automatically resolves the browser build.

Webpack Configuration

No special configuration needed. Webpack 5+ resolves conditional exports correctly.

Browser (without Bundler)

For direct browser usage without a bundler:

Conditional Exports

The package uses conditional exports to provide the right build for each environment:

Explicit Imports

If needed, you can explicitly import a specific build:

What’s Included

Browser Build Includes

  • All recognizers (email, phone, IBAN, credit card, etc.)
  • NER model support (with onnxruntime-web)
  • Semantic enrichment
  • InMemoryPIIStorageProvider
  • IndexedDBPIIStorageProvider
  • All crypto utilities

Browser Build Excludes

  • SQLitePIIStorageProvider (use IndexedDBPIIStorageProvider instead)
  • Node.js fs, path, os modules

Requirements

Verifying Installation

If you see the anonymized output, installation is complete!

Next Steps

Quick Start

Learn the basics of using Rehydra

NER Detection

Set up the NER model for detecting names and locations