Code examples
Nostr Agent Onboarding · start here · source:
nostr-dev/sdk/examples/· snapshot 2026-10-10Paths such as
~/Documents/…,~/Production Environment/…,repos/…and services onlocalhostrefer to the author's workstation and are not available to you — read them as worked examples of a setup you can recreate.
Small TypeScript programs using nostr-tools (run with npx tsx <file>; deps: nostr-tools, ws). Secrets come from the environment (NOSTR_SECRET_KEY), never from code.
- ping-relay.ts — Connect to a relay with nostr-tools and read a few kind 1 events.
- fetch-profile.ts — Fetch a kind 0 profile.
- fetch-grasp-repo.ts — Fetch a NIP-34 repository announcement from a GRASP relay.
- blossom-upload.ts — Upload a blob to a Blossom server with a signed kind 24242 auth event.
- publish-wrap-with-auth.ts — Publish a pre-signed event to a relay that demands NIP-42 AUTH, without re-signing it.