API reference
Find every Ownfold package, public entry point, runtime boundary, dependency, and detailed reference page.
Ownfold is a headless SDK split into small packages. Install only the runtime, transport, framework, identity, and database layers your application needs. No package renders application UI.
Choose the package that owns the job
| Need | Install | Detailed reference |
|---|---|---|
| Shared formats, parsers, errors, and contracts | @ownfold/core |
Core SDK |
| Production cryptography | @ownfold/crypto |
Crypto engine |
| Browser vault lifecycle and record encryption | @ownfold/browser |
Browser client |
| Headless React state and actions | @ownfold/react |
React API |
| Authenticated coordination service | @ownfold/server |
Vault server |
Web Request/Response handler and browser transport |
@ownfold/fetch |
Transport APIs |
| tRPC router and browser transport | @ownfold/trpc |
Transport APIs |
| Framework route integration | @ownfold/next, node, fastify, hono, elysia, or tanstack-start |
Framework APIs |
| Session-to-user resolution | @ownfold/better-auth or @ownfold/auth-js |
Authentication APIs |
| Vault metadata persistence | @ownfold/sqlite, postgres, drizzle, or prisma |
Database APIs |
| Adapter and lifecycle test doubles | @ownfold/testing |
Testing APIs |
| Schema generation and migrations | @ownfold/cli |
CLI |
Runtime boundaries
| Package | Allowed runtime | Must not own |
|---|---|---|
@ownfold/core |
Browser, server, worker, tests | Storage, transport, UI, live keys |
@ownfold/crypto |
Supported browsers and Node.js | Persistence, sessions, routing |
@ownfold/browser |
Browser window; worker entry for Web Workers | Server authentication or database access |
@ownfold/react |
React client tree; provider shell is SSR-safe | Visual components or CSS |
@ownfold/server |
Trusted application server | Record plaintext, root keys, Recovery Kit secrets |
| Transport/framework packages | Their named server or web runtime | User identity selection or persistence |
| Auth packages | Trusted application server | Authentication itself; they only read an existing session |
| Database packages | Trusted application server | HTTP, authentication, plaintext records |
@ownfold/testing |
Tests only | Production persistence or cryptography |
Public entry points
| Package | Entry points | Primary exports |
|---|---|---|
@ownfold/core |
. |
Domain types, format parsers, contracts, state unions, error classes |
@ownfold/crypto |
., ./testing |
createSodiumCryptoEngine, deterministic test helpers |
@ownfold/browser |
., ./worker |
VaultClient, storage, Recovery Kit helpers, worker engine |
@ownfold/react |
. |
VaultProvider and eight headless hooks |
@ownfold/server |
. |
VaultServer, createVaultServer, identity helpers and hook types |
@ownfold/fetch |
. |
Fetch handler, transport, bounded JSON utilities, protocol constants |
@ownfold/trpc |
., ./client |
tRPC router and transport adapter |
@ownfold/drizzle |
., ./schema |
Adapter plus typed coordination tables |
@ownfold/postgres |
., ./node-postgres |
Driver-neutral and pg adapters |
| Other packages | . |
The package-specific factory, types, or adapter |
The complete export index lists every public value and type by entry point. The adapter and transport contracts define the semantics custom implementations must preserve.
Package composition
The common full-stack composition is:
@ownfold/react
→ @ownfold/browser
→ @ownfold/core + @ownfold/crypto
→ transport (@ownfold/fetch or @ownfold/trpc)
→ framework handler
→ @ownfold/server
→ auth resolver + database adapter
Every arrow is replaceable at a public contract. A backend-only application can stop at
@ownfold/server and its adapters. A non-React browser uses @ownfold/browser directly. A custom
framework can mount @ownfold/fetch; a custom protocol can implement VaultTransport.
Version and module format
Published packages are ESM. Use their documented export map; do not import source files or internal
dist paths. Install Ownfold packages at the same release tag so shared domain types and persisted
format support stay aligned. See versioning for the beta compatibility policy and
data formats before persisting or migrating envelopes.