npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

driftschema-redis

v0.2.0

Published

Redis storage engine for driftschema — stores field definitions to Redis.

Readme

driftschema-redis

A Redis-backed storage engine for driftschema — a lightweight, dynamic schema library for TypeScript that defines and evolves entity fields at runtime, without migrations.

This package currently provides:

  • RedisFieldDefinitionStore — a FieldDefinitionStore implementation that persists field definitions to Redis.

There is no RedisRecordStore yet, so records themselves need a different RecordStore (e.g. driftschema's built-in InMemoryRecordStore, or driftschema-mongo's MongoRecordStore) — see Usage below.

Installation

npm install driftschema driftschema-redis redis

Usage

RedisFieldDefinitionStore is constructed directly with a connected node-redis client — there's no RecordStoreFactory engine to register here, since this package doesn't provide a record store.

import { createClient } from "redis";
import { InMemoryRecordStore } from "driftschema";
import { RedisFieldDefinitionStore } from "driftschema-redis";

const client = createClient({ url: "redis://localhost:6379" });
await client.connect();

const fieldDefinitions = new RedisFieldDefinitionStore(client);

const caratWeight = await fieldDefinitions.add({
  entityType: "diamonds",
  name: "caratWeight",
  type: "number",
  required: true,
});

// Any FieldDefinitionStore can back InMemoryRecordStore — schema lives in
// Redis, records live in memory.
const recordStore = new InMemoryRecordStore(fieldDefinitions);

const diamond = await recordStore.createFlat("diamonds", { caratWeight: 1.5 });

See examples/basic-usage.ts for a fuller runnable walkthrough (uses redis-memory-server, so it runs standalone with no real Redis deployment required — run it with npm run example).

API

RedisFieldDefinitionStore

new RedisFieldDefinitionStore(client: RedisClientType)

Implements driftschema's FieldDefinitionStore interface: add, getByEntityType, delete.

Design notes

  • Field definition ids are plain GUIDs (crypto.randomUUID()), not Redis-prefixed — the id is a domain concept shared with the other storage engines (e.g. driftschema-mongo), so it stays implementation-agnostic.
  • Redis-specific namespacing lives in the key, not the id. Each definition is stored as JSON at fielddef:<id>, since a Redis instance is often shared with unrelated data and a bare id as the key would risk collisions.
  • getByEntityType is backed by a secondary index — a Redis set at fielddef:byEntityType:<entityType> holding the ids for that type, kept in sync by add and delete. This avoids scanning the whole keyspace to filter by field.

License

MIT — see the root LICENSE.