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

@darlan0307/api-boilerplate

v2.1.1

Published

CLI para gerar boilerplate de APIs em Node.js

Readme

Logo do projeto

Api Boilerplate (CLI)

Você também pode ler em Português 🇧🇷

📋 Introduction

A command-line tool (CLI) that speeds up the development of APIs in Node.js by generating pre-configured templates with best practices. It includes ready-made configurations for docker, documentation, linting, typeScript, testing and a well-structured architecture.

📦 Available on NPM

🛠️ Supported Frameworks

Choose from the main frameworks in the Node.js ecosystem:

🚀 Installation & Use

Direct Use (Recommended)
npx @darlan0307/api-boilerplate <project-name>
Global Installation
npm install -g @darlan0307/api-boilerplate
api-boilerplate <project-name>
Demonstration

Watch the video

⚙️ Available Options

| Flag | Description | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -f, --force | Overwrite the directory if it already exists | | -r, --root | Creates the template in the current root (instead of creating a new folder) | | --stack <type> | Define the framework: express, fastify or hono | | --lint | Configures automatically ESLint and Prettier | | -t, --tests | Prepares environment for unit tests (Vitest, Jest or Node Test Runner) | | --docker | Generate Docker configuration (Dockerfile.dev and docker-compose.yml) | | --database <type> | Configure database: postgres, mysql or mongodb (requires --docker) | | --api-docs | Add API documentation with Swagger/OpenAPI |

💡 Usage Examples

Interactive Mode (with prompts)

npx @darlan0307/api-boilerplate my-api

Quick Setup with Flags

# Complete API with Express, Docker, PostgreSQL and documentation
npx @darlan0307/api-boilerplate my-api --stack express --docker --database postgres --api-docs --lint --tests

# Simple API with Fastify
npx @darlan0307/api-boilerplate my-api --stack fastify --lint

🏗️ Architecture

my-api/
├── src/
│   ├── @types/
│   ├── app/
│   │   └── v1/
│   ├── infra/
│   │   ├── errors/          # Error handling
│   │   ├── middlewares/     # Custom middlewares
│   │   └── logger.ts        # Logging system (Pino)
│   ├── shared/
│   │   └── swagger/
│   ├── http-server.ts
│   └── main.ts
├── docs/
│   └── openapi/
├── .env
├── .env.example
├── .gitignore
├── Dockerfile.dev           # If --docker
├── docker-compose.yml       # If --docker (with database if specified)
├── package.json
├── README.md
├── tsconfig.build.json
└── tsconfig.json

📂 Directory Descriptions

  • main.ts: Application entry point where configurations are loaded and the API starts
  • http-server.ts: HTTP server configuration
  • app/v1: Versioned API routes, facilitating maintenance and evolution
  • infra: Essential system resources (logs, errors, middlewares)
  • shared: Generic reusable classes and functions throughout the application
  • shared/swagger: Swagger/OpenAPI documentation configuration (generated with --api-docs)
  • docs/openapi: Modular YAML files for documentation (Express only)
  • @types: Additional global type definitions for libraries/frameworks

✨ Main Features

  • 3 Supported Frameworks - Express, Fastify and HonoJS
  • Route Versioning - /api/v1 with scalable structure
  • API Documentation - Swagger/OpenAPI configured for each framework
  • Docker & Docker Compose - Ready-to-use containerization for development
  • Databases - Pre-configured PostgreSQL, MySQL and MongoDB
  • TypeScript - Type-safety and autocompletion
  • Tests - Support for Vitest, Jest or Node Test Runner
  • Linting & Formatting - ESLint + Prettier configured
  • Logger - Pino for structured logs
  • Security - Helmet, CORS and Compression configured

🔥 Next Features

  • Cache - Redis implementation
  • Authentication - Templates with JWT and OAuth2
  • ORM/ODM - Prisma, TypeORM or Mongoose
  • Notifications - Templates for email and webhooks

🤝 Contributions

Contributions are very welcome! Follow the steps below:

  1. Fork the repository
  2. Clone your fork locally
  3. Install dependencies: npm install
  4. Create a branch for your feature: git checkout -b feature/new-feature
  5. Develop using: npm run dev (runs TypeScript with TSX)
  6. Check your code:
    • npm run typecheck - Check TypeScript types
    • npm run lint - Run the linter
    • npm run format - Format code
  7. Build: npm run build to compile
  8. Commit your changes: git commit -m 'feat: adds new feature'
  9. Push to your branch: git push origin feature/new-feature
  10. Open a Pull Request explaining your changes

📦 Technologies Used in CLI

  • TypeScript - Main language
  • Commander.js - CLI framework
  • Inquirer.js - Interactive prompts
  • Chalk - Terminal colorization
  • Ora - Loading spinners
  • Vitest - Testing framework

🐛 Reporting Bugs

Found a problem? Open an Issue with:

  • Detailed error description
  • Steps to reproduce
  • Environment (OS, Node.js version, etc.)

📄 License

This project is under the (MIT) license - find the details here.

👨‍💻 Author

Darlan Martins


Liked the project? Give a star to the repository to support the development!