Generate code
Generate from the contract, keep your handlers
A client and a server written by hand repeat what the contract already says, and drift from it. Generate both from the contract, in the libraries your language already uses, and keep your handlers when you regenerate.
- Regenerate without replacing your handlersYour handlers live in a file of your own, outside the generated package. Regenerate when the contract changes: the package is rewritten, your file isn't, and the compiler points at the handlers the change affects.
- No API Genie runtime dependencyThe helpers a client needs are generated into it, and the servers use Spring, ASP.NET Core, FastAPI, Express,
net/httpand Phoenix the way their communities do. No API Genie package in your lock file. - Checked before it reaches youA conformance suite compares the generated code with snapshots, type-checks and lints it with the target's own tools, and runs the clients and servers against the contract. The reference lists its scope and limits.
A contract change, regenerated
The generator writes an npm package; your handlers are in app.ts, outside it. Add a required field to the contract and regenerate: only the contract and the package change, and the compiler points at the handler that has to follow.
$ apigenie-generator server express openapi.yaml \
-o server --package-name shipping-server
$ ls
app.ts db.ts node_modules openapi.yaml package-lock.json package.json server tsconfig.json
$ # Shipment gains a required field, carrier; regenerate
$ apigenie-generator server express openapi.yaml \
-o server --package-name shipping-server
$ git diff --stat
openapi.yaml | 4 +++-
server/src/types.ts | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
$ npx tsc --noEmit
app.ts(6,3): error TS2741: Property 'carrier' is missing in type '{ id: string; status: string; }' but required in type 'Shipment'.What it covers
- HTTP clientsTypeScript, Java, Go, Python, C# and Elixir.
- HTTP serversSpring, ASP.NET Core, Express, FastAPI, Go, Phoenix, oRPC, and MCP servers (experimental).
- Event-driven codeKafka, WebSocket, RabbitMQ and MQTT clients and applications from AsyncAPI.
- GraphQL and gRPCElixir only: Absinthe servers, and elixir-grpc clients and servers.
- Schemas and dataZod schemas from JSON Schemas (experimental), and example data for a schema.
- OverlaysGenerator settings in an overlay, out of the API description.
The tool that does it
Step by step
Generate a client and a server: Generate a typed client and a server from one OpenAPI document, keep your code out of the generated files, and regenerate in CI.
Your handlers stay in your files
The generator writes its package and nothing outside it. Generate into the repository, and let CI check that the generated code still matches the contract.