Type-safe and validated data schemas for Redis with TypeScript. Version 1.1.0 provides runtime and compile-time validation for Redis data structures like hashes, counters, and objects. Ensures key uniqueness across schema definitions to prevent accidental reuse. Different from generic Redis ORMs by enforcing schema validation at both read and write, with built-in TypeScript type inference. Low release cadence; stable for production use cases requiring strict data integrity.
npm install safe-redis-schemaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Defines and uses a Redis schema with validated hashes and counters, demonstrating key reuse prevention and type safety.
Ensure each Redis key is used only once across schema definitions (e.g., do not define both defineObj and defineHashOfCounters for same key).
Set REDIS_URL environment variable or pass URL to RedisStore constructor.
Enable strict mode in tsconfig.json to benefit from type inference.
Use unique keys for each schema definition or namespace them appropriately.
Ensure RedisStore is correctly imported: import { RedisStore } from 'safe-redis-schema';