Skip to content

tcheeric/nostr-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nostr-java

CI CI Matrix: docker + no-docker codecov GitHub release License: MIT Qodana

nostr-java is a Java SDK for the Nostr protocol. It provides utilities for creating, signing and publishing Nostr events to relays.

Requirements

  • Maven
  • Java 21+

See docs/GETTING_STARTED.md for installation and usage instructions.

Running Tests

  • Full test suite (requires Docker for Testcontainers ITs):

    mvn -q verify

  • Without Docker (skips Testcontainers-based integration tests via profile):

    mvn -q -Pno-docker verify

The no-docker profile excludes tests under **/nostr/api/integration/** and sets noDocker=true for conditional test disabling.

Troubleshooting

For diagnosing relay send issues and capturing failure details, see the how‑to guide: docs/howto/diagnostics.md.

Documentation

Examples

Examples are located in the nostr-java-examples module. See the API Examples Guide for detailed walkthroughs.

Key Examples

  • NostrApiExamples – Comprehensive examples covering 13+ use cases including text notes, encrypted DMs, reactions, channels, and more. See the guide for details.

  • SpringSubscriptionExample – Shows how to open a non-blocking NostrSpringWebSocketClient subscription and close it after a fixed duration.

Features

  • Clean Architecture - Modular design following SOLID principles
  • Comprehensive NIP Support - 25 NIPs implemented covering core protocol, encryption, payments, and more
  • Type-Safe API - Strongly-typed events, tags, and messages with builder patterns
  • Non-Blocking Subscriptions - Spring WebSocket client with reactive streaming support
  • Well-Documented - Extensive JavaDoc, architecture guides, and code examples
  • Production-Ready - High test coverage, CI/CD pipeline, code quality checks

Recent Improvements (v1.0.0)

🎯 API Cleanup & Removals (breaking)

  • Deprecated APIs removed: Constants.Kind, Encoder.ENCODER_MAPPER_BLACKBIRD, and NIP01 Identity-based overloads
  • NIP01 now exclusively uses the instance-configured sender; builder simplified accordingly

🚀 Performance & Serialization

  • Centralized JSON mapper via nostr.event.json.EventJsonMapper (Blackbird module); unified across event encoders

📚 Documentation & Structure

  • Migration guide updated for 1.0.0 removals and replacements
  • Troubleshooting moved to dedicated how‑to: docs/howto/diagnostics.md
  • README streamlined to focus on users; maintainer topics moved under docs

🛠️ Build & Release Tooling

  • CI workflow split for Docker vs no‑Docker runs
  • Release automation (scripts/release.sh) with bump/tag/verify/publish steps

See docs/explanation/architecture.md for detailed architecture overview.

Supported NIPs

25 NIPs implemented - comprehensive coverage of core protocol, security, and advanced features.

NIP Compliance Matrix

Category NIP Description Status
Core Protocol NIP-01 Basic protocol flow ✅ Complete
NIP-02 Follow List ✅ Complete
NIP-12 Generic Tag Queries ✅ Complete
NIP-19 Bech32 encoding ✅ Complete
NIP-20 Command Results ✅ Complete
Security & Identity NIP-05 DNS-based identifiers ✅ Complete
NIP-42 Client authentication ✅ Complete
NIP-46 Remote signing ✅ Complete
Encryption NIP-04 Encrypted DMs ✅ Complete
NIP-44 Versioned encryption ✅ Complete
Content Types NIP-08 Handling Mentions ✅ Complete
NIP-09 Event Deletion ✅ Complete
NIP-14 Subject tags ✅ Complete
NIP-23 Long-form content ✅ Complete
NIP-25 Reactions ✅ Complete
NIP-28 Public Chat ✅ Complete
NIP-30 Custom Emoji ✅ Complete
NIP-32 Labeling ✅ Complete
NIP-52 Calendar Events ✅ Complete
Commerce & Payments NIP-15 Marketplace ✅ Complete
NIP-57 Lightning Zaps ✅ Complete
NIP-60 Cashu Wallets ✅ Complete
NIP-61 Nutzaps ✅ Complete
NIP-99 Classified Listings ✅ Complete
Utilities NIP-03 OpenTimestamps ✅ Complete
NIP-40 Expiration Timestamp ✅ Complete

Coverage: 25/100+ NIPs (core protocol + most commonly used extensions)

Contributing

Contributions are welcome! See CONTRIBUTING.md for:

  • Coding standards and conventions
  • How to add new NIPs
  • Pull request guidelines
  • Testing requirements

For architectural guidance, see docs/explanation/architecture.md.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A nostr library, written in java, for generating, signing and publishing events.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 14