Skip to main content

Libraries Overview

This section covers the most popular libraries for building Nostr applications across different programming languages.

Choosing a Library​

LanguagePrimary LibraryBest For
JavaScript/TypeScriptnostr-toolsWeb apps, Node.js
Rustnostr-sdk, rust-nostrHigh-performance, native apps
Pythonpynostr, python-nostrScripts, bots, backends
Gogo-nostrBackend services
SwiftNostrKitiOS/macOS apps
KotlinnostrpostrAndroid apps

Library Categories​

Full SDKs​

Complete solutions with connection management, signing, and utilities:

  • nostr-tools (JS)
  • nostr-sdk (Rust)
  • go-nostr (Go)

Core Libraries​

Focused on protocol primitives:

  • rust-nostr (Rust)
  • nostr-js (JS)

Specialized Libraries​

Focused on specific features:

  • NIP-07 browser extensions
  • Lightning/Zap integrations
  • NIP-44 encryption libraries

Quick Comparison​

JavaScript​

import { SimplePool, generateSecretKey, getPublicKey, finalizeEvent } from 'nostr-tools';

const sk = generateSecretKey();
const pk = getPublicKey(sk);

const event = finalizeEvent({
kind: 1,
content: 'Hello!',
tags: [],
created_at: Math.floor(Date.now() / 1000)
}, sk);

Rust​

use nostr_sdk::prelude::*;

let keys = Keys::generate();
let client = Client::new(keys);

client.add_relay("wss://relay.damus.io").await?;
client.connect().await;

client.publish_text_note("Hello!").await?;

Python​

from nostr.key import PrivateKey
from nostr.event import Event

private_key = PrivateKey()
event = Event(content="Hello!")
event.sign(private_key.hex())

Go​

import "github.com/nbd-wtf/go-nostr"

sk := nostr.GeneratePrivateKey()
pk, _ := nostr.GetPublicKey(sk)

event := nostr.Event{
PubKey: pk,
CreatedAt: nostr.Now(),
Kind: 1,
Content: "Hello!",
}
event.Sign(sk)

Feature Matrix​

Featurenostr-toolsnostr-sdkgo-nostrpynostr
Key generation✓✓✓✓
Event signing✓✓✓✓
Relay pool✓✓✓✓
NIP-04 DMs✓✓✓✓
NIP-44 encryption✓✓Partial-
NIP-57 Zaps✓✓✓-
NIP-42 Auth✓✓✓✓
WebSocket✓✓✓✓

Getting Started​

Choose your language:

Community Resources​