# Introduction

A TypeScript Kafka client for Kafka 0.10+

Package: @cookiemonsterdev/kafka-core 2.8.1
Canonical: https://cookiemonsterdev.github.io/kafka/docs/core/start/introduction/
Source revision: b112a684d2b3cdc7deadb3513041fcdbdc1c18b5

`@cookiemonsterdev/kafka-core` is a TypeScript Kafka client:
`new Kafka({ brokers }).producer() / consumer() / admin()`.

It targets **Kafka 0.10 and newer**. Offsets are `bigint`, ZSTD is built in
when the broker supports it, and types are generated from source rather than
hand-maintained.

The client never talks to ZooKeeper. ZooKeeper is a broker deployment detail
for pre-KRaft clusters, not a client feature. See
[KRaft vs ZooKeeper](https://kafka.apache.org/43/getting-started/zk2kraft/)
and the [Apache Kafka introduction](https://kafka.apache.org/43/getting-started/introduction/).

This site documents the public API. The library lives in
[`packages/core`](https://github.com/cookieMonsterDev/kafka/tree/develop/packages/core);
this Astro site is `packages/docs`.

Next: [Installation](https://cookiemonsterdev.github.io/kafka/docs/core/start/installation/),
[Getting started](https://cookiemonsterdev.github.io/kafka/docs/core/start/getting-started/),
[Kafka client](https://cookiemonsterdev.github.io/kafka/docs/core/reference/kafka/),
[Errors](https://cookiemonsterdev.github.io/kafka/docs/core/guides/errors/),
[Breaking changes](https://cookiemonsterdev.github.io/kafka/docs/core/migration/breaking-changes/).

## Supported brokers

The client negotiates protocol versions from `ApiVersions`. A broker that
advertises an API uses the highest version both sides implement. A broker that
is too old for a _used_ API throws `KafkaServerDoesNotSupportApiKey`.

| Broker        | Record format                         | Notes                                                            |
| ------------- | ------------------------------------- | ---------------------------------------------------------------- |
| Kafka 0.10    | MessageSet (magic 0/1)                | No headers, no transactions                                      |
| Kafka 0.11    | RecordBatch (magic 2)                 | Headers, transactions, ACLs, DescribeConfigs                     |
| Kafka 1.x     | RecordBatch                           | SaslAuthenticate, CreatePartitions, DeleteGroups                 |
| Kafka 2.x     | RecordBatch                           | ZSTD from 2.1, rack-aware fetch from 2.2                         |
| Kafka 3.x     | RecordBatch, KRaft                    | Same client APIs as 2.x                                          |
| Kafka 4.0     | RecordBatch, KRaft only on the broker | Talks via overlap (Produce 3–13, Fetch 4–18)                     |
| Kafka 4.1–4.3 | RecordBatch, KRaft only on the broker | Compose files in tree (`apache/kafka:4.1.2` / `4.2.2` / `4.3.2`) |

Integration tests cover 0.10, 0.11, 1.1, 2.4, 3.6, 4.0, 4.1, 4.2, and 4.3;
[Compatibility](https://cookiemonsterdev.github.io/kafka/docs/core/reference/compatibility/#tested-brokers) lists which run on each CI event. Kafka 4.0
brokers no longer run ZooKeeper. The client still encodes older Produce/Fetch
versions when a 0.10–3.x broker advertises them. Constructor defaults, the
implemented producer/consumer/admin surface, and APIs that are not
implemented, are listed under [Compatibility](https://cookiemonsterdev.github.io/kafka/docs/core/reference/compatibility/).
How to run the integration matrix: [Testing](https://cookiemonsterdev.github.io/kafka/docs/core/guides/testing/).

For common operational tasks, use [Task recipes](https://cookiemonsterdev.github.io/kafka/docs/core/guides/recipes/) and [Troubleshooting](https://cookiemonsterdev.github.io/kafka/docs/core/guides/troubleshooting/).
