nats.go is a Go client library for NATS, the cloud native messaging system.
The library solves the problem of integrating Go applications with NATS infrastructure for pub-sub and request-reply messaging patterns. It provides direct access to NATS core messaging capabilities alongside JetStream, the built-in persistence system for durable message streams and consumer groups. The client handles connection management, authentication via Nkeys and user credentials, TLS encryption, and advanced patterns like wildcard subscriptions and queue groups. JetStream support includes both asset management and persistent message publishing and consumption through a dedicated API.
Developers should choose this library when building Go microservices that need to communicate through NATS. It suits cloud-native architectures where reliable, scalable messaging is required. The library includes a Service API in beta for building NATS services directly. The project maintains backward compatibility by supporting at least two latest minor Go versions and does not treat struct field additions or new interface methods as breaking changes, allowing the library to evolve without forcing immediate upgrades.
The project maintains active development with regular updates to both core functionality and documentation. The team provides comprehensive reference examples through a dedicated cross-client resource and maintains detailed README documentation for major subsystems like JetStream and the Service API. Testing infrastructure is documented for local development, and the project follows standard Go compatibility guidelines while being explicit about its backward compatibility stance.