{"id":15493268,"url":"https://github.com/bdragon300/go-asyncapi","last_synced_at":"2025-07-11T03:33:32.848Z","repository":{"id":238497524,"uuid":"702032079","full_name":"bdragon300/go-asyncapi","owner":"bdragon300","description":"AsyncAPI codegen tool for Go. Supports most of AsyncAPI features, many protocols (and pluggable client for each one), reference resolver and more!","archived":false,"fork":false,"pushed_at":"2025-07-07T11:26:31.000Z","size":3359,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-07T12:38:17.553Z","etag":null,"topics":["amqp","asyncapi","asyncapi-tools","code-generator","codegen","go","go-tool","golang","http","kafka","mqtt","raw-sockets","redis","schema-first","tcp","udp","websockets"],"latest_commit_sha":null,"homepage":"https://bdragon300.github.io/go-asyncapi/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bdragon300.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-08T09:52:03.000Z","updated_at":"2025-05-08T09:08:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"c30209a8-24e6-4856-93cd-9233c577c32c","html_url":"https://github.com/bdragon300/go-asyncapi","commit_stats":null,"previous_names":["bdragon300/go-asyncapi","bdragon300/asyncapi-codegen-go"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bdragon300/go-asyncapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdragon300%2Fgo-asyncapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdragon300%2Fgo-asyncapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdragon300%2Fgo-asyncapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdragon300%2Fgo-asyncapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bdragon300","download_url":"https://codeload.github.com/bdragon300/go-asyncapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bdragon300%2Fgo-asyncapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264721554,"owners_count":23653951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amqp","asyncapi","asyncapi-tools","code-generator","codegen","go","go-tool","golang","http","kafka","mqtt","raw-sockets","redis","schema-first","tcp","udp","websockets"],"created_at":"2024-10-02T08:05:13.604Z","updated_at":"2025-07-11T03:33:32.836Z","avatar_url":"https://github.com/bdragon300.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-asyncapi\n\n![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/bdragon300/go-asyncapi)\n![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/bdragon300/go-asyncapi/commit.yml?branch=master)\n\n`go-asyncapi` is a Go implementation of the [AsyncAPI](https://www.asyncapi.com/) specification.\n\n\u003e **[AsyncAPI](https://www.asyncapi.com/)** is a specification for defining APIs for event-driven architectures. The\n\u003e AsyncAPI document describes the messages, channels, servers, and other entities that the systems in event-driven\n\u003e architecture use to communicate with each other.\n\n[Documentation](https://bdragon300.github.io/go-asyncapi/)\n\n## Core features\n\n|                                                                                                                           | Feature                                                 | Command                |\n|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------|------------------------|\n| \u003cimg src=\"https://bdragon300.github.io/go-asyncapi/images/go-logo.svg\" style=\"height: 3em; vertical-align: middle\"\u003e       | Generating the Go boilerplate code                      | `go-asyncapi code`     |\n| \u003cimg src=\"https://bdragon300.github.io/go-asyncapi/images/terminal-icon.svg\" style=\"height: 3em; vertical-align: middle\"\u003e | Building the CLI client without writing the code        | `go-asyncapi client`   |\n| \u003cimg src=\"https://bdragon300.github.io/go-asyncapi/images/docker.svg\" style=\"height: 3em; vertical-align: middle\"\u003e        | Generating the Infrastructure-As-Code (IaC) definitions | `go-asyncapi infra`    |\n\nAlso, `go-asyncapi` contains the built-in **protocol implementations** based on popular libraries, allows the **result customization** using Go templates and more.\n\nSee the [Features](https://bdragon300.github.io/go-asyncapi/features) page for more details.\n\n## Supported protocols\n\n|                                                                                                                                         | Protocol       | Library                                                                            |\n|-----------------------------------------------------------------------------------------------------------------------------------------|----------------|------------------------------------------------------------------------------------|\n| \u003cimg alt=\"AMQP\" src=\"https://bdragon300.github.io/go-asyncapi/images/amqp.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e           | AMQP           | [github.com/rabbitmq/amqp091-go](https://github.com/rabbitmq/amqp091-go)           |\n| \u003cimg alt=\"Apache Kafka\" src=\"https://bdragon300.github.io/go-asyncapi/images/kafka.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e  | Apache Kafka   | [github.com/twmb/franz-go](https://github.com/twmb/franz-go)                       |\n| \u003cimg alt=\"HTTP\" src=\"https://bdragon300.github.io/go-asyncapi/images/http-small.png\" style=\"height: 1.5em; vertical-align: middle\"\u003e     | HTTP           | [net/http](https://pkg.go.dev/net/http)                                            |\n| \u003cimg alt=\"IP RAW Sockets\" src=\"https://bdragon300.github.io/go-asyncapi/images/ip.png\" style=\"height: 1.5em; vertical-align: middle\"\u003e   | IP RAW Sockets | [net](https://pkg.go.dev/net)                                                      |\n| \u003cimg alt=\"MQTT\" src=\"https://bdragon300.github.io/go-asyncapi/images/mqtt.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e           | MQTT           | [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) |\n| \u003cimg alt=\"Redis\" src=\"https://bdragon300.github.io/go-asyncapi/images/redis.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e         | Redis          | [github.com/redis/go-redis](https://github.com/redis/go-redis)                     |\n| \u003cimg alt=\"TCP\" src=\"https://bdragon300.github.io/go-asyncapi/images/tcpudp.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e          | TCP            | [net](https://pkg.go.dev/net)                                                      |\n| \u003cimg alt=\"UDP\" src=\"https://bdragon300.github.io/go-asyncapi/images/tcpudp.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e          | UDP            | [net](https://pkg.go.dev/net)                                                      |\n| \u003cimg alt=\"Websocket\" src=\"https://bdragon300.github.io/go-asyncapi/images/websocket.svg\" style=\"height: 1.5em; vertical-align: middle\"\u003e | Websocket      | [github.com/gobwas/ws](https://github.com/gobwas/ws)                               |\n\n## Usage\n\nThe following couple of high-level examples show how to use the generated code for sending and receiving messages.\n\n*Publishing*:\n\n```go\nctx := context.Background()\n// Connect to broker for sending messages\nmyServer, err := servers.ConnectMyServerProducer(ctx, servers.MyServerURL())\nif err != nil {\n\tlog.Fatalf(\"connect to the myServer: %v\", err)\n}\ndefer myServer.Close()\n\n// Open an operation for sending messages\nmyOperation, err := myServer.OpenMyPubOperationKafka(ctx)\nif err != nil {\n\tlog.Fatalf(\"open myPubOperation: %v\", err)\n}\ndefer myOperation.Close()\n\n// Craft a message\nmsg := messages.MyMessage{\n\tPayload: schemas.MyMessagePayload{\n\t\tField1: \"value1\", \n\t\tField2: 42,\n\t},\n\tHeaders: schemas.MyMessageHeaders{\n\t\tHeader1: \"header1\",\n\t},\n}\n\n// Send a message\nif err := myOperation.PublishMyMessage(ctx, msg); err != nil {\n\tlog.Fatalf(\"send message: %v\", err)\n}\n```\n\n*Subscribing*:\n\n```go\nctx := context.Background()\n// Connect to broker for receiving messages\nmyServer, err := servers.ConnectMyServerConsumer(ctx, servers.MyServerURL())\nif err != nil {\n\tlog.Fatalf(\"connect to the myServer: %v\", err)\n}\ndefer myServer.Close()\n\n// Open an operation for receiving messages\nmyOperation, err := myServer.OpenMySubOperationKafka(ctx)\nif err != nil {\n\tlog.Fatalf(\"open mySubOperation: %v\", err)\n}\ndefer myOperation.Close()\n\n// Subscribe to messages\nerr := myOperation.SubscribeMyMessage(ctx, func(msg messages.MyMessage) {\n\tlog.Printf(\"received message: %+v\", msg)\n})\nif err != nil {\n\tlog.Fatalf(\"subscribe: %v\", err)\n}\n```\n\nThe low-level functions are also available, which gives more control over the process.\n\nAlso, here are some demo applications:\n\n* [Site authorization](https://github.com/bdragon300/go-asyncapi/blob/master/examples/site-authorization)\n* [HTTP echo server](https://github.com/bdragon300/go-asyncapi/blob/master/examples/http-server)\n\n## Installation\n\n```bash\ngo install github.com/bdragon300/go-asyncapi/cmd/go-asyncapi@latest\n```\n\n## Project status\n\nThe project is in active development. The main features are implemented, but there are still some missing features and\nbugs.\n\nThis version supports the latest AsyncAPI v3. It doesn't support the previous v2, because v3 introduced some breaking \nchanges, so making the tool that supports both v2 and v3 requires a lot of effort and time with no significant benefits.\n\n## Project versioning\n\n`go-asyncapi` uses [Semantic Versioning](https://semver.org/) for versioning. For example, `1.4.0`.\n\nReleasing a *patch version* contains only bug fixes and minor improvements. You won't need to regenerate the code after\nupgrading the tool. E.g. **1.4.0 \u0026rarr; 1.4.1**.\n\nReleasing a *minor version* means that the generated code may be affected, but without breaking changes. You may need to\nregenerate the code. E.g. **1.4.0 \u0026rarr; 1.5.0**.\n\n*Major version* release typically introduces the breaking changes. You may need to regenerate the code, to fix your\nprojects that uses it or to change the tool command line. E.g. **1.4.0 \u0026rarr; 2.0.0**.\n\n*Note, that the project major version 0 (0.x.x) is considered unstable*\n\n## Description\n\n### Goals\n\nThe goal of the project is, on the one hand, to fully implement the AsyncAPI specification and, on the other hand, to help\nthe developers, DevOps, QA, and other engineers with making the software in event-driven architectures based on the\nAsyncAPI specification.\n\nAnother goal is to provide a way to readily use and test the technologies described in the AsyncAPI document —\neverything works out of the box, but each component is optional and can be replaced or omitted.\n\nIn other words, *batteries included, but removable*.\n\n### Features overview\n\n`go-asyncapi` supports most of the AsyncAPI features, such as messages, channels, servers, bindings, correlation ids, etc.\n\nThe generated **Go boilerplate code** has minimal dependencies on external libraries and contains the basic logic sufficient to\nsend and receive messages. You also can plug in the protocol implementations built-in in `go-asyncapi`, they are based on\npopular libraries for that protocol. Also, it is possible to import the third-party code in the code being generated.\n\nIt is possible to build the **no-code client application** solely based on the AsyncAPI document, which is useful for\ntesting purposes or for quick prototyping.\n\nThe `go-asyncapi` is able to generate the **infrastructure setup files**, such as Docker Compose files, which are useful\nfor setting up the development environment quickly or as the starting point for the infrastructure-as-code deploy configurations.\n\n## FAQ\n\n### Why do I need another codegen tool? We already have the [official generator](https://github.com/asyncapi/generator)\n\nWell, `go-asyncapi` provides more features, and it's written in Go.\n\nThe official generator is quite specific for many use cases. At the moment, it produces the Go code bound with the\n[Watermill](https://watermill.io/) framework, but not everyone uses the Watermill in\ntheir projects. Moreover, a project may have a fixed set of dependencies, for example,\ndue to the security policies in the company.\n\nAlso, the official generator supports only the AMQP protocol.\n\nInstead, `go-asyncapi`:\n\n* produces framework-agnostic code.\n* supports more\n  [protocols](https://bdragon300.github.io/go-asyncapi/features#protocols) and more specific AsyncAPI entities, such as\n  bindings, correlation ids, server variables, etc.\n* has built-in clients for all supported protocols based on popular libraries, that may be used in the generated code.\n* is written in Go, so no need to have node.js or Docker or similar tools to run the generator.\n* can produce IaC files and build the no-code client application.\n\n*Another reason is that I don't know JavaScript well. And I'm not sure that if we want to support all AsyncAPI features,\nthe existing templates would not be rewritten from the ground.*\n\n### How to contribute?\n\nJust open an issue or a pull request in the [GitHub repository](https://github.com/bdragon300/go-asyncapi)\n\n## Alternatives\n\n* https://github.com/asyncapi/generator (official generator)\n* https://github.com/lerenn/asyncapi-codegen\n* https://github.com/c0olix/asyncApiCodeGen\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdragon300%2Fgo-asyncapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbdragon300%2Fgo-asyncapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbdragon300%2Fgo-asyncapi/lists"}