# confluentinc/schema-registry architecture

> Architecture diagram of the GitHub repository confluentinc/schema-registry, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/confluentinc/schema-registry
- Repository: https://github.com/confluentinc/schema-registry

## Overview

Schema Registry serves versioned Avro, JSON Schema, and Protobuf metadata through REST, while Kafka serializers and deserializers register or retrieve schemas for message encoding. The principal path is client schema submission, format-specific parsing and compatibility validation, registry storage, then ID-based lookup by serializers. The tree also shows client libraries, DEK/KMS encryption, and rule execution as meaningful capabilities. Source excerpts are limited, so links beyond documented README behavior are omitted; README-supported relationships are cited explicitly.

Main entry points: [`core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java`](https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java) (Registry Operations), [`client/src/main/java/io/confluent/kafka/schemaregistry/SchemaProvider.java`](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/SchemaProvider.java) (Schema Providers), [`core/src/main/java/io/confluent/kafka/schemaregistry/rest/Main.java`](https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/rest/Main.java) (REST Server), [`client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java`](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java) (Registry Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST and Clients"]
  node_rest_server["REST Server<br/>[Main.java]"]
  node_rest_client["REST Client<br/>[RestService.java]"]
  node_schema_client["Registry Client"]
  node_schema_api["Schema API<br/>[Schema.java]"]
end

subgraph group_schema["Schema Management"]
  node_registry["Registry Operations"]
  node_schema_store[("Versioned Schema Store<br/>[SchemaValue.java]")]
  node_compatibility["Compatibility Checks"]
  node_schema_provider["Schema Providers"]
  node_avro["Avro Support"]
  node_json["JSON Schema Support"]
  node_protobuf["Protobuf Support"]
end

subgraph group_messaging["Kafka Integration"]
  node_avro_serde["Avro Serdes"]
  node_json_serde["JSON Serializer"]
  node_protobuf_serde["Protobuf Serdes"]
end

subgraph group_security["Encryption and Rules"]
  node_dek_client["DEK Client"]
  node_dek_rest["DEK REST Service"]
  node_kms["KMS Drivers"]
  node_field_encryption["Field Encryption"]
  node_rules["Schema Rules<br/>[RuleExecutor.java]"]
end

node_user(("API User"))
node_kafka(("Kafka Application"))

node_user -->|"register or query"| node_rest_server
node_rest_server -.->|"handles requests"| node_registry
node_registry -.->|"parses schemas"| node_schema_provider
node_schema_provider -.->|"supports format"| node_avro
node_schema_provider -.->|"supports format"| node_json
node_schema_provider -.->|"supports format"| node_protobuf
node_registry -->|"checks evolution"| node_compatibility
node_registry -->|"stores versions"| node_schema_store
node_rest_server -->|"accepts schema data"| node_schema_api
node_schema_client -.->|"sends registry requests"| node_rest_client
node_rest_client -->|"calls REST API"| node_rest_server
node_kafka -->|"serializes messages"| node_avro_serde
node_kafka -->|"uses schema serializer"| node_json_serde
node_kafka -->|"serializes messages"| node_protobuf_serde
node_avro_serde -->|"registers or fetches"| node_schema_client
node_json_serde -->|"registers or fetches"| node_schema_client
node_protobuf_serde -->|"registers or fetches"| node_schema_client
node_dek_client -->|"calls DEK endpoints"| node_dek_rest
node_dek_rest -->|"reuses REST transport"| node_rest_client
node_field_encryption -.->|"uses key material"| node_dek_client
node_kms -.->|"provides cryptography"| node_field_encryption
node_rules -.->|"applies field rules"| node_field_encryption

click node_rest_server "https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/rest/Main.java"
click node_rest_client "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/RestService.java"
click node_schema_client "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java"
click node_schema_api "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/entities/Schema.java"
click node_registry "https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java"
click node_schema_store "https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaValue.java"
click node_compatibility "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/CompatibilityChecker.java"
click node_schema_provider "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/SchemaProvider.java"
click node_avro "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/avro/AvroSchemaProvider.java"
click node_json "https://github.com/confluentinc/schema-registry/tree/master/json-schema-provider/src/main/java/io/confluent/kafka/schemaregistry/json"
click node_protobuf "https://github.com/confluentinc/schema-registry/tree/master/protobuf-provider/src/main/java/io/confluent/kafka/schemaregistry/protobuf"
click node_avro_serde "https://github.com/confluentinc/schema-registry/blob/master/avro-serializer/src/main/java/io/confluent/kafka/serializers/KafkaAvroSerializer.java"
click node_json_serde "https://github.com/confluentinc/schema-registry/blob/master/json-serializer/src/main/java/io/confluent/kafka/serializers/KafkaJsonDeserializer.java"
click node_protobuf_serde "https://github.com/confluentinc/schema-registry/blob/master/protobuf-serializer/src/main/java/io/confluent/kafka/serializers/protobuf/AbstractKafkaProtobufSerializer.java"
click node_dek_client "https://github.com/confluentinc/schema-registry/blob/master/dek-registry-client/src/main/java/io/confluent/dekregistry/client/CachedDekRegistryClient.java"
click node_dek_rest "https://github.com/confluentinc/schema-registry/blob/master/dek-registry-client/src/main/java/io/confluent/dekregistry/client/rest/DekRegistryRestService.java"
click node_kms "https://github.com/confluentinc/schema-registry/blob/master/client-encryption-tink/src/main/java/io/confluent/kafka/schemaregistry/encryption/tink/KmsDriverManager.java"
click node_field_encryption "https://github.com/confluentinc/schema-registry/blob/master/client-encryption/src/main/java/io/confluent/kafka/schemaregistry/encryption/FieldEncryptionExecutor.java"
click node_rules "https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/rules/RuleExecutor.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rest_server,node_rest_client,node_schema_client,node_schema_api,node_user toneBlue
class node_registry,node_schema_store,node_compatibility,node_schema_provider,node_avro,node_json,node_protobuf toneAmber
class node_avro_serde,node_json_serde,node_protobuf_serde toneMint
class node_dek_client,node_dek_rest,node_kms,node_field_encryption,node_rules toneRose
class node_kafka toneIndigo
```

## Components

### REST and Clients

- [REST Server](https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/rest/Main.java): `core/src/main/java/io/confluent/kafka/schemaregistry/rest/Main.java`
- [REST Client](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/RestService.java): `client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/RestService.java`
- [Registry Client](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java): `client/src/main/java/io/confluent/kafka/schemaregistry/client/CachedSchemaRegistryClient.java`
- [Schema API](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/entities/Schema.java): `client/src/main/java/io/confluent/kafka/schemaregistry/client/rest/entities/Schema.java`

### Schema Management

- [Registry Operations](https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java): `core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java`
- [Versioned Schema Store](https://github.com/confluentinc/schema-registry/blob/master/core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaValue.java): `core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaValue.java`
- [Compatibility Checks](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/CompatibilityChecker.java): `client/src/main/java/io/confluent/kafka/schemaregistry/CompatibilityChecker.java`
- [Schema Providers](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/SchemaProvider.java): `client/src/main/java/io/confluent/kafka/schemaregistry/SchemaProvider.java`
- [Avro Support](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/avro/AvroSchemaProvider.java): `client/src/main/java/io/confluent/kafka/schemaregistry/avro/AvroSchemaProvider.java`
- [JSON Schema Support](https://github.com/confluentinc/schema-registry/tree/master/json-schema-provider/src/main/java/io/confluent/kafka/schemaregistry/json): `json-schema-provider/src/main/java/io/confluent/kafka/schemaregistry/json`
- [Protobuf Support](https://github.com/confluentinc/schema-registry/tree/master/protobuf-provider/src/main/java/io/confluent/kafka/schemaregistry/protobuf): `protobuf-provider/src/main/java/io/confluent/kafka/schemaregistry/protobuf`

### Kafka Integration

- [Avro Serdes](https://github.com/confluentinc/schema-registry/blob/master/avro-serializer/src/main/java/io/confluent/kafka/serializers/KafkaAvroSerializer.java): `avro-serializer/src/main/java/io/confluent/kafka/serializers/KafkaAvroSerializer.java`
- [JSON Serializer](https://github.com/confluentinc/schema-registry/blob/master/json-serializer/src/main/java/io/confluent/kafka/serializers/KafkaJsonDeserializer.java): `json-serializer/src/main/java/io/confluent/kafka/serializers/KafkaJsonDeserializer.java`
- [Protobuf Serdes](https://github.com/confluentinc/schema-registry/blob/master/protobuf-serializer/src/main/java/io/confluent/kafka/serializers/protobuf/AbstractKafkaProtobufSerializer.java): `protobuf-serializer/src/main/java/io/confluent/kafka/serializers/protobuf/AbstractKafkaProtobufSerializer.java`

### Encryption and Rules

- [DEK Client](https://github.com/confluentinc/schema-registry/blob/master/dek-registry-client/src/main/java/io/confluent/dekregistry/client/CachedDekRegistryClient.java): `dek-registry-client/src/main/java/io/confluent/dekregistry/client/CachedDekRegistryClient.java`
- [DEK REST Service](https://github.com/confluentinc/schema-registry/blob/master/dek-registry-client/src/main/java/io/confluent/dekregistry/client/rest/DekRegistryRestService.java): `dek-registry-client/src/main/java/io/confluent/dekregistry/client/rest/DekRegistryRestService.java`
- [KMS Drivers](https://github.com/confluentinc/schema-registry/blob/master/client-encryption-tink/src/main/java/io/confluent/kafka/schemaregistry/encryption/tink/KmsDriverManager.java): `client-encryption-tink/src/main/java/io/confluent/kafka/schemaregistry/encryption/tink/KmsDriverManager.java`
- [Field Encryption](https://github.com/confluentinc/schema-registry/blob/master/client-encryption/src/main/java/io/confluent/kafka/schemaregistry/encryption/FieldEncryptionExecutor.java): `client-encryption/src/main/java/io/confluent/kafka/schemaregistry/encryption/FieldEncryptionExecutor.java`
- [Schema Rules](https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/rules/RuleExecutor.java): `client/src/main/java/io/confluent/kafka/schemaregistry/rules/RuleExecutor.java`

### Other components

- **API User**
- **Kafka Application**

## Connections

- API User → REST Server: register or query
- REST Server → Registry Operations: handles requests
- Registry Operations → Schema Providers: parses schemas (evidence: `core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java`)
- Schema Providers → Avro Support: supports format
- Schema Providers → JSON Schema Support: supports format
- Schema Providers → Protobuf Support: supports format
- Registry Operations → Compatibility Checks: checks evolution
- Registry Operations → Versioned Schema Store: stores versions (evidence: `core/src/main/java/io/confluent/kafka/schemaregistry/storage/SchemaRegistry.java`)
- REST Server → Schema API: accepts schema data
- Registry Client → REST Client: sends registry requests
- REST Client → REST Server: calls REST API
- Kafka Application → Avro Serdes: serializes messages
- Kafka Application → JSON Serializer: uses schema serializer
- Kafka Application → Protobuf Serdes: serializes messages
- Avro Serdes → Registry Client: registers or fetches
- JSON Serializer → Registry Client: registers or fetches
- Protobuf Serdes → Registry Client: registers or fetches
- DEK Client → DEK REST Service: calls DEK endpoints (evidence: `dek-registry-client/src/main/java/io/confluent/dekregistry/client/CachedDekRegistryClient.java`)
- DEK REST Service → REST Client: reuses REST transport (evidence: `dek-registry-client/src/main/java/io/confluent/dekregistry/client/rest/DekRegistryRestService.java`)
- Field Encryption → DEK Client: uses key material
- KMS Drivers → Field Encryption: provides cryptography
- Schema Rules → Field Encryption: applies field rules
