Generator

Clients, servers and docs from the contract

apigenie-generator turns API descriptions into clients and servers in six languages, and into documentation sites, with the libraries each language already uses.

Generate a client and a serverSee every generator

One contract in, your code outside the package

Four kinds of output from the same file. The handlers of a generated server live in your files, and regeneration leaves them.

From one API description apigenie-generator writes clients, servers, a documentation site and test data; the server's handlers are your files, kept when you regenerate What comes out, and what stays yoursopenapi.yamlor AsyncAPI, GraphQL, Protobufapigenie-generatorClientsTypeScript, Java, Go, Python, C# and ElixirServersrouter, types, handler interfacesYour handlersyour files; regeneration leaves themDocumentation sitesearch, Try it out, translations, changelogsTest datavalues that conform, as JSON or YAML
Clients and servers in six languages from OpenAPI and AsyncAPI; GraphQL and gRPC code in Elixir.

What a generated client looks like

The Fetch client has a typed function per operation. Types go in types.ts; request helpers go in runtime.ts. Both are generated into your package.

$ apigenie-generator client fetch orders.yaml -o client
$ ls client/src
index.ts  metadata.ts  operations.ts  runtime.ts  types.ts
$ # client/src/operations.ts, one function per operation:
/** Get an order */
export async function getOrder(params: GetOrderParams, options?: RequestOptions): Promise<Order> {
  const result = await request(
    {
      method: "GET",
      path: "/orders/{orderId}",
      pathParams: { orderId: params.orderId },
      security: [["ApiKey"]],
      responseFormat: "json",
    },
    options,
  );
  return result as Order;
}

Find a target for your contract

Language support depends on the input standard and the output you need. For Swagger 2.0 code generation, convert to OpenAPI first (experimental). The generator reference lists each target's options and limitations.

InputGenerated outputLanguages
OpenAPI 3.0 to 3.2API clients and serversTypeScript, Java, Go, Python, C# and Elixir
AsyncAPI 3.xMessaging clients and applicationsTypeScript, Java, Go, Python, C# and Elixir
GraphQLAbsinthe serversElixir
ProtobufgRPC clients and serversElixir
JSON SchemaZod validation schemas (experimental)TypeScript

Frameworks your code can use

  • TypeScriptFetch clients, Express, oRPC and MCP (experimental) servers, KafkaJS and WebSocket clients and applications, Zod schemas.
  • JavaClients for Spring RestClient, RestTemplate, OpenFeign or HTTP interfaces; Spring Boot servers; Kafka clients and applications.
  • Gonet/http clients and servers, Kafka client packages and applications.
  • Pythonhttpx and Pydantic clients, FastAPI servers, aiokafka clients and FastStream applications for Kafka, RabbitMQ and MQTT.
  • C#HttpClient clients for .NET 8, ASP.NET Core Minimal API servers, Kafka clients and applications.
  • ElixirReq clients, Phoenix servers and channels, Absinthe GraphQL servers, and gRPC clients and servers on elixir-grpc.

Beyond code

  • Documentation sitesA static site from OpenAPI, Swagger 2.0, AsyncAPI, GraphQL and Protobuf files, with search, Try it out, translations and Git changelogs.
  • Test dataValues that conform to any schema of an OpenAPI document, one or many, as JSON or YAML.
  • Validation schemasZod schemas from JSON Schemas (experimental).
  • OverlaysOpenAPI and AsyncAPI code targets and data accept --overlay, so generator settings stay outside the API description. Documentation, GraphQL and Protobuf targets do not.

Install

The CLI packages include apigenie-generator. Install with Homebrew or npm, or download a native package or archive. In Docker, use docker run --entrypoint apigenie-generator mykulyak/apigenie.

Use cases

Generate a client and a serverSee every generator