Skip to content

oto-storageType-safe browser storage without boilerplate

Proxy-based localStorage/sessionStorage wrapper with defaults, TTL, and encryption hooks.

Install

bash
npm install oto-storage

Quick example

ts
import { oto } from "oto-storage";

interface AppStorage {
  token: string | null;
  user: { id: string; name: string } | null;
}

const storage = oto<AppStorage>({
  prefix: "app-",
  defaults: { token: null, user: null },
  ttl: 60 * 60 * 1000,
});

storage.token = "abc123";
console.log(storage.token);