TypeScript to Apache Avro Schema Converter

Convert TypeScript interfaces and type definitions into Apache Avro (.avsc) record schemas in your browser.

At a glance

TypeScript to Avro Converter translates TypeScript interfaces and type aliases into Apache Avro record schemas. It maps object properties to Avro fields, translates optional properties to null unions with default null, handles string, int, double, and boolean primitives, converts arrays and enums, and exports valid .avsc files client-side.

Universal Switcher:
From:
To:

100% Client-Side In-Browser TypeScript to Apache Avro (.avsc) Schema Converter

Compile TypeScript interfaces and types into Apache Avro record schemas, null union types, default values, enums, and timestamp logicalTypes locally in browser memory. Zero network latency or server uploads.

Pure In-Browser
Presets:
0 lines • 0 chars
Avro Schema Options
0 fields
Valid Apache Avro Record Schema

Optional Null Unions

In Apache Avro, optional fields are defined as null unions ["null", "type"] with a default value of null. The generator automatically maps optional TypeScript properties to compliant unions.

Timestamp Logical Types

TypeScript Date objects automatically serialize as 64-bit integer values paired with Avro's standard timestamp-millis logicalType for seamless Kafka and data warehouse integration.

Kafka & Registry Ready

The generated JSON schemas are 100% compatible with Confluent Schema Registry, AWS Glue, Apache Flink, and Kafka serializers out of the box with zero modifications.

Why Use This TypeScript to Apache Avro Schema Converter?

100% Client-Side Conversion: All TypeScript parsing and Avro schema generation runs locally in browser memory with zero network requests.
Strict Null Unions: Generates compliant ["null", type] union definitions with "default": null for all optional and nullable properties.
Timestamp Logical Types: Maps TypeScript Date objects to 64-bit integer timestamps with timestamp-millis logicalType.
Enum Symbol Mapping: Automatically parses TypeScript string literal unions into native Apache Avro enum definitions.
Namespace & JSDoc Support: Configures custom Avro namespaces and embeds TypeScript documentation comments as Avro doc attributes.

How to Use TypeScript to Apache Avro Schema Converter

1

Paste TypeScript Definitions

Enter or paste your TypeScript interfaces, type aliases, or enums into the input editor.

2

Configure Avro Options

Specify an optional namespace, choose default integer types (int vs long), and select JSON formatting style.

3

Copy or Download .avsc File

Copy the generated Apache Avro schema directly or download it as an .avsc file ready for Schema Registry.

TypeScript Interface to Apache Avro Record Schema

Demonstrates converting a TypeScript interface with scalar primitives and optional properties into a standard Apache Avro record schema.

TypeScript Interface Source
interface CustomerRecord {
  id: string;
  name: string;
  active: boolean;
  balance: number;
  bio?: string;
}
Apache Avro (.avsc) Schema Processed
{
  "type": "record",
  "name": "CustomerRecord",
  "fields": [
    { "name": "id", "type": "string" },
    { "name": "name", "type": "string" },
    { "name": "active", "type": "boolean" },
    { "name": "balance", "type": "int" },
    { "name": "bio", "type": ["null", "string"], "default": null }
  ]
}

Technical Specifications & Engine Details

Technical specifications and engine details for TypeScript to Apache Avro Schema Converter
Specification Details
Supported Formats TEXT → TEXT
Execution Mode 100% Client-Side In-Browser (client)
Browser Requirements Modern browser with JavaScript enabled.
Performance Constraints Zero external dependencies. Runs 100% client-side in browser memory.
Maintained by Pragyan Pahadi

100% Client-Side Privacy Guarantee

Your files and data remain strictly on your local device. Computations run locally using browser memory with zero network uploads.

Frequently Asked Questions

How does the converter handle optional TypeScript properties?
Optional fields (e.g. bio?: string) and nullable unions are translated into Avro union schemas ["null", "string"] with "default": null per the Avro specification.
Are nested TypeScript interfaces supported?
Yes. Referenced or inline interface definitions are recursively compiled into nested Avro record schemas.
How are TypeScript Date properties mapped?
Date properties map to Avro 64-bit long integers tagged with the official logicalType "timestamp-millis".
Is my source code secure and private?
Yes. 100% of the conversion runs client-side in your local browser sandbox. No source code or schemas are ever uploaded to external servers.

Methodology

This tool runs entirely in your browser. The example above shows a representative input and the result it produces.

Last updated .