Skip to content
CAI
Software that uses CAICheck a score

fastify/fastify-kafka

58.4

Adequate · 21 September 2026

361

lines of production code

JavaScript

with TypeScript

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Fastify plugin that integrates Apache Kafka for message production and consumption. It provides typed APIs for subscribing to topics, handling incoming messages, and sending payloads, supporting both batch and streaming consumption modes. The implementation relies on the @platformatic/kafka library and includes comprehensive TypeScript definitions and test coverage.

Features

Add TypeScript definitions for @platformatic/kafka integration

The package now includes TypeScript declaration files that extend Fastify to support Kafka producers and consumers. Users can access \app.kafka\ with typed methods for pushing messages, consuming data, and subscribing to topics, along with configuration options for producer and consumer settings.

types · high confidence

Add basic Kafka producer/consumer example

A new example file (examples/basic.js) demonstrates how to set up a Fastify application with both a Kafka producer and consumer. It shows registering the plugin with bootstrap brokers, subscribing to topics, handling incoming messages, and pushing responses back to Kafka.

examples · high confidence

Behavioural changes

Migration to @platformatic/kafka and Fastify 5 support

The plugin has migrated from the underlying \node-rdkafka\ library to \@platformatic/kafka\ (starting in version 3.x) and now officially supports Fastify 5.x. This change introduces new configuration options such as \producerTopicConf\, \consumerTopicConf\, and \metadataOptions\, and updates the API to use \bootstrapBrokers\ instead of the legacy \metadata.broker.list\. The package name has also been updated to \@fastify/kafka\.

(repo-wide) · high confidence

Migration to @platformatic/kafka for producer and consumer implementations

The library's core messaging components have been rewritten to use the @platformatic/kafka package. The new consumer supports both batch consumption (collecting a specified number of messages with a timeout) and continuous streaming, allowing users to register callbacks for specific topics and manually commit offsets. The producer has been updated to use string serializers by default and sends messages via a unified send API that handles topic, key, payload, and partition details. Both components now expose standard Node.js EventEmitter interfaces for error handling and lifecycle management.

lib · high confidence

Test coverage

Added tests for Kafka consumer and producer using Node test runner

Added new test files for the Kafka Consumer and Producer components, migrating the test suite to use the Node test runner (\node:test\). The tests cover message emission, stream destruction, initialization errors, batch consumption, commit errors, and handler exceptions for the consumer, as well as message sending, broker errors, constructor errors, and shutdown handling for the producer. Test utilities were also updated to use the \@platformatic/kafka\ Admin API for topic management.

test · high confidence

Dependencies

Update dependencies for @fastify/kafka v4.0.0

The package.json has been updated to version 4.0.0, introducing several dependency changes. The Kafka client library has been switched from node-rdkafka to @platformatic/kafka (v1.34.0). The Fastify plugin wrapper has been upgraded to fastify-plugin v6.0.0, and the core Fastify dependency is now set to v5.0.0. Development dependencies have also been updated, including c8 to v12.0.0, neostandard to v0.13.0, and @types/node to v26.0.0, while the TypeScript testing tool has shifted from tsd to tstyche (v7.0.0).

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 58 → 58 (+0.2)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 66 → 72 (+5.9)
  • Architecture 69 → 69 (+0.0)
  • Maturity 59 → 59 (+0.0)
  • Readiness 50 → 49 (-1.5)
  • Security 95 → 100 (+5.1)

Resolved (7)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • High: security finding (details withheld)
  • No exposed public API
  • Scanner failed to run — not a clean result
  • Test reliability not included
  • dormant codebase — no living knowledge left to concentrate

New (9)

  • Dependency hygiene PARTLY measured — npm pinning read, dependency currency not (no committed lockfile, so no resolved version to grade)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no licence statement (README.md)
  • Medium IaC: WD-COMPOSE-0002 (docker-compose.yml)
  • No assertions (empty test): should break loop if stopped while streaming (test/consumer.test.js)
  • No assertions (empty test): should handle null partition (test/producer.test.js)
  • No assertions (empty test): should handle stop when producer is not initialized (test/producer.test.js)
  • Scanner failed to run — not a clean result
  • Scanner failed to run — not a clean result

Changes since last survey

  • 3 commits — 3 feature/other, 0 fixes

By area

  • .github/workflows — 2 commits
  • (root) — 1 commit

Notable commits

  • change: chore(.npmrc): add min-release-age
  • change: chore: bump fastify/workflows/.github/workflows/lock-threads.yml (#184)
  • change: chore: bump fastify/workflows/.github/workflows/plugins-ci-kafka.yml (#183)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

fastify/fastify-kafka 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 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 5b705d5eb1b8dfcc4cfa75918eac03d5a6517a8b — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.