Skip to content

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.

  • Node.js 20.11 or newer
  • The TypeSpec compiler (tsp CLI)
  • A package manager: pnpm, npm, yarn, or bun
Terminal window
pnpm add @lars-artmann/typespec-asyncapi @typespec/compiler

or with npm:

Terminal window
npm install @lars-artmann/typespec-asyncapi @typespec/compiler

The emitter is loaded by the tsp compiler via tspconfig.yaml:

emit:
- "@lars-artmann/typespec-asyncapi"
options:
"@lars-artmann/typespec-asyncapi":
file-type: yaml

See Emitter Options for the full option list (output file, format, pretty-printing, split-schemas, asyncapi-id, and more).

Create a minimal spec and compile it:

Terminal window
npx tsp compile api.tsp

The output lands in tsp-output/@lars-artmann/typespec-asyncapi/asyncapi.yaml.

  • 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