Skip to content

NATS

A high-performance messaging system that ships as a single Go binary and adds optional JetStream persistence on top of a fire-and-forget core.

  • Category: Messaging & Streaming
  • CNCF maturity: Incubating
  • Language: Go
  • License: Apache-2.0
  • Repository: nats-io/nats-server
  • Documented at commit: bd058fac (default branch HEAD, source VERSION 2.15.0-dev, nearest release v2.14.2)

What it is

NATS is a publish/subscribe messaging system. Producers send messages to a subject (a dotted string like orders.eu.new), and the server routes each message to every subscriber whose interest matches that subject. Matching uses a subject token tree with wildcards, so subscribers express interest in patterns such as orders.*.new or orders.>.

The core protocol is at-most-once. The server holds nothing on disk, and a message with no current subscriber is dropped. On top of this core, JetStream adds persistence, replay, at-least-once delivery, key/value buckets, and object storage. JetStream stores data in its own append-only file format and replicates across a cluster with Raft, so it needs no external database.

A single nats-server binary covers the full range of deployment shapes: a standalone process, a clustered set of routed servers, a super-cluster of gateways across regions, and leaf nodes that extend a cluster out to the edge. The same connection-handling code serves all of these by tagging each connection with a kind (server/client.go:259).

When to use it

  • You want low tail latency for request/reply and pub/sub between services, with one binary and no external dependencies.
  • You run across regions or out to edge devices and want a built-in topology (gateways, leaf nodes) rather than bolting one on.
  • You need at-least-once delivery, replay, or a key/value store, and want it from the same system through JetStream.
  • It is a weaker fit when you need Kafka-style partition and offset semantics as a first-class model. Strict per-key ordering combined with horizontal scale means building subject-based partitioning yourself.

In this deep-dive

Sources

  1. nats-io/nats-server (GitHub)
  2. nats-io organization (GitHub)
  3. NATS project page (CNCF)
  4. NATS Graduation Application (cncf/toc#2042)
  5. CNCF and Synadia Align on Securing NATS.io
  6. Protecting NATS and the integrity of open source (CNCF)
  7. RedMonk Conversation with Derek Collison
  8. NATS Messaging (Wikipedia)
  9. JetStream (NATS Docs)
  10. Consumers (NATS Docs)
  11. NATS.io About
  12. Synadia tries to claw NATS back (The Stack)
  13. Benchmarking Message Queue Latency (Brave New Geek)
  14. Message Brokers Comparison 2026 (dev.to)
  15. Kafka vs RabbitMQ vs NATS vs SQS (BackendBytes)