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-boilerplate-cli

v2.0.0

Published

A CLI to scaffold production-ready [Fastify](https://fastify.dev) projects with a pre-configured structure, tooling, and sensible defaults.

Downloads

206

Readme

Fastify Boilerplate CLI

A CLI to scaffold production-ready Fastify projects with a pre-configured structure, tooling, and sensible defaults.

Requirements

  • Node.js 18 or higher
  • npm 8 or higher

Installation

npm install -g fastify-boilerplate-cli

Commands

create — scaffold a new project

fastify-boilerplate-cli create <project-name>

Creates a new directory named <project-name> and generates the full project structure inside it. During setup, the CLI will ask whether to include a Dockerfile and .dockerignore.

What gets generated:

  • Complete Fastify project structure (routes, controllers, services, models, plugins, utils)
  • package.json pre-configured with project name and all scripts
  • Jest configuration and an example test using app.inject()
  • ESLint v9 flat config + Prettier
  • .env file with environment variable stubs
  • .gitignore covering node_modules, .env, coverage, dist, logs, and OS files
  • Git repository initialized automatically
  • Optional Dockerfile + .dockerignore (Node.js 20)

Generated project structure:

<project-name>/
├── src/
│   ├── app.js                  # Fastify instance, plugin and route registration
│   ├── index.js                # Server entry point
│   ├── config/
│   │   └── index.js            # Environment-based configuration
│   ├── plugins/
│   │   ├── auth.js             # Authentication plugin stub
│   │   └── db.js               # Database plugin stub
│   ├── routes/
│   │   └── about/
│   │       ├── index.js        # Route definitions
│   │       └── schema.js       # Request / response schemas
│   ├── controllers/
│   │   └── aboutController.js
│   ├── services/
│   │   └── aboutService.js
│   ├── models/
│   │   └── aboutModel.js
│   └── utils/
│       ├── errorHandler.js
│       └── logger.js
├── tests/
│   └── routes/
│       └── aboutRoute.test.js
├── .env
├── .gitignore
├── eslint.config.js
├── .prettierrc.json
├── jest.config.json
├── package.json
├── README.md
└── Dockerfile          # optional

Then:

cd <project-name>
npm install
npm run dev

route — generate a new route

Run this inside an existing project created by this CLI:

fastify-boilerplate-cli route <route-name>

Generates a complete MVC slice for the given route name and automatically registers it in src/app.js.

Files created:

| File | Description | |------|-------------| | src/routes/<route-name>/index.js | Route handler registered with Fastify | | src/controllers/<route-name>.js | Controller calling the service layer | | src/services/<route-name>.js | Business logic stub | | src/models/<route-name>.js | Model / schema stub | | tests/routes/<route-name>Route.test.js | Jest test using app.inject() |

Example:

fastify-boilerplate-cli route users

Creates src/routes/users/, src/controllers/users.js, src/services/users.js, src/models/users.js, and tests/routes/usersRoute.test.js. The route is automatically added to src/app.js with the prefix /users.


Generated project scripts

| Script | Command | Description | |--------|---------|-------------| | Start | npm start | Run in production mode | | Dev | npm run dev | Run with nodemon (auto-restart) | | Test | npm test | Run Jest test suite | | Test watch | npm run test:watch | Run Jest in watch mode | | Lint | npm run lint | Lint src/ with ESLint | | Format | npm run format | Format src/ with Prettier |


Project structure explained

| Directory | Purpose | |-----------|---------| | src/app.js | Creates the Fastify instance, registers plugins and routes | | src/index.js | Starts the HTTP server, reads port from config | | src/config/ | Centralizes environment variable access | | src/plugins/ | Fastify plugins (auth, database) — extend these as needed | | src/routes/ | One subdirectory per resource; each exports an async function accepted by fastify.register | | src/controllers/ | Handle request/reply, delegate logic to services | | src/services/ | Business logic, decoupled from HTTP | | src/models/ | Data shape definitions | | src/utils/ | Shared helpers: logger (Pino) and error handler | | tests/ | Jest tests using Fastify's built-in app.inject() — no real port needed |


License

MIT