A JavaScript library (v2.1.5) for Confluent Schema Registry integration, enabling Avro serialization and deserialization of Kafka messages. Requires only avsc as a peer dependency. Caches schemas to reduce network calls. Supports encoding/decoding by schema, ID, or topic. Provides authentication via URL or options object. Updated irregularly; last release in 2023.
npm install avro-schema-registryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a registry client, encode an Avro message by topic and schema, then decode it using async/await.
Use const registry = require('avro-schema-registry')('https://url') instead of const registry = require('avro-schema-registry')Replace registry.decodeMessage(msg) with registry.decode(msg)
Use encodeKey(topic, schema, message) for key schemas and encodeMessage(topic, schema, message) for value schemas.
Use ES import syntax in ESM context, or use dynamic import() in Node environments that support it. For CommonJS, keep using require() as shown.
const registry = require('avro-schema-registry')('https://your-registry:8081');npm install avsc
Verify the URL and ensure Schema Registry is running. If using authentication, check credentials.
Register the schema first using encodeMessage/encodeKey, or provide a valid schema ID.