# Code examples

> **Nostr Agent Onboarding** · [start here](https://npub1d70emggs6jzun5lhvqnfqsd9reqmaarn2qjf6q3r02gryyl4v8sqjn44xe.nsite.lol/start.md) · source: `nostr-dev/sdk/examples/` · snapshot 2026-10-10
>
> Paths such as `~/Documents/…`, `~/Production Environment/…`, `repos/…` and services on `localhost` refer 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](https://npub1d70emggs6jzun5lhvqnfqsd9reqmaarn2qjf6q3r02gryyl4v8sqjn44xe.nsite.lol/examples/ping-relay.md) — Connect to a relay with nostr-tools and read a few kind 1 events.
- [fetch-profile.ts](https://npub1d70emggs6jzun5lhvqnfqsd9reqmaarn2qjf6q3r02gryyl4v8sqjn44xe.nsite.lol/examples/fetch-profile.md) — Fetch a kind 0 profile.
- [fetch-grasp-repo.ts](https://npub1d70emggs6jzun5lhvqnfqsd9reqmaarn2qjf6q3r02gryyl4v8sqjn44xe.nsite.lol/examples/fetch-grasp-repo.md) — Fetch a NIP-34 repository announcement from a GRASP relay.
- [blossom-upload.ts](https://npub1d70emggs6jzun5lhvqnfqsd9reqmaarn2qjf6q3r02gryyl4v8sqjn44xe.nsite.lol/examples/blossom-upload.md) — Upload a blob to a Blossom server with a signed kind 24242 auth event.
- [publish-wrap-with-auth.ts](https://npub1d70emggs6jzun5lhvqnfqsd9reqmaarn2qjf6q3r02gryyl4v8sqjn44xe.nsite.lol/examples/publish-wrap-with-auth.md) — Publish a pre-signed event to a relay that demands NIP-42 AUTH, without re-signing it.
