Skip to main content

Introduction

Strata Storage gives browser and Capacitor apps one set() and get() shape across several storage adapters. The adapter still matters: browser, iOS and Android values live in different places, and a browser read cannot prove a native read.

First browser round-trip​

import { defineStorage } from 'strata-storage';

const storage = defineStorage();
await storage.set('draft', { title: 'First pass' }, { storage: 'indexedDB' });
const draft = await storage.get<{ title: string }>('draft', {
storage: 'indexedDB',
});

defineStorage() registers the standard browser adapters and initializes on first use. Memory, localStorage, sessionStorage, IndexedDB, cookies and a JSON-value Cache adapter are included. The URL adapter is registered separately for shareable UI state.

What changes by platform​

RuntimeAvailable pathVerification boundary
Browser pageStandard web adapters through defineStorage()Test the selected browser, quota and reload behaviour
Capacitor iOS/AndroidRegister Preferences, Secure, SQLite or Filesystem adaptersRun write → read → restart → read on a device
Node or server processMemory and explicitly supported adaptersDo not assume a browser or native backend exists

The native Secure adapter uses iOS Keychain or Android EncryptedSharedPreferences. Strata does not expose a biometric requirement or guarantee hardware-backed keys through its public options. Native adapter read paths still require device verification.

Optional features​

  • Encryption and compression need an instance configured for those transforms. An encrypted write also needs an encryption password. Follow the encryption and compression guides before enabling them.
  • TTL can expire stored values. Query conditions match fields of the decoded value; wrapper metadata is not queryable. See TTL and the query reference.
  • Cross-tab notifications can help refresh browser views. They do not make multi-tab writes atomic. Optional Firebase integration requires its own project and setup; it is not automatic cross-device sync.

Next steps​

  1. Install the package.
  2. Run the Quick Start.
  3. Choose an adapter.
  4. Read the API reference.