🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@routier/core

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@routier/core

Core functionality for routier

latest
Source
npmnpm
Version
0.1.0-rc.0
Version published
Maintainers
1
Created
Source

Routier

Routier

⚠️ Alpha Release - This project is currently in alpha. APIs may change between versions. Use with caution in production.

A reactive data toolkit for building fast, local-first apps. Define schemas, create collections, use live queries, and make optimistic mutations with a plugin model for any storage.

📖 View Full Documentation - Complete guides, API reference, and tutorials

Features

  • Schema-first: Type-safe entity definitions with indexes and modifiers
  • Live queries: Reactive queries across one or more collections
  • Optimistic mutations: Instant UI updates with automatic rollback
  • Pluggable storage: Memory, Local Storage, Dexie, SQLite, PouchDB, File System, and more
  • Change tracking: Automatic tracking of entity modifications
  • Performance: Database-backed filters when possible, in-memory for computed properties

Quick Start

npm install @routier/core @routier/datastore @routier/memory-plugin
import { DataStore } from "@routier/datastore";
import { MemoryPlugin } from "@routier/memory-plugin";
import { s } from "@routier/core/schema";

// Define a schema
const userSchema = s
  .define("users", {
    id: s.string().key().identity(),
    name: s.string(),
    email: s.string().distinct(),
  })
  .compile();

// Create a datastore with a plugin
class AppContext extends DataStore {
  constructor() {
    super(new MemoryPlugin("routier-app"));
  }
  users = this.collection(userSchema).create();
}

const ctx = new AppContext();

// Add data
await ctx.users.addAsync({ name: "Ada", email: "ada@example.com" });
await ctx.saveChangesAsync();

// Query with live updates
ctx.users
  .subscribe()
  .where((u) => u.name.startsWith("A"))
  .toArray((result) => {
    console.log("Live query result:", result);
  });

Why Routier?

Choosing storage for local-first apps is hard—and the landscape moves fast. Routier separates your domain model from persistence through a small plugin interface:

  • Swap storage backends without changing schemas, queries, or UI
  • Use any framework/ORM/data store you want via plugins
  • Experiment safely: try a new store by writing a plugin
  • Fill ORM gaps: feature-rich and easily extended

Built-in Plugins

  • Memory: In-memory storage for development and testing
  • Local Storage: Browser localStorage/sessionStorage
  • Dexie: IndexedDB with Dexie.js
  • PouchDB: CouchDB sync and replication
  • SQLite: Node.js SQLite integration
  • File System: Node.js file-based storage

Contributing

Issues and PRs welcome! Please see our Contributing Guide or open an issue to discuss changes.

License

MIT

Keywords

orm

FAQs

Package last updated on 04 Dec 2025

Did you know?

Socket

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.

Install

Related posts