Skip to content

hugoni-va/routesmith

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

routesmith

A lightweight CLI that generates typed Express/Fastify route scaffolding from OpenAPI specs.


Installation

npm install -g routesmith

Or use it without installing:

nx routesmith

Usage

Point routesmith at your OpenAPI spec file and specify a target framework:

routesmith generate --input ./openapi.yaml --framework express --output ./src/routes

This 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;

Options

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

Requirements

  • Node.js 18+
  • An OpenAPI 3.x spec file

License

MIT

About

A lightweight CLI that generates typed Express/Fastify route scaffolding from OpenAPI specs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors