A collection of Node.js examples demonstrating KurrentDB Schema Registry functionality.
- KurrentDB: Version 25.1 or above (required for Schema Registry support)
- Node.js Client:
@kurrent/kurrentdb-clientversion 1.2.0 or above (required for Schema Registry API)
Before running the examples, you need to have KurrentDB running. The easiest way is using Docker:
docker run --name kurrentdb-node -it -p 2113:2113 docker.kurrent.io/kurrent-latest/kurrentdb:25.1.1 --insecure --run-projections=All --enable-atom-pub-over-http --start-standard-projectionsNote: The command above is shown as a single line for compatibility across all terminals and operating systems. If your terminal supports multi-line commands, you can split it for better readability.
This will start KurrentDB on port 2113 and run in insecure mode (no TLS and no credientials required to login)
Managing the container:
# Stop the server
docker stop kurrentdb-node
# Restart the server
docker start kurrentdb-node
# Remove the container
docker rm kurrentdb-node- Install dependencies:
npm install- Make sure KurrentDB is running on
localhost:2113(or update the endpoint in the example files)
A quick start guide showing basic schema operations:
- Create a schema with unique UUID-based name
- Retrieve schema metadata
- Check compatibility
- Register new versions
- List versions
Note: Uses unique schema names (with UUID suffix) for each run.
npm run simpleComplete demonstration of all schema registry features:
- Create schemas with initial versions and unique UUID-based names
- Get schema metadata and versions
- Check schema compatibility
- Register new schema versions
- List schemas and versions
- Update schema metadata
- Get versions by ID
- Test incompatible changes
- Cleanup operations (commented out by default)
Note: Uses unique schema names (with UUID suffix) for each run.
npm run demoDemonstrates different schema formats:
- JSON Schema - Standard JSON schema validation
- Protobuf - Protocol Buffers schema definition
- Avro - Apache Avro schema format
- Bytes - Custom binary schema format
- Compatibility modes explained
- Listing schemas by format
Note: All schemas created with unique UUID-based names.
npm run formats- ✓ Create schemas with different data formats (JSON, Protobuf, Avro, Bytes)
- ✓ Update schema metadata (description, tags)
- ✓ Delete schemas and versions
- ✓ List all schemas with filtering
- ✓ Register new schema versions
- ✓ Get specific versions by number or ID
- ✓ List all versions for a schema
- ✓ Delete specific versions
- ✓ Check if a new schema is compatible
- ✓ Different compatibility modes (backward, forward, full, etc.)
- ✓ Detect incompatible changes
- ✓ Error details for compatibility issues
- ✓ JSON Schema
- ✓ Protocol Buffers (Protobuf)
- ✓ Apache Avro
- ✓ Custom Bytes format
backward- New schema can read old dataforward- Old schema can read new datafull- Both backward and forward compatiblebackward-all- Compatible with all previous versionsforward-all- All previous versions compatible with newfull-all- Fully compatible with all versionsnone- No compatibility checking
You can modify the connection settings in each example file:
endpoint: KurrentDB connection string (default:localhost:2113)tls: Whether to use TLS (default:false)
All examples use the @kurrent/kurrentdb-client package (v1.2.0-alpha.0).
Key methods demonstrated:
createSchema()- Create a new schemagetSchema()- Get schema metadataupdateSchema()- Update schema metadatadeleteSchema()- Delete a schemalistSchemas()- List all schemasregisterSchemaVersion()- Add a new versiongetSchemaVersion()- Get a specific versiongetSchemaVersionById()- Get version by IDlistSchemaVersions()- List all versionsdeleteSchemaVersions()- Delete specific versionscheckSchemaCompatibility()- Check compatibilitylistRegisteredSchemas()- List schemas with definitionslookupSchemaName()- Look up schema by version ID