G
YouTube TikTok Games
Skip to content
ilkkaoPublic

About

Typed, indexed records in Redis. Atomic Lua-scripted writes with schema validation for Node.js.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

RigidDB

Typed, indexed records in Redis.

CI codecov npm Docs

📖 Documentation: ilkkao.github.io/rigidDB

A promise-based Node.js library that stores plain JavaScript objects in Redis and makes them searchable through secondary indexes. Each operation runs as a single Lua script, so a record and its indexes are always updated together. Every write is validated against a predefined schema.

Requires Node.js 22 or later and Redis 6.2 or later. The package is an ES module and includes TypeScript type definitions.

Installation

npm install --save rigiddb

Example

import RigidDB from 'rigiddb';

const store = new RigidDB('mydb', 42);

await store.setSchema({
    cars: {
        fields: {
            model: { type: 'string', allowNull: false },
            color: 'string',
            mileage: 'int'
        },
        indexes: {
            byModel: { unique: true, fields: [ { name: 'model', caseInsensitive: true } ] },
            byColor: { unique: false, fields: [ 'color' ] }
        }
    }
});

const id = await store.create('cars', { model: 'sedan', color: 'blue', mileage: 12345 });

await store.find('cars', { color: 'blue' }); // [ 1 ]
await store.get('cars', id); // { model: 'sedan', color: 'blue', mileage: 12345 }

See the documentation for range indexes, paging, transactions, schema migrations, and the full API.

Developing the documentation

The documentation site is built with VitePress from the docs directory and deployed to GitHub Pages on every push to master.

npm run docs:dev

License

MIT

About

Typed, indexed records in Redis. Atomic Lua-scripted writes with schema validation for Node.js.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages