Skip to content

0004. Fastify with Zod and OpenAPI ​

  • Status: Accepted
  • Date: 2026-10-03

Context ​

The server needs fast routing, schema validation shared with clients, and a documented API for three client platforms and the compatibility layers. Express, NestJS, and Hono were the alternatives.

Decision ​

Fastify 5 with the Zod type provider. OpenAPI is generated by @fastify/swagger. The app is built by a buildApp() factory.

Consequences ​

  • Request/response validation and the OpenAPI document come from the same Zod schemas.
  • The factory allows mounting under Lambda later.
  • Less structure is imposed than with NestJS, so module boundaries are maintained by convention.

Released under the AGPL-3.0-or-later license.