feat: add Store.redis() for standard Redis/ioredis/Valkey clients#210
Merged
feat: add Store.redis() for standard Redis/ioredis/Valkey clients#210
Conversation
Adds a new Store.redis() adapter that accepts any client with standard get/set/del string methods and handles BigInt-safe serialization internally using ox's Json.parse/Json.stringify. This fills the gap between Store.memory() (not suitable for production multi-instance deployments) and Store.upstash() (requires Upstash's REST SDK which auto-serializes JSON). Standard Redis clients only accept strings, so passing channel state with BigInt fields directly to client.set() either throws or corrupts data. Store.redis() works with ioredis, node-redis (@redis/client), Valkey, and any Redis-compatible client without requiring a specific package dependency. Closes wevm#208
tmm
approved these changes
Mar 23, 2026
brendanjryan
pushed a commit
that referenced
this pull request
Mar 24, 2026
* feat: add Store.redis() for standard Redis/ioredis/Valkey clients Adds a new Store.redis() adapter that accepts any client with standard get/set/del string methods and handles BigInt-safe serialization internally using ox's Json.parse/Json.stringify. This fills the gap between Store.memory() (not suitable for production multi-instance deployments) and Store.upstash() (requires Upstash's REST SDK which auto-serializes JSON). Standard Redis clients only accept strings, so passing channel state with BigInt fields directly to client.set() either throws or corrupts data. Store.redis() works with ioredis, node-redis (@redis/client), Valkey, and any Redis-compatible client without requiring a specific package dependency. Closes #208 * chore: changeset --------- Co-authored-by: tmm <tmm@tmm.dev>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Store.redis()- a new store adapter for standard Redis clients that handles BigInt-safe serialization internally.Closes #208
Problem
Store.upstash()works because the Upstash REST SDK auto-serializes JSON (including BigInt) on their end. Standard Redis clients (ioredis, node-redis, Valkey) only accept strings, so passing channel state with BigInt fields directly toclient.set()either throws or corrupts data.Anyone running self-hosted Redis/Valkey has to write a custom store adapter with BigInt-safe serialization - which is error-prone and every self-hosted user rediscovers independently.
Solution
Store.redis()accepts any client with standardget/set/delstring methods and handles serialization internally usingox'sJson.parse/Json.stringify(same asStore.cloudflare()andStore.memory()already do):Interface
Works with ioredis, node-redis (
@redis/client), Valkey, and any Redis-compatible client without requiring a specific package dependency.Tests
redisto the existingdescribe.eachtest matrix (roundtrip, missing key, delete, overwrite)redis json-roundtrips nested objectstestredis roundtrips BigInt valuestest (the core issue this solves)All 21 tests pass.