Storion
Storion is a framework-agnostic, in-browser database that lets you define tables and run JSON-style queries on data stored in localStorage, sessionStorage, or IndexedDB
Create databases, tables, save and fetch records, and run JSON queries on localStorage, sessionStorage, or IndexedDB.
npm install @storion/storion
Features
Works with any frontend; no framework-specific code.
Use localStorage, sessionStorage, or indexedDB.
Define tables with columns (int, float, boolean, string, json) and optional foreign keys.
Insert, fetch, update, delete; run JSON queries with where, orderBy, limit, offset.
Create a database from a config object or load config from a URL or file.
Subscribe to table or row changes so components stay in sync without polling.
Optional broadcaster + listener for extensions, background scripts, or multiple tabs.
Quick example
import { createDatabase } from '@storion/storion';
const db = await createDatabase({
name: 'myapp',
storage: 'localStorage'
});
await db.createTable('users', [
{ name: 'id', type: 'int' },
{ name: 'email', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'active', type: 'boolean' }
]);
await db.insert('users', { email: 'alice@example.com', name: 'Alice', active: true });
const { rows, totalCount } = await db.query('users', {
where: { field: 'active', op: 'eq', value: true },
orderBy: [{ field: 'name', direction: 'asc' }],
limit: 20,
offset: 0
});
Documentation
- Quick start – Install and first steps
- API reference – createDatabase, Database methods, helpers
- Query language – where, orderBy, operators, examples
- Config format – Define tables and databases in JSON
Links
| Resource | URL |
|---|---|
| GitHub | github.com/storionjs/storion |
| npm | npmjs.com/package/@storion/storion |
| Issues | GitHub Issues |
| License | MIT |