nostr:npub1ye5ptcxfyyxl5vjvdjar2ua3f0hynkjzpx552mu5snj3qmx5pzjscpknpr what's the best db available in the browser for nostr?

Reply to this note

Please Login to reply.

Discussion

Indexeddb

that's what I've been using but people are mad at it

Second option is probably local relay lol

Yeah indexeddb for sure. what are people complaining about?

I would say use this, https://github.com/hzrd149/window.nostrdb.js

Its built to auto connect to a local relay at ws://localhost:4869 or fallback to indexeddb. I've been meaning to add support for WASM via nostr:npub1v0lxxxxutpvrelsksy8cdhgfux9l6a42hsj2qzquu2zk7vc9qnkszrqj49's worker relay but I haven't figured out how to package it yet

And as nostr:npub1elta7cneng3w8p9y4dw633qzdjr4kyvaparuyuttyrx6e8xp7xnq32cume mentioned I built a small extension that automatically injects the window.nostrdb api 😁

If you don't want to use my magic library then https://github.com/hzrd149/nostr-idb or the nostr:npub1v0lxxxxutpvrelsksy8cdhgfux9l6a42hsj2qzquu2zk7vc9qnkszrqj49's worker relay is great

https://hzrd149.github.io/applesauce/examples/#database/worker-relay

ty bro, i'll take a look. been happy with indexeddb so far. for #grimoire i still didn't add any offline event storage, it's all ephemeral. only storing NIP, NIP-05 resolutions, profiles, relay lists and relay liveness stats for now.

If your using applesauce then there is a simple persistEventsToCache() method that takes an event store and a async methods to save batches of new events to a local cache 👍