Introduction
Server routes augmented with Zod and OpenAPI
Clover ☘️
Server routes augmented with Zod and OpenAPI

Cover from Midjourney
If you find inaccuracies or anything missing, please open an issue on GitHub!
Installation
Introduction
Clover is a library that allows you to define your server routes using Zod and OpenAPI. You can use Clover for making your server routes type-safe and self-documenting, and as a lighterweight TRPC/Zodios replacement.
You can use Clover with any framework/runtime that supports WinterCG style functions e.g.
Server
Here's what a handler augmented with Clover looks like:
You can learn more about how to add authentication, about Clover's heuristics for query parameters, path parameters, request bodies etc. by reading the server documentation.
OpenAPI
You can generate OpenAPI documentation from your server routes.
You can now serve this document as JSON, and use it with Swagger UI or similar tools.
Client
Clover also provides an optional client fetcher. It's nothing fancy, it just wraps the Fetch API and provides type safety.
You can read more about how the fetcher works in the client documentation.
Credits
Similar projects
- TRPC: https://github.com/trpc/trpc
- Zodios: https://github.com/ecyrbe/zodios
- ts-rest: https://github.com/ts-rest/ts-rest
- feTS: https://github.com/ardatan/fets
- zaCT: https://github.com/pingdotgg/zact
Enabling libraries
- Zod: https://github.com/colinhacks/zod/
- @anatine/zod-openapi: https://github.com/anatine/zod-plugins
- OpenApi3-TS: https://github.com/metadevpro/openapi3-ts