
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
Memorio, State + Observer, Store and iDB for an easy life - Cross-platform compatible
A lightweight, type-safe state management library for JavaScript applications
memorio.createContext()For enterprise-level applications requiring advanced state management, we recommend using @biglogic/rgs instead of Memorio.
RGS provides:
Memorio is ideal for small to medium projects, prototypes, and learning purposes.
npm i -D memorio
Total: 28 tests passed across 5 test suites
/*
IMPORTANT!
Add import only at first start of your SPA. Became global!.
You don't need to import any time you need to use memorio
*/
import 'memorio';
// State Management
state.counter = 0;
state.active = false;
state.name = "john";
state.user = { name: 'John', age: 30 };
state.hours = [2,3,10,23]
// Observer Pattern
// Example: if you change the state.counter you get a console.log
observer(
'state.counter',
(newValue, oldValue) => {
console.log(`Counter changed from ${oldValue} to ${newValue}`);
}
);
// useObserver Pattern
// Example: if you change the state.counter you get a console.log
useObserver(
(newValue, oldValue) => {
console.log(`Counter changed from ${oldValue} to ${newValue}`);
},
[state.counter]
);
// Store (Persistent Storage)
store.set('preferences', { theme: 'dark' });
const preferences = store.get('preferences');
// Session Storage
session.set('token', 'user-jwt-token');
const token = session.get('token');
State in Memorio is globally accessible and reactive:
// Setting state
state.user = { name: 'John' };
// Getting state
const userName = state.user.name;
// Listing all states
console.log(state.list);
// Removing state
state.remove('user');
// Clearing all states
state.removeAll();
⚠️ Deprecated: For React applications, use
useObserverinstead. Theobserverfunction is kept for non-React contexts.
useObserver is a React hook for observing Memorio state changes with auto-discovery:
// Basic useObserver - array syntax with state path
useObserver(
(newValue, oldValue) => {
console.log('User updated:', newValue);
},
[state.user]
);
// Multiple states
useObserver(
(newValue, oldValue) => {
console.log('State changed:', newValue);
},
[state.user, state.counter, state.settings]
);
Key differences from observer:
[state.property] instead of string path 'state.property'(newValue, oldValue) parametersPersistent storage for your application:
// Setting values
store.set('config', { theme: 'dark', language: 'en' });
// Getting values
const config = store.get('config');
// Removing specific value
store.remove('config');
// Getting store size
const size = store.size();
// Clearing store
store.removeAll();
Temporary storage that persists during page sessions:
// Setting session data
session.set(
'userSession', {
id: 'user123',
lastActive: Date.now()
}
);
// Getting session data
const userData = session.get('userSession');
// Checking session size
const activeItems = session.size();
// Removing session data
session.remove('userSession');
// Clearing all session data
session.removeAll();
In-memory cache for temporary data storage:
// Setting cache data
cache.set('tempData', { computed: true, value: 42 });
// Getting cache data
const cached = cache.get('tempData');
// Checking cache size
const cacheSize = cache.size();
// Removing cache data
cache.remove('tempData');
// Clearing all cache data
cache.removeAll();
Note: Cache data is stored in memory and will be lost on page refresh.
Permanent storage using browser database:
idb.db.create("Database")
idb.data.set("Database","table", { id: 1, data:{...} } )
[in development]
idb.data.get("Database","table", 1 )
[in development]
idb.db.delete("Database") // Remove DB
idb.table.delete("Database","table") // Remove only "table"
Total: 25 tests passed across 5 test suites
Security scans and reports are available at:
MIT License
Copyrigth (c) Dario Passariello
Memorio is designed to work across multiple JavaScript environments:
| Feature | Browser | Node.js | Deno | Edge Workers |
|---|---|---|---|---|
state | ✅ | ✅ | ✅ | ✅ |
observer | ✅ | ✅ | ✅ | ✅ |
useObserver | ✅ | ⚠️ | ⚠️ | ✅ |
cache | ✅ | ✅ | ✅ | ✅ |
store | ✅ (localStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ (localStorage) |
session | ✅ (sessionStorage) | ⚠️ (memory) | ⚠️ (memory) | ✅ (sessionStorage) |
idb | ✅ | ❌ | ❌ | ⚠️ |
Memorio provides automatic session isolation to prevent state leakage between different requests or contexts:
store and session keys are prefixed with session IDstate is isolated per-instanceThis ensures that in server-side environments (Node.js/Deno), different requests don't share state data.
state and cache for in-memory data; store/session fall back to memoryimport { isBrowser, isNode, isDeno, getCapabilities } from 'memorio';
console.log('Browser:', isBrowser()); // true in browser
console.log('Node.js:', isNode()); // true in Node.js
console.log('Deno:', isDeno()); // true in Deno
const caps = getCapabilities();
console.log('Platform:', caps.platform); // 'browser' | 'node' | 'deno' | 'edge'
console.log('Persistent:', store.isPersistent); // true if using real storage
FAQs
Memorio, State + Observer, Store and iDB for an easy life - Cross-platform compatible
The npm package memorio receives a total of 39 weekly downloads. As such, memorio popularity was classified as not popular.
We found that memorio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.