A lightweight CLI that generates typed Express/Fastify route scaffolding from OpenAPI specs.
npm install -g routesmithOr use it without installing:
nx routesmithPoint routesmith at your OpenAPI spec file and specify a target framework:
routesmith generate --input ./openapi.yaml --framework express --output ./src/routesThis will scaffold typed route handlers based on your spec:
// src/routes/users.ts (generated)
import { Router, Request, Response } from "express";
const router = Router();
// GET /users
router.get("/users", async (req: Request, res: Response) => {
// TODO: implement handler
res.status(200).json([]);
});
export default router;| Flag | Description | Default |
|---|---|---|
--input |
Path to OpenAPI spec (JSON or YAML) | required |
--framework |
Target framework (express, fastify) |
express |
--output |
Output directory for generated files | ./routes |
--overwrite |
Overwrite existing files | false |
--dry-run |
Preview files to be generated without writing them | false |
- Node.js 18+
- An OpenAPI 3.x spec file