npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@flightdev/openapi

v2.0.2

Published

OpenAPI schema generation for Flight Framework API routes - optional, non-imposing

Readme

@flightdev/openapi

Generate OpenAPI 3.1 specifications from your Flight API routes. Optional, non-imposing - use it only if you need API documentation.

Installation

npm install -D @flightdev/openapi

Quick Start

CLI Usage

# Generate OpenAPI spec from your API routes
npx flight-openapi generate --routes src/routes --output openapi.yaml

# Generate JSON format
npx flight-openapi generate --routes src/routes --output openapi.json --format json

Programmatic Usage

import { generateOpenAPI } from '@flightdev/openapi';

const spec = await generateOpenAPI({
  routesDir: './src/routes',
  title: 'My API',
  version: '1.0.0',
  description: 'My awesome API',
});

console.log(JSON.stringify(spec, null, 2));

Documenting Routes

Add JSDoc comments to your API routes for richer documentation:

// src/routes/api/users.get.ts

/**
 * List all users
 * @tags Users
 * @summary Get all users with optional filtering
 * @param {string} [query.role] - Filter by role
 * @param {number} [query.limit=10] - Maximum results
 * @returns {200} List of users
 * @returns {401} Unauthorized
 */
export async function GET(ctx) {
  const users = await db.users.findMany();
  return Response.json(users);
}
// src/routes/api/users.post.ts

/**
 * Create a new user
 * @tags Users
 * @summary Create user account
 * @body {CreateUserInput} - User data
 * @returns {201} User created successfully
 * @returns {400} Invalid input
 */
export async function POST(ctx) {
  const body = await ctx.req.json();
  const user = await db.users.create({ data: body });
  return Response.json(user, { status: 201 });
}

Swagger UI Middleware

Serve Swagger UI for interactive API exploration:

// src/routes/api/docs.ts
import { swaggerUI } from '@flightdev/openapi/swagger-ui';

export const GET = swaggerUI({
  specUrl: '/api/openapi.json',
  title: 'My API Docs',
});
// src/routes/api/openapi.json.ts
import { generateOpenAPI } from '@flightdev/openapi';

export async function GET() {
  const spec = await generateOpenAPI({
    routesDir: './src/routes',
    title: 'My API',
    version: '1.0.0',
  });
  
  return Response.json(spec);
}

Configuration

interface GenerateOptions {
  /** Path to routes directory */
  routesDir: string;
  
  /** API title */
  title?: string;
  
  /** API version */
  version?: string;
  
  /** API description */
  description?: string;
  
  /** Server URLs */
  servers?: Array<{ url: string; description?: string }>;
  
  /** Include only API routes (default: true) */
  apiOnly?: boolean;
  
  /** Route prefix filter */
  prefix?: string;
}

Output

Generated OpenAPI 3.1 specification:

openapi: 3.1.0
info:
  title: My API
  version: 1.0.0
paths:
  /api/users:
    get:
      summary: Get all users
      tags: [Users]
      responses:
        '200':
          description: List of users
    post:
      summary: Create user account
      tags: [Users]
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserInput'
      responses:
        '201':
          description: User created successfully

License

MIT