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 VERSION2.15.0-dev, nearest releasev2.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
- History: origin, milestones, and why it exists.
- Architecture: components and how requests flow.
- Adoption & Ecosystem: who runs it and what surrounds it.
- Internals: the code paths that matter, read from source.
- Getting Started: install and a first working setup.
Sources
- nats-io/nats-server (GitHub)
- nats-io organization (GitHub)
- NATS project page (CNCF)
- NATS Graduation Application (cncf/toc#2042)
- CNCF and Synadia Align on Securing NATS.io
- Protecting NATS and the integrity of open source (CNCF)
- RedMonk Conversation with Derek Collison
- NATS Messaging (Wikipedia)
- JetStream (NATS Docs)
- Consumers (NATS Docs)
- NATS.io About
- Synadia tries to claw NATS back (The Stack)
- Benchmarking Message Queue Latency (Brave New Geek)
- Message Brokers Comparison 2026 (dev.to)
- Kafka vs RabbitMQ vs NATS vs SQS (BackendBytes)