Installation
Who is this for? Event-driven API architects, platform engineers, and backend teams already using TypeSpec who want a typed, validated AsyncAPI 3.1 source of truth instead of hand-written YAML.
Requirements
Section titled “Requirements”- Node.js 20.11 or newer
- The TypeSpec compiler (
tspCLI) - A package manager: pnpm, npm, yarn, or bun
Install the emitter
Section titled “Install the emitter”pnpm add @lars-artmann/typespec-asyncapi @typespec/compileror with npm:
npm install @lars-artmann/typespec-asyncapi @typespec/compilerWire it into tspconfig.yaml
Section titled “Wire it into tspconfig.yaml”The emitter is loaded by the tsp compiler via tspconfig.yaml:
emit: - "@lars-artmann/typespec-asyncapi"options: "@lars-artmann/typespec-asyncapi": file-type: yamlSee Emitter Options for the full option list (output file, format, pretty-printing, split-schemas, asyncapi-id, and more).
Verify the install
Section titled “Verify the install”Create a minimal spec and compile it:
npx tsp compile api.tspThe output lands in tsp-output/@lars-artmann/typespec-asyncapi/asyncapi.yaml.
Where to go next
Section titled “Where to go next”- Quick Start — your first channel, operation, and message in 5 minutes
- Decorators — all 30 decorators with targets and examples
- Protocol Bindings — Kafka, MQTT, WebSocket, and 16 more
- Related Tools — AsyncAPI Studio, Spectral, and sibling emitters