Next.js Discord

Discord Forum

App Router/Route Handler API Endpoint Typing and Documenation Solutions

Unanswered
Bernese Mountain Dog posted this in #help-forum
Open in Discord
Bernese Mountain DogOP
I'm trying to set up a solution for maintaining an OpenAPI document for a new Next.js app that uses App Router without seperatly maintaining type definitions and documentation.

It looks like it would be possible for a tool to statically analyse route.ts files with well typed handler functions and generate a good OpenAPI spec document. Is there a tool that's well known to do this and I'm just failing to find it?

Suggestions for another approach?

Thanks for your help!

I'm brand new to Next.js but not React/TS/Zod/OpenAPI.

1 Reply

Bernese Mountain DogOP
ts-rest appears to have "support" for Next.js app router route handlers, but there are no examples or documentation.
https://github.com/omermecitoglu/next-openapi-route-handler appears to be exactly what I'm after...