As of now, no documentation of the backend exists unless you look at the exact API definition. Integrate the Swagger UI into the hono backend and automatically generate documentation based on zod/drizzle schema definitions. This may require some research, but the implementation should be clean/self-sustaining given that it is done right. Whenever an endpoint is updated (say POST /api/items now requires an additional field), the Swagger docs should update automatically (no need to manually edit the Swagger Spec YAML). Ideally it'd require no user intervention at all, but something like npm run update-docs can also suffice. Make sure some form of testing is included for this feature. Ensure Swagger UI is accessible on the production instance via /api/docs/*, it should run whenever the backend is running via npm run dev.
Description
As of now, no documentation of the backend exists unless you look at the exact API definition. Integrate the Swagger UI into the hono backend and automatically generate documentation based on zod/drizzle schema definitions. This may require some research, but the implementation should be clean/self-sustaining given that it is done right. Whenever an endpoint is updated (say POST /api/items now requires an additional field), the Swagger docs should update automatically (no need to manually edit the Swagger Spec YAML). Ideally it'd require no user intervention at all, but something like
npm run update-docs
can also suffice. Make sure some form of testing is included for this feature. Ensure Swagger UI is accessible on the production instance via/api/docs/*
, it should run whenever the backend is running vianpm run dev
.Acceptance Criteria
/api/docs/*
npm run update-docs
npm run dev
Resources
https://github.com/honojs/middleware/tree/main/packages/swagger-ui https://hono.dev/snippets/swagger-ui https://hono.dev/snippets/zod-openapi