A template is a project that specifies the generation process output by using the AsyncAPI generator and an AsyncAPI document. These files describe the generation results depending on the AsyncAPI document's content.
- Markdown diagrams
- Python and Java applications
A template is an independent Node.js project unrelated to the
generator repository. AsyncAPI templates are managed, released, and published separately. You can also create templates and manage templates on your own.
The generator uses the official Arborist NPM library. (This means templates do not have to be published to package managers to use them.) Arborist helps the generator fetch the template's source code and use it for the generation process.
You can store template projects on a local drive or as a
git repository during the development process.
Template generation process
- Template is provided as input to the Generator.
- asyncapi is the original AsyncAPI document injected into your template file by default.
- params are the parameters you pass to the generator CLI. Later, you can also pass these params further to other components.
- The generator passes both the original asyncapi, the original AsyncAPI document, and the params to the Template Context.
- Concurrently, the generator passes Template files to the Render engine as well. AsyncAPI uses two render engines — react and nunjucks.
- Once the Render Engine receives both the Template Files and the Template Context, it injects all the dynamic values into your react or nunjucks engine, based on the Template Files using the Template Context.
- The render engine generates whatever output you may have specified in your template. (i.e. code, documentation, diagrams, pdfs, applications, etc.)
AsyncAPI has a list of available templates to enhance your generation process. Templates are stored as repositories on AsyncAPI's official GitHub profile.
|Template Name||Description||Source code|
|Generates Node.js service that uses Hermes package||Node.js template|
|Generates Node.js service that supports WebSocket protocol only||Node.js WebSocket template|
|Generates Java JMS application||Java template|
|Generates Java Spring service||Java spring template|
|Generates Java Spring Cloud Stream service||Java spring cloud stream template|
|Generates Python service that uses Paho library||Python paho template|
|Generates HTML documentation site||HTML template|
|Generates documentation in Markdown file||Markdown template|
|Generates TypeScript NATS client||TypeScript/Node.js NATS template|
|Generates Go client using Watermill||GO watermill template|
|Generates .NET C# client using NATS||.NET C# NATS template|
Some of these templates are maintained by various third-party organizations. The README file usually contains this information and more, such as configuration options the user can pass to the template, usage, technical requirements, etc.
Check out all our community generator templates