@stainless-code/persist
| Install | |
|---|---|
npm install @stainless-code/persist |
|
| Latest Version: | 0.4.1 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 21, 2026 |
| Links: | GitHub · npm |
@stainless-code/persist
Any store, any storage, one middleware — no flash.
Hydration-aware persistence for any reactive store — no hydrate flash, no SSR mismatch. Store-agnostic via a structural PersistableSource (TanStack Store, zustand, jotai, valtio, mobx, pinia, redux, or a hand-rolled atom); three composable seams (backend × codec × source) so you swap storage, serialization, or framework without rewriting. A first-class hydration signal gates UI on async backends; opt-in cross-tab sync, versioned migrations, encrypted/compressed backends, and retry-on-quota. Framework adapters for React, Preact, Solid, Angular, Vue, Lit, Alpine, and Svelte.
Docs: https://stainless-code.com/persist
Install
bun add @stainless-code/persist
Quick start
import { Store } from "@tanstack/store";
import { createSerovalStorage } from "@stainless-code/persist/codecs/seroval";
import { persistStore } from "@stainless-code/persist/sources/tanstack-store";
import { toHydrationSignal } from "@stainless-code/persist";
import { useHydrated } from "@stainless-code/persist/frameworks/react";
const store = new Store({ theme: "light" });
const persist = persistStore(store, {
name: "app:prefs:v1",
storage: createSerovalStorage(() => localStorage),
});
export const prefsHydration = toHydrationSignal(persist);
// in a component:
const { hydrated } = useHydrated(prefsHydration);
Documentation
| Getting started | Install, peers, quick start |
| Guides | Hydration, IndexedDB + React, migrations, FAQ |
| Recipes | Encrypt, options, wrapping stores, cross-tab |
| Concepts | Three seams, storage/codec choice, entry points |
| Reference | Generated API (TypeDoc) |
| Changelog | GitHub Releases |
Related Packages
A store for Nano Stores state manager to keep data in localStorage
Headless UI for building powerful tables & datagrids for TS/JS.
Version History
| Version | Released | License |
|---|---|---|
| 0.4.1 | MIT | |
| 0.4.0 | MIT | |
| 0.3.0 | MIT | |
| 0.2.1 | MIT | |
| 0.2.0 | MIT | |
| 0.1.1 | MIT | |
| 0.1.0 | MIT | |
| 0.0.0 | MIT |