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

fastify-route-printer

v1.5.0

Published

Light-Weight, Fully Customizable and Extensible Fastify Route Printer

Readme

fastify-route-printer

Light-Weight, Fully Customizable and Extensible Fastify Route Printer

Features

  • No configuration needed
  • Fully Customizable
  • Multiple out-of-the-box "write" options: stdout, file
  • Multiple out-of-the-box "print" options: table, json
  • Plug-and-play, if the provided "print" and "write" options are not what you are looking for, write your own custom Printer and/or Writer, you only need to adhere to the interfaces (check below for details), the rest is fully up to you.
  • Light-Weight
  • No bloat, only one run-time dependency

Examples

With Default Options

import routePrinter from "fastify-route-printer";

const app = Fastify();

await app.register(routePrinter);

With Custom Options

import routePrinter, { FastifyRoutePrinterPluginOptions } from "fastify-route-printer";

const app = Fastify();

const opts: FastifyRoutePrinterPluginOptions = {
  // check Documentation below for a full list of available properties
};
await app.register(routePrinter, opts);

Route definitions

app
  .get("/with-description", { config: { routePrinter: { description: "..." } } }, async function (request, reply) {})
  .get("/without-description", async function (request, reply) {});

// or
app.route({
  url: "/with-description",
  method: "get",
  config: { routePrinter: { description: "..." } },
  handler: async function (request, reply) {},
});
app.route({
  url: "/without-description",
  method: "get",
  handler: async function (request, reply) {},
});

Documentation

FastifyRoutePrinterPluginOptions

| Property | Type | Required | Default | Description | | ------------ | ------------------------------ | -------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------- | | disabled | boolean | false | false | opt-in disable the plugin on certain conditions, for example NODE_ENV===prod | | includeHEAD | boolean | false | false | whether or not to include head and HEAD methods in the output | | sortRoutes | (a: Route, b: Route) => number | false | (a, b) => (a.url >= b.url ? 1 : -1) | by default, sorts routes alphabetically | | filterRoutes | (r: Route) => boolean | false | | can be used to filter out some routes from the final output | | host | string | false | | add host as a prefix in the output | | printer | Printer | false | TablePrinter | responsible for defining how to convert Route[] into a string | | writer | Writer | false | ConsoleWriter | responsible for writing the Printer's string (buffer) to some stream | | colors | ColorScheme | boolean | false | false | whether to print colorized HTTP methods, use true to use default color scheme, or pass custom color scheme |

Types & Definitions

The default export is the plugin itself

For convenience, the library also exposes all types and interfaces

import fastifyRoutePrinterPlugin, {
  Color,
  ColorScheme,
  ColorValue,
  ConsoleWriter,
  FastifyRoutePrinterPluginOptions,
  FileWriter,
  JSONPrinter,
  Printer,
  Route,
  TablePrinter,
} from "fastify-route-printer";

Interfaces you need to implement if you want custom print and/or write options

interface Printer {
  print(routes: Route[]): Promise<string>;
}

interface Writer {
  write(buffer: Uint8Array): Promise<void>;
}