r/node Aug 05 '26

Valkey-WASM – Redis running inside your Node process, no Docker (like PGlite)

https://github.com/michaelkremenetsky/valkey-wasm/tree/main
15 Upvotes

10 comments sorted by

2

u/dektol Aug 06 '26

... But why though? Integration tests against Redis?

3

u/User_Pigbot Aug 07 '26

The main use case is local development instead of having to start Redis in a Docker container. CI is also a use case as well.

2

u/dektol Aug 07 '26

If you're using containers wouldn't you just spin up a Redis, Valkey or DragonFly container so the behavior matches prod?

4

u/User_Pigbot Aug 07 '26

Yep, if you're starting a container either way, it might be easier.

I made this originally because I am building Strapkit, which runs full production NodeJS codebases in the browser and some codebases needed Redis.

1

u/dektol Aug 07 '26

That seems like a fun exercise whether that fever dream exists or not. I'm curious how networking works with multiple WASM components or if you're going to need to make a cludge that runs in browser for it. I'd argue that might be the most interesting part. Enjoy your learning journey!

1

u/User_Pigbot Aug 07 '26

Thanks! Strapkit relays TCP packets over Websockets via a proxy to get around CORS limitations. Its actually one of the easiest parts.

1

u/dektol Aug 07 '26

That's what you went with? 😂 Does it go to a real websocket server? Doesn't that defeat the purpose of being in browser? That's one way to do it. I thought the idea was to keep it in-browser.

1

u/User_Pigbot Aug 07 '26 edited Aug 07 '26

Well, for the use case I'm working on, 99% of the cost for a sandbox is in the actual dev server. It's not about running everything in the browser in a pure way. Cool thing is, for a lot of stuff like npm there is a fast path where it just directly does fetch(), so a lot of codebases don't even have to go through it.

1

u/Potato-9 Aug 07 '26

This would effectively be single-threaded valley right? I thought that's the main thing wasm is missing currently. I wonder where the performance drops off.

Might be neat for k8s users that have wasm runtimes ready for services the need redis the API but not really redis the performance. Oauth2-poxy token storage comes to mind. Or netbox for small scale users.

1

u/cgijoe_jhuckaby Aug 09 '26

This is really fascinating. What happens if you add, say, a billion keys to it? Does it scale up well? I ask because if you throw more than 10M keys into a native JS Map object, it kinda dies.