Registry / database / redux-db

redux-db

JSON →
library0.9.17jsnpmunverified

redux-db is a state normalizer and ORM for Redux that provides a structured way to manage normalized relational data in your Redux store. The current stable version is 0.9.17, with a low release cadence (last major update in 2018). It offers a schema-based data modeling approach with automatic normalization and denormalization, making it suitable for complex state shapes with relationships. Key differentiators include a built-in query system for filtered and paginated data access, and seamless integration with Redux's reducer pattern. Unlike other solutions, it provides a more opinionated structure similar to an ORM, but may lack active maintenance.

npm install redux-db
INSTALL
IMPORT
SIG · REDUX-DB
R
redux-db
databasejavascriptv0.9.17
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createDb
import { createDb } from 'redux-db'
const createDb = require('redux-db').createDb
ESM import is preferred; CJS require works but may cause issues with bundlers.
Database
import { Database } from 'redux-db'
const Database = require('redux-db').Database
TypeScript type export; use import type for type-only usage.
reduxDbReducer
import { reduxDbReducer } from 'redux-db'
import reduxDbReducer from 'redux-db'
Named export, not default export.

Shows how to create a database schema, add it to Redux store, insert data, and query it.

import { createDb, reduxDbReducer } from 'redux-db'; import { createStore, combineReducers } from 'redux'; // Define schema const db = createDb({ users: { fields: ['name', 'email'] }, posts: { fields: ['title', 'content', 'authorId'], relations: { author: { type: 'belongsTo', table: 'users' }, }, }, }); // Create Redux store const store = createStore( combineReducers({ reduxDb: reduxDbReducer, }) ); // Insert data db.users.insert({ name: 'Alice', email: 'alice@example.com' }); db.posts.insert({ title: 'First Post', content: 'Hello', authorId: 1 }); // Get normalized state const state = store.getState(); console.log(state.reduxDb); // Denormalize with query const posts = db.posts.query().all(); console.log(posts);
Debug
Known issues
gotcharedux-db modifies the database object in-place? Not recommended for production use.
fix
Immutable operations are not guaranteed; consider forking or using alternative.
affects: <1.0.0
deprecatedThe `query` method has been replaced by `find` in newer versions? Check docs.
fix
Use `find` with appropriate filters.
affects: >=0.5.0 <0.9.0
breakingredux-db changed reducer structure between 0.8.x and 0.9.x, requiring store migration.
fix
Upgrade to 0.9.x and follow migration guide to update store shape.
affects: >=0.8.0 <0.9.0
Errors
Common errors & fixes
TypeError: Cannot read property 'users' of undefined
redux-db reducer not properly combined in Redux store.
fix
Ensure reduxDbReducer is combined under the key 'reduxDb' in combineReducers.
Uncaught Error: Module not found: Can't resolve 'redux-db/lib/index'
CJS require path incorrect for certain bundler configurations.
fix
Use ESM import: import { createDb } from 'redux-db'
Upgrade
Version history
0.9.17latest on npm
Audit
Dependencies
reduxrequiredruntime dependency for Redux store integration
Agent activity
11 hits · last 30 days
node
10
Meta
1
Resources
redux-db — npm install redux-db · libregistry