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