Convert Figma logo to code with AI

asyncapi logospec

The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.

4,104
262
4,104
39

Top Related Projects

The OpenAPI Specification Repository

5,005

CloudEvents Specification

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

GUI / visual editor for creating and editing OpenAPI / Swagger definitions

Quick Overview

The AsyncAPI Specification is an open-source project that defines a standard for describing asynchronous APIs. It aims to provide a common language for documenting message-driven APIs, enabling better tooling, code generation, and API management for event-driven architectures.

Pros

  • Standardizes the description of asynchronous APIs, improving interoperability
  • Supports multiple protocols (e.g., AMQP, MQTT, Kafka, WebSockets)
  • Enables automatic code generation and documentation
  • Growing ecosystem with various tools and libraries

Cons

  • Still evolving, which may lead to breaking changes in future versions
  • Less mature compared to REST API specifications like OpenAPI
  • Limited adoption compared to synchronous API specifications
  • May require a learning curve for teams unfamiliar with event-driven architectures

Getting Started

To start using AsyncAPI, create a YAML or JSON file describing your API:

asyncapi: 2.5.0
info:
  title: Hello World API
  version: 1.0.0
channels:
  hello:
    publish:
      message:
        payload:
          type: string
          pattern: ^hello .+$

Use tools like the AsyncAPI Generator to create documentation or code from your specification:

npm install -g @asyncapi/generator
ag https://raw.githubusercontent.com/asyncapi/spec/master/examples/streetlights.yml @asyncapi/html-template -o output

For more information and advanced usage, refer to the AsyncAPI documentation.

Competitor Comparisons

The OpenAPI Specification Repository

Pros of OpenAPI-Specification

  • More mature and widely adopted in the industry
  • Extensive tooling ecosystem and community support
  • Better suited for RESTful API documentation

Cons of OpenAPI-Specification

  • Limited support for event-driven architectures
  • Less flexible for describing asynchronous communication patterns
  • Lacks specific constructs for message-oriented protocols

Code Comparison

OpenAPI-Specification:

openapi: 3.0.0
info:
  title: Sample API
  version: 1.0.0
paths:
  /users:
    get:
      summary: List users

AsyncAPI:

asyncapi: 2.0.0
info:
  title: Sample API
  version: 1.0.0
channels:
  users:
    subscribe:
      summary: Receive user updates

The OpenAPI example focuses on HTTP endpoints, while AsyncAPI describes message-oriented channels. OpenAPI is tailored for RESTful APIs, whereas AsyncAPI is designed for event-driven architectures.

OpenAPI-Specification excels in documenting traditional request-response APIs, offering a mature ecosystem and widespread adoption. However, it falls short when describing asynchronous communication patterns. AsyncAPI fills this gap by providing specific constructs for event-driven architectures and message-oriented protocols, making it more suitable for modern, distributed systems that rely heavily on asynchronous communication.

5,005

CloudEvents Specification

Pros of CloudEvents spec

  • Focuses on describing event data structure, making it more lightweight and flexible
  • Widely adopted across cloud providers and event-driven architectures
  • Simpler to implement due to its narrower scope

Cons of CloudEvents spec

  • Limited to event description, lacking API-level specifications
  • Less comprehensive for full API documentation compared to AsyncAPI
  • May require additional tools or specifications for complete API design

Code comparison

AsyncAPI spec example:

asyncapi: 2.0.0
info:
  title: Streetlights API
channels:
  light/measured:
    publish:
      message:
        payload:
          type: object
          properties:
            id:
              type: integer
            lumens:
              type: integer

CloudEvents spec example:

{
  "specversion" : "1.0",
  "type" : "com.example.someevent",
  "source" : "/mycontext",
  "id" : "A234-1234-1234",
  "time" : "2018-04-05T17:31:00Z",
  "data" : {
    "message" : "Hello World!"
  }
}

Both specifications serve different purposes within event-driven architectures. AsyncAPI provides a more comprehensive approach to API design, including channels and message structures, while CloudEvents focuses on standardizing event data format across different platforms and services.

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)

Pros of openapi-generator

  • Broader language support: Generates client libraries, server stubs, and documentation for 40+ programming languages
  • More mature project: Larger community, more frequent updates, and extensive documentation
  • Supports both OpenAPI 2.0 and 3.0 specifications

Cons of openapi-generator

  • Focused solely on RESTful APIs, lacking support for event-driven architectures
  • More complex setup and configuration compared to AsyncAPI's simpler approach
  • Steeper learning curve due to its extensive feature set

Code comparison

AsyncAPI spec example:

asyncapi: 2.0.0
info:
  title: Streetlights API
  version: 1.0.0
channels:
  light/measured:
    publish:
      message:
        payload:
          type: object
          properties:
            lumens:
              type: integer

OpenAPI Generator example:

openapi: 3.0.0
info:
  title: Streetlights API
  version: 1.0.0
paths:
  /light/measured:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                lumens:
                  type: integer

The AsyncAPI spec focuses on event-driven architectures, while the OpenAPI Generator example demonstrates a RESTful API structure. AsyncAPI uses "channels" for communication, whereas OpenAPI uses "paths" for endpoints.

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

Pros of swagger-core

  • More mature and widely adopted in the industry
  • Extensive tooling ecosystem and community support
  • Better suited for RESTful API documentation

Cons of swagger-core

  • Limited support for event-driven architectures
  • Less flexible for describing non-HTTP protocols
  • Steeper learning curve for complex API structures

Code Comparison

swagger-core example:

@Path("/users")
public class UserResource {
    @GET
    @Produces(MediaType.APPLICATION_JSON)
    public Response getUsers() {
        // Implementation
    }
}

spec example:

channels:
  user/signedup:
    publish:
      message:
        payload:
          type: object
          properties:
            userId:
              type: string

Key Differences

  1. Purpose: swagger-core focuses on RESTful APIs, while spec is designed for event-driven architectures.
  2. Protocol support: swagger-core primarily targets HTTP, whereas spec supports multiple protocols.
  3. Documentation style: swagger-core uses annotations or YAML/JSON for API descriptions, while spec uses YAML for message-driven API definitions.
  4. Use cases: swagger-core is ideal for traditional request-response APIs, while spec excels in describing asynchronous, event-driven systems.
  5. Community and adoption: swagger-core has a larger user base and more extensive tooling, but spec is gaining traction in the microservices and event-driven space.

GUI / visual editor for creating and editing OpenAPI / Swagger definitions

Pros of openapi-gui

  • Provides a user-friendly graphical interface for creating and editing OpenAPI specifications
  • Offers real-time preview and validation of the OpenAPI document
  • Supports importing existing OpenAPI specifications for editing

Cons of openapi-gui

  • Limited to OpenAPI specifications, while spec supports AsyncAPI for event-driven architectures
  • Less comprehensive documentation and community support compared to spec
  • Fewer integration options with other tools and frameworks

Code Comparison

spec (AsyncAPI):

asyncapi: 2.0.0
info:
  title: Streetlights API
  version: 1.0.0
channels:
  light/measured:
    publish:
      message:
        payload:
          type: object
          properties:
            lumens:
              type: integer
              minimum: 0

openapi-gui (OpenAPI):

openapi: 3.0.0
info:
  title: Streetlights API
  version: 1.0.0
paths:
  /light/measured:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                lumens:
                  type: integer
                  minimum: 0

While both repositories focus on API specifications, spec is tailored for event-driven architectures using AsyncAPI, whereas openapi-gui provides a graphical interface for creating RESTful API specifications using OpenAPI. The code examples illustrate the structural differences between AsyncAPI and OpenAPI formats.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

AsyncAPI Logo

Read the specification

The latest draft specification can be found at spec/asyncapi.md which tracks the latest commit to the master branch in this repository.

The human-readable markdown file is the source of truth for the specification.

Click to see reference links to older versions of the specification.

Looking for the JSON Schema files? Check out our spec-json-schemas repo.

Feel like contributing? Check out our contributor's guide.

Examples

Check out the examples directory for examples.

Case Studies and Adopters

Check out the AsyncAPI website to see the list of AsyncAPI adopters and their use cases.

Our Sponsors

Want to become a sponsor? Learn what we do with sponsors' money and join the club.

Platinum

Solace logo      Gravitee      Postman

Gold

IBM

Silver

Bump.sh      Svix
HiveMQ      Aklivity
SmartBear      HDI
Best Route Planning and Route Optimization Software

Bronze

RedHat

Contributors

Thanks goes to these wonderful people (emoji key):

Fran Méndez
Fran Méndez

💬 🐛 📝 📖 🤔 🚇 🚧 👀 ✅ 📢
Lukasz Gornicki
Lukasz Gornicki

📖 🤔 👀 💬 📝 📢 🚧 🚇
Mike Ralphson
Mike Ralphson

💬 📖 🤔 🚇 👀 🚧
raisel melian
raisel melian

💬 🐛 📖 🤔 🚧 👀
Chris Wood
Chris Wood

🤔 📖
Jonathan Schabowsky
Jonathan Schabowsky

📖 🤔
Victor Romero
Victor Romero

🤔 👀
Antonio Garrote
Antonio Garrote

🤔 👀 📖
Jonathan Stoikovitch
Jonathan Stoikovitch

💡 🤔 👀
Jonas Lagoni
Jonas Lagoni

🐛 📖 🤔 💬 👀 💡
Waleed Ashraf
Waleed Ashraf

📢 🤔 📖 💡
Andrzej Jarzyna
Andrzej Jarzyna

📢
Emmelyn Wang
Emmelyn Wang

📝 🤔 📖 📢
Marc DiPasquale
Marc DiPasquale

📝 📢 👀 🐛 🤔 📹
Gerald Loeffler
Gerald Loeffler

📖 🐛 🤔
Dale Lane
Dale Lane

📝 🤔 📹 📢 ✅ 📖
Maciej Urbańczyk
Maciej Urbańczyk

👀 🤔 💬 🐛 📖 💡 🚧
Vladimir Gorej
Vladimir Gorej

📖 🐛 💡 🤔 👀
Lorna Jane Mitchell
Lorna Jane Mitchell

📢 🤔
Laurent Broudoux
Laurent Broudoux

📖 📝 📢 💡 🤔 👀
Jesse Menning
Jesse Menning

📝 📢 👀 🤔
Sergio Moya
Sergio Moya

👀 🤔 💬 📝 🐛 📖 💡 🚧
Alexander Balogh
Alexander Balogh

📖 🐛
Khuda Dad Nomani
Khuda Dad Nomani

💡 🐛
Aaron Korver
Aaron Korver

📖
Orlov Valentine
Orlov Valentine

📖
Moez Bouhlel
Moez Bouhlel

📖
Muhammad Rafly Andrianza
Muhammad Rafly Andrianza

📖
Daniel Kocot
Daniel Kocot

📖 💡 🤔
sekharbans-ebay
sekharbans-ebay

📖 💡 🤔
Michael Davis
Michael Davis

🐛 📖 💡 🤔
Heiko Henning
Heiko Henning

🐛 💻 🖋 📖 💡 🤔 🚧 👀
Quetzalli
Quetzalli

🖋 📖 💡 🤔 👀
Akshit Gupta
Akshit Gupta

🖋 📖
samz
samz

🐛 🖋 📖 💡 📆
Rishi
Rishi

🚧 🚇
nickshoe
nickshoe

🐛 📖
Ace
Ace

📋 🤔 🚧 📢
Animesh Kumar
Animesh Kumar

🖋 📖 🚧
Fabrizio Lazzaretti
Fabrizio Lazzaretti

📖
Pavel Bodiachevskii
Pavel Bodiachevskii

📖 🐛 🤔 💬

This project follows the all-contributors specification. Contributions of any kind welcome!