Skip to content

Typra turns TypeSpec model contracts into runtime model surfaces, generated tests, generated documentation, and reviewable metadata.

Use it when TypeSpec is the source of truth for shared data shapes and multiple runtimes need to agree on loading, saving, provider wire names, polymorphism, and generated API shape.

Typra is deliberately emitter-only. It generates model and protocol surfaces, but product-specific TypeSpec contracts, service behavior, and hand-authored adapters stay in the consuming product.

SectionUse it for
ConceptsThe mental model, a simple example, and the end-to-end generation flow.
TypeSpec MappingsHow TypeSpec shapes lower into Typra concepts and generated runtime surfaces.
TargetsWhat each output target looks like and which options matter for that runtime.
ReferenceConfiguration, CLI commands, compatibility, verifier behavior, and roadmap details.
Use Typra when…Keep hand-authored code when…
TypeSpec is the durable source of truth for shared model shapes.Behavior depends on product-specific runtime decisions.
Multiple runtimes need consistent serialization and wire names.A one-off integration does not need generated parity.
Generated output will be reviewed in CI.The shape is still exploratory and changing daily.
Tests and metadata help teams trust code generation.Custom adapters or service implementations are the actual product logic.

@typra/emitter currently validates against @typespec/compiler and @typespec/json-schema 1.10.0. Unsupported TypeSpec versions report an emitter diagnostic unless allow-unsupported-typespec-version: true is set intentionally.

  • Runtime model code for TypeScript, Python, C#, Go, Java, Rust, and Swift.
  • JSON/YAML load and save helpers where supported by the target.
  • Generated tests and optional compile-only protocol scaffolds.
  • Markdown reference output and a JSON contract AST.
  • Deterministic .typra-generated metadata for CI review.

Generated code should be useful, reviewable, and replaceable. Typra owns reusable generation behavior; consuming products own domain contracts, runtime orchestration, and adapter logic.