DEV Community

Cover image for Autogenerated Swagger Docs for your Express APIs
Muneeb Hussain
Muneeb Hussain

Posted on

Autogenerated Swagger Docs for your Express APIs

🚀 Swagger (OpenAPI 3) Autogenerated Docs feature is now available in the "TypeScript Backend Toolkit."

The best part? You only need to do one thing to get this feature. Just replace the Express Router with MagicRouter API, and that's it! Now you can define your Request and Response types using Zod schemas.

Highlights of MagicRouter API:

  • Autogenerates Swagger (OpenAPI 3) Docs based on route information.
  • Validates, serializes, transforms, and defines request and response types using Zod schemas.

More Improvements:

  • Better async handling thanks to express-async-handler, no more try-catch blocks in the controller.
  • Enhanced error handling with a Global Error Handler.
  • Swagger UI (accessible at "/api-docs") for testing your APIs directly in your browser.
  • Removed JSONs to reduce build size.

That's it! I appreciate your feedback.

👉 Checkout the repo

Note: You can check the Implementation of MagicRouter API in the User and Auth Module.

Top comments (0)