A human-friendly command-line interface for the Nostr protocol.
Interacting with Nostr shouldn't require a GUI. nostr-cli gives you a fast, scriptable CLI that works like git β manage multiple profiles, switch contexts, and publish events from your terminal.
- Multi-profile support β switch between identities like git branches
- Human-friendly β use aliases and usernames, not just npubs
- Unix-native β pipes, scripts, cron jobs β it just works
- π Login with existing nsec or generate a new keypair
- π€ View and update profiles (kind 0)
- π Post text notes (kind 1)
- π¬ Encrypted DMs (NIP-04 / NIP-44)
- π Follow/unfollow users
- π Manage relay lists per profile
- π·οΈ Create aliases for quick access to contacts
- π₯ Switch between multiple profiles
- π Built-in NIP reference viewer
# Install via go (binary will be named nostr-cli)
go install github.com/xdamman/nostr-cli@latest
# Or build from source as `nostr`
git clone https://github.com/xdamman/nostr-cli.git
cd nostr-cli
make install # installs as `nostr` in $GOPATH/bin# Create or import a profile
nostr login
# Post a note
nostr post "Hello Nostr!"
# Follow someone
nostr follow npub1...
# Send a DM
nostr dm npub1... "hey there"
# View someone's profile and notes
nostr npub1...| Command | Description |
|---|---|
nostr login |
Create a new profile or import an existing nsec |
nostr switch [alias|username|npub] |
Switch between profiles |
nostr profile |
Show your current profile |
nostr profile [npub|username|alias] |
Show another user's profile |
nostr profile update |
Interactively update your profile fields |
| Command | Description |
|---|---|
nostr post [message] |
Post a text note (interactive if no message given) |
nostr follow [npub|username] |
Follow a user |
nostr dm [user] [message] |
Send a DM (interactive mode if no message given) |
nostr [npub|username|alias] |
View a user's profile and latest 10 notes |
nostr [user] --watch |
Live-stream a user's new notes |
| Command | Description |
|---|---|
nostr relays |
List current relays |
nostr relays add wss://... |
Add a relay |
nostr relays rm [url|number] |
Remove a relay |
nostr alias [name] [npub|username] |
Create an alias for a user |
| Command | Description |
|---|---|
nostr nip[0-9]+ |
View a NIP specification |
Tip: Append
--helpto any command for usage details β e.g.nostr dm --help
All state lives in ~/.nostr/:
~/.nostr/
βββ profiles/
βββ <npub>/
βββ nsec # Private key (chmod 600)
βββ profile.json # Kind 0 metadata
βββ relays.json # Preferred relay list
βββ aliases.csv # Contact aliases
Each profile is isolated β relays, aliases, and keys are scoped per identity.
Contributions welcome! Check docs/ROADMAP.md for planned features and docs/COMMANDS.md for command specs.
- Fork the repo
- Create a feature branch
- Submit a PR