NDK (Nostr Development Kit)
NDK is a TypeScript/JavaScript library that simplifies building Nostr clients, relays, and related applications.
WARNING
The documentation of the NDK project is under heavy construction. More information available in open pull request.
Features
- Event creation, validation, and wrappers for major NIPs
- Flexible subscription API with caching, batching, and auto-closing
- Event Signing through private key, encrypted keys (NIP-49), browser extension (NIP-07) or remote signer (NIP-46)
- Relay connection pool with automatic reconnection and failover
- Outbox model support
- Pluggable cache adapters (Redis, Dexie, SQLite, etc)
- Data Vending Machine support (NIP-90)
- Zap utilities (NIP-57, NIP-61)
- Threading, event kinds, and utility functions (URL normalization, metadata tags, filters)
- Modular design with packages for different frameworks (Mobile, Svelte, React)
NIP Support
Multi-Repo
NDK is a monorepo with different packages. The main package is @nostr-dev-kit/core and contains the core functionality.
For other functionality you might need additional packages:
Extras
- @nostr-dev-kit/blossom: Blossom Protocol Support for assets
- @nostr-dev-kit/sessions: Session Management with Multi-Account support
- @nostr-dev-kit/sync: Event synchronization using Negentropy
- @nostr-dev-kit/wallet: Support for WebLN, NWC, Cashu/eCash wallets
- @nostr-dev-kit/wot: Web of Trust (WOT) utilities
Framework Integrations
- @nostr-dev-kit/react: Hooks and utilities to integrate Nostr into your React applications
- @nostr-dev-kit/svelte: Modern, performant, and beautiful Svelte 5 integration
Cache Adapters
These NDK adapters are used to store and retrieve data from a cache so relays do not need to be re-queried for the same data.
- @nostr-dev-kit/cache-memory: In-memory LRU cache adapter
- @nostr-dev-kit/cache-nostr: Local Nostr relay cache adapter
- @nostr-dev-kit/cache-redis: A cache adapter for Redis
- @nostr-dev-kit/cache-dexie: Dexie (IndexedDB, in browser database) adapter
- @nostr-dev-kit/cache-sqlite: SQLite (better-sqlite3) adapter
- @nostr-dev-kit/cache-sqlite-wasm: In browser (WASM) SQLite adapter