A familiar API. A different architecture.
Make nostr
feel familiar
A TypeScript SDK for signed records, realtime, and personal encrypted data. Built on Applesauce.
TypeScript
import { createClient } from "nostrbase";
const db = createClient({
namespace: "my-app",
relays: ["wss://your-relay.example"],
});
await db.auth.signInWithExtension();
const { data, error } = await db
.from("todos")
.insert({ title: "Build something", done: false })
.select()
.single();const { data: user } = await db.auth.getUser();
if (!user) throw new Error("Sign in first.");
const { data, error } = await db
.from("todos")
.select("id, title, done")
.author(user.pubkey)
.eq("done", false)
.order("title")
.limit(20);
// A cache-only read sends no relay request.
const cached = await db.from("todos").local();const channel = db
.channel("todos")
.on("nostr_changes", {
table: "todos",
event: "*",
}, ({ eventType, new: row, old }) => {
console.log(eventType, row, old);
})
.subscribe();
// Release subscriptions and pending cache writes.
await db.removeChannel(channel);
await db.closeAsync();Writes are signed by the user
THE STACK
Your app connects directly.
Build your app
Choose a feature. Get the code and its constraints.
NIP-78
Database
Typed records, filters, schemas, and cursor pages.
NIP-07 / 46
Authentication
Connect an extension, private key, or remote signer.
WebSocket
Realtime
Live changes, Broadcast, and Presence.
NIP-44
Private data
Personal tables with encrypted record bodies.
Blossom
File storage
Hash-verified uploads and downloads via Blossom.
NIP-77
Offline and sync
Persist events, queue writes, and recover missed data.
Start in your environment
Use your existing UI stack.
Know the data model
Record identity includes the author. Queries cover known relay data. App rules run in the client.
Coming from Supabase?Local release. Install the built archive; nostrbase is not yet published to npm.
Installation