A high-performance, event-driven in-memory database designed specifically for frontend applications. OIMDB provides reactive collections, intelligent indexing, and configurable event processing for building fast, predictable state management solutions.
OIMDB is now organized as a monorepo with separate packages:
@oimdb/core - Core Library
The foundational reactive collections, indexing, and event processing library.
npm install @oimdb/coreKey Features:
- Reactive collections/objects/indexes with key-scoped subscriptions
- Intelligent event coalescing and reentrancy-safe delivery for optimal performance
- Configurable schedulers (microtask, timeout, animationFrame, immediate)
- Effects & Computed scheduled via
OIMComputeRuntime(single drainingqueue.flush()boundary) - Type-safe operations with full TypeScript support
- O(1) lookups and efficient indexing
๐ See @oimdb/core documentation
@oimdb/react - React Integration
React hooks for seamless integration with OIMDB reactive collections.
npm install @oimdb/react @oimdb/coreKey Features:
- Direct integration with
OIMReactiveCollectionand collection-bound indexes - Automatic subscriptions using
useSyncExternalStore - React Context support for centralized collection management
- Key-specific subscriptions for efficient re-renders
๐ See @oimdb/react documentation
@oimdb/redux-adapter - Redux Integration
Production-ready Redux adapter for gradual migration from Redux to OIMDB or hybrid usage.
npm install @oimdb/redux-adapter @oimdb/core reduxKey Features:
- ๐ Two-Way Synchronization: Automatic sync between OIMDB and Redux in both directions
- โก Automatic Flushing: Built-in middleware automatically processes events after Redux actions
- ๐ฆ Production Ready: Battle-tested, optimized for large datasets
- ๐ Gradual Migration: Integrate OIMDB into existing Redux projects without breaking changes
- ๐ฏ Flexible State Mapping: Custom mappers for any Redux state structure
- โก Performance Optimized: Efficient diffing algorithms and batched updates
Perfect for:
- Migrating from Redux to OIMDB incrementally
- Using OIMDB for complex relational data alongside Redux
- Replacing Redux entirely while maintaining compatibility
๐ See @oimdb/redux-adapter documentation
import { OIMReactiveCollection, OIMEventQueue, OIMEventQueueSchedulerFactory } from '@oimdb/core';
interface User {
id: string;
name: string;
email: string;
}
// Create reactive collection
const queue = new OIMEventQueue({
scheduler: OIMEventQueueSchedulerFactory.createMicrotask()
});
const users = new OIMReactiveCollection<User, string>(queue, {
selectPk: (user) => user.id
});
// Subscribe to changes
users.updateEventEmitter.subscribeOnKey('user1', () => {
console.log('User1 updated!');
});
// Insert and update data. Writes return canonical slots, which can be reused by indexes.
const userSlot = users.upsertOne({
id: 'user1',
name: 'John',
email: 'john@example.com'
});
const updatedUserSlot = users.upsertOne({
id: 'user1',
name: 'John Doe',
email: 'john@example.com'
});
console.log(userSlot === updatedUserSlot); // true
// Only one notification fires due to intelligent coalescing- ๐ Performance First: Map-based storage with O(1) lookups
- ๐ก Reactive Architecture: Automatic change notifications with intelligent coalescing
- ๐ง Type Safety: Full TypeScript support with advanced generics
- โก Configurable: Multiple scheduler options for different use cases
- ๐๏ธ Modular: Use only what you need, extend what you want
For detailed documentation and API reference, visit the individual package READMEs:
- @oimdb/core - Complete core library documentation
- @oimdb/react - React integration guide
- @oimdb/redux-adapter - Redux migration and integration guide
# Install dependencies
npm install
# Run tests
npm test
# Run benchmarks
npm run bench
# Build packages
npm run buildFull documentation is published at oimdb.org.
Source docs live in website/docs/.
Contributions are welcome! OIMDB is designed to be modular and extensible.
MIT License - see LICENSE file for details.
- Issues: GitHub Issues
OIMDB - High-performance, reactive in-memory database for frontend applications. ๐