nats-io/nats.ex
70.9
Strong · 15 November 2026
6.8k
lines of production code
Elixir
primary language
5
measurements over time
What this system is
Features
Add JetStream support with PullConsumer, Pager, and Object Store metadata
This change introduces core NATS JetStream capabilities to the Gnat client. It adds a PullConsumer module that supports durable and ephemeral consumers, batch processing, cumulative acknowledgements, and a local watchdog for heartbeat recovery. A new Pager module provides a synchronous API to iterate through stream messages, including a reduce function for aggregation. Additionally, an Object Meta struct is added to handle metadata for JetStream Object Store buckets, and the main Jetstream module exposes standard acknowledgement functions (Ack, NAK, Term, Progress).
lib/gnat/jetstream · high confidence
Added benchmark suite for client, parsing, and JetStream operations
This change introduces a new set of benchmark scripts in the \bench/\ directory to measure performance across various client operations. The suite includes benchmarks for raw publishing and request/response latency (\publish.exs\, \request.exs\, \request\_multi.exs\), service-based requests (\service\_bench.exs\), and message parsing with headers using the new Parsec library (\parse.exs\). Additionally, it provides detailed benchmarks for consuming messages from JetStream Key-Value stores using different strategies such as Pager, PullConsumer, and PushConsumer (\kv\_consume.exs\), allowing users to evaluate throughput and latency characteristics of these patterns.
bench · high confidence
Added local 3-node NATS cluster scripts for manual failover testing
New scripts in the \scripts/cluster/\ directory allow developers to manually exercise PullConsumer failover behavior. The \cluster.sh\ utility manages a 3-node local NATS cluster (n1, n2, n3) with commands to start, stop, kill, check status, and clean up nodes. The \driver.exs\ script connects to the cluster, creates a JetStream stream and durable consumer, starts a PullConsumer, and publishes messages to verify that the consumer continues receiving data during node failures.
scripts · high confidence
Initial support for NATS Service API
Added the \Gnat.Services\ module to enable acting as a NATS service, allowing applications to define endpoints that participate in service discovery and monitoring according to the NATS service protocol. This includes a new \Gnat.Services.Server\ behavior for handling requests and errors, along with internal components for validating service configurations, managing subscription topics, and responding to protocol-level PING, INFO, and STATS requests via the \WireProtocol\ module.
lib/gnat/services · high confidence
Introduce JetStream API modules for Streams, Consumers, KV, and Object Store
This change adds the core JetStream API modules (\Gnat.Jetstream.API.{Stream, Consumer, KV, Object, Message}\) to the library. Users can now create and manage JetStream streams and consumers, interact with Key/Value buckets (including conditional key creation and bucket listing), and manage Object Store buckets (including chunked uploads, integrity verification, and metadata listing). The implementation also includes a helper to parse JetStream message metadata from acknowledgment topics and enforces validation of publish acknowledgments for KV writes to ensure server-side rejections are surfaced as errors.
lib/gnat/jetstream/api · high confidence
New KV Entry parser and Watcher for Key/Value buckets
Added \Gnat.Jetstream.API.KV.Entry\ to parse raw NATS messages from a Key/Value bucket into structured records, classifying operations (put, delete, purge) based on headers and stripping bucket prefixes. Added \Gnat.Jetstream.API.KV.Watcher\ as a GenServer that subscribes to a KV bucket's stream, handles flow control and status messages, and invokes a user-supplied handler with \:key\_added\, \:key\_deleted\, or \:key\_purged\ events, enabling real-time monitoring of KV changes.
lib/gnat/jetstream/api/kv · high confidence
New pull consumer implementation with connection options and server lifecycle
This change introduces the core infrastructure for the new JetStream pull consumer, adding the \ConnectionOptions\ module to validate and enforce configuration constraints (such as heartbeat timing and batch acknowledgement policies) and the \Server\ module to manage the consumer's lifecycle, including connection establishment, subscription handling, and retry logic.
_lib/gnat/jetstream/pull\consumer · high confidence
New supervised connection and consumer processes with secure credential handling
This release introduces Gnat.ConnectionSupervisor and Gnat.ConsumerSupervisor to manage NATS connections and long-lived subscriptions within your application's supervision tree, including automatic reconnection logic and graceful shutdown for consumers. It also adds a Gnat.Server behavior to simplify implementing NATS service handlers. To improve security, sensitive connection details (passwords, tokens, seeds) are now automatically redacted from logs, crash reports, and process status outputs via the new Gnat.Redaction module.
lib/gnat · high confidence
Behavioural changes
Library renamed from Neato to Gnat with expanded NATS client capabilities
The library has been renamed from Neato to Gnat, replacing the previous basic TCP-based implementation with a full-featured NATS client. This change introduces support for message headers, configurable connection timeouts, and flexible authentication where passwords, tokens, and nkey seeds can be provided as functions to avoid exposing secrets in crash reports. The client now supports TLS connections, custom inbox prefixes, and includes health checks via PING/PONG intervals. Additionally, the public API has been updated to include synchronous request handling, request multi-publishing, and detailed message types containing status and description fields.
lib · high confidence
Release 1.18.0 with improved connection resilience and KV correctness
This release introduces several behavioral changes to improve reliability and correctness. \Gnat.start\_link/2\ now returns \{:error, reason}\ instead of crashing during initialization if TLS, header support, or the CONNECT command fails, allowing supervisors to log the specific failure reason. The JetStream KV API has been hardened: \create\_key/5\ now strictly prevents overwriting existing keys (returning \{:error, :key\_exists}\), while \put\_value/5\, \delete\_key/4\, and \purge\_key/4\ validate server acknowledgements to ensure writes are not silently reported as successful when rejected. Additionally, subject names containing control characters are now validated to prevent injection, and supervised PullConsumers are configured to only recreate ephemeral consumers upon reconnection.
(repo-wide) · high confidence
Removal of deprecated Mix.Config usage
The project has removed the deprecated Mix.Config module and its associated configuration file (config/config.exs). This change eliminates the legacy configuration mechanism, aligning the codebase with modern Elixir standards that no longer rely on Mix.Config for application setup.
config · high confidence
Test coverage
Added comprehensive test coverage for Jetstream API components; Added test coverage for Jetstream PullConsumer; Added test coverage for Jetstream components; Added test fixtures for TLS and NKey authentication; Added test support infrastructure for Jetstream and protocol generation; Added tests for KV Entry parsing and Watcher status handling; Added unit, property, and integration tests for Gnat; Expanded test coverage for NATS client security, protocol parsing, and ordering.
Dependencies
Upgrade to version 1.18.0 with Elixir 1.16 requirement and dependency updates
The project has been renamed to Gnat and bumped to version 1.18.0, requiring Elixir 1.16 or higher. The dependency list has been updated to include Jason, Connection, NimbleParsec, Nkeys, and Telemetry, while dev dependencies for Benchee, Dialyxir, ExDoc, and Propcheck have been added. The application now explicitly starts the :ssl application, and documentation configuration has been expanded to include JetStream guides and a changelog.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 71 → 71 (-0.1)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 97 → 95 (-2.1)
- Architecture 85 → 85 (+0.0)
- Maturity 53 → 53 (+0.0)
- Readiness 84 → 84 (+0.0)
- Security 100 → 100 (+0.0)
- Performance 85 → 85 (+0.0)
Resolved (1)
- Off-boarding risk: anonymized user #1
New (9)
- Edited copy of a member (11 corresponding lines) (lib/gnat.ex)
- Edited copy of a member (11 corresponding lines) (lib/gnat/jetstream/api/kv.ex)
- Edited copy of a member (13 corresponding lines) (lib/gnat.ex)
- Edited copy of a member (16 corresponding lines) (lib/gnat/parsec.ex)
- Edited copy of a member (17 corresponding lines) (lib/gnat/jetstream/api/consumer.ex)
- Edited copy of a member (18 corresponding lines) (lib/gnat/jetstream/api/kv.ex)
- Edited copy of a member (26 corresponding lines) (lib/gnat.ex)
- Edited copy of a member (4 corresponding lines) (lib/gnat/handshake.ex)
- Off-boarding risk: anonymized user #1
Changes since last survey
- 6 commits — 6 feature/other, 0 fixes
By area
- (repo) — 2 commits
- (root) — 2 commits
- lib/gnat — 1 commit
- test/pull_consumer — 1 commit
Notable commits
- change: Add an inbox_prefix option to Object, Pager and KV watch
- change: Build PullConsumer on gen_statem instead of connection
- change: Merge pull request #248 from ericmj/remove-connection
- change: Merge pull request #249 from SAY-5/object-inbox-prefix
- change: release 1.19.1
- change: release 1.20.0
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
nats-io/nats.ex was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 15 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 1b7e001c1023f1bd32f8c95c20b1f7b6c8f5ea43 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-3c33c1882dc1.