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

create-backend-buddy

v1.1.2

Published

Scaffold modern Node.js backends with your preferred stack

Downloads

61

Readme

🚀 create-backend-buddy

Version Downloads License Node

🏗️ Scaffold a modern Node.js + Express backend in seconds

Your complete backend starter with ORM, database, security, logging, Swagger docs, and more

Quick StartFeaturesInstallationDocumentation


✨ Features

🛡️ Security First

  • Helmet.js - HTTP security headers
  • CORS - Configurable cross-origin requests
  • Rate Limiting - Prevent API abuse
  • Input Validation - Built-in sanitization

🗄️ Database Flexibility

  • PostgreSQL - Production-ready relational DB
  • MySQL - Popular relational database
  • MongoDB - NoSQL document database
  • SQLite - Lightweight development DB

🧰 Developer Experience

  • TypeScript - Full type safety support
  • Hot Reload - Instant development feedback
  • Swagger UI - Interactive API documentation
  • Structured Logging - Pino-powered logging

🚢 Production Ready

  • Docker - Containerized deployment
  • Environment Config - Secure configuration
  • Error Handling - Centralized error management
  • Git Integration - Automatic repository setup

🚀 Quick Start

Option 1: Global Installation

npm install -g create-backend-buddy
create-backend-buddy

Option 2: NPX (Recommended)

npx create-backend-buddy

🎯 Interactive Setup

┌─────────────────────────────────────────┐
│                                         │
│   🚀 Welcome to Backend Buddy!         │
│                                         │
└─────────────────────────────────────────┘

✔ Project name: › my-awesome-api
✔ Language: › TypeScript
✔ ORM/ODM: › Prisma
✔ Database: › PostgreSQL
✔ Include Swagger docs? › Yes
✔ Include Docker support? › Yes
✔ Initialize Git repo? › Yes

🎉 Creating your backend...

🏃‍♂️ Launch Your Project

cd my-awesome-api
npm install
npm run dev

🎉 That's it! Your backend is running at http://localhost:3000


📦 Installation Options

# Install globally
npm install -g create-backend-buddy

# Use anywhere
create-backend-buddy my-project
# Use directly without installing
npx create-backend-buddy my-project

# Or run interactively
npx create-backend-buddy
npx create-backend-buddy \
  --name my-api \
  --lang typescript \
  --orm prisma \
  --db postgres \
  --swagger \
  --docker \
  --git

🏗️ Project Structure

my-awesome-api/
├── 📁 src/
│   ├── 📁 controllers/          # Request handlers
│   │   └── 📁 prisma/          # ORM-specific controllers
│   ├── 📁 lib/                 # Database connections
│   ├── 📁 routes/              # API route definitions
│   │   └── user.route.js
│   ├── 📁 utils/               # Utility functions
│   │   ├── logger.js           # Pino logger setup
│   │   ├── ApiError.js         # Custom error class
│   │   └── responder.js        # Response formatter
│   ├── swagger.js              # Swagger configuration
│   └── index.js                # Application entry point
├── 📁 prisma/                  # Database schema (if Prisma)
│   └── schema.prisma
├── 📁 generated/               # Auto-generated files
├── 📁 logs/                    # Application logs
├── 🐳 docker-compose.yml       # Docker services
├── 🐳 Dockerfile              # Container definition
├── 📋 swagger.yaml            # API documentation
├── ⚙️ .env.example            # Environment template
├── 📦 package.json
└── 🙈 .gitignore

🛠️ Technology Stack

Core Framework

| Technology | Purpose | Version | |------------|---------|---------| | Node.js | Runtime | 16+ | | Express | Web Framework | Latest | | TypeScript | Type Safety | Latest |

Database & ORM Options

| ORM/ODM | Databases | Features | |---------|-----------|----------| | Prisma | PostgreSQL, MySQL, SQLite | Type-safe, Auto-migration | | Sequelize | PostgreSQL, MySQL, SQLite | Feature-rich, Mature | | Mongoose | MongoDB | Schema-based, ODM |

Security & Middleware

  • 🛡️ Helmet - Security headers
  • 🌐 CORS - Cross-origin resource sharing
  • ⏱️ Rate Limiting - API abuse prevention
  • 📝 Morgan - HTTP request logging

🔧 Available Scripts

| Command | Description | |---------|-------------| | npm run dev | 🔥 Start development server with hot reload | | npm run build | 🏗️ Build TypeScript project | | npm start | 🚀 Start production server | | npm run generate | ⚙️ Generate Prisma client | | docker-compose up | 🐳 Run with Docker containers |


📚 What's Included

🔐 Security Middleware

// Automatic security setup
app.use(helmet());
app.use(cors({ origin: allowedOrigins }));
app.use(rateLimit({ windowMs: 15 * 60 * 1000, max: 100 }));

📊 Structured Logging

// Pino logger with file rotation
logger.info('Server started on port 3000');
logger.error('Database connection failed', { error });

🎯 Error Handling

// Centralized error management
class ApiError extends Error {
  constructor(message, statusCode) {
    super(message);
    this.statusCode = statusCode;
  }
}

📖 API Documentation

  • Swagger UI available at /api/docs
  • Interactive API explorer
  • Automatic schema generation

🚀 Quick Examples

Creating a New Route

// src/routes/posts.route.js
const express = require('express');
const router = express.Router();

router.get('/', async (req, res) => {
  try {
    const posts = await Post.findAll();
    res.json(ApiResponse.success(posts));
  } catch (error) {
    res.status(500).json(ApiResponse.error(error.message));
  }
});

module.exports = router;

Database Model (Prisma)

// prisma/schema.prisma
model User {
  id       Int      @id @default(autoincrement())
  email    String   @unique
  name     String?
  posts    Post[]
  createdAt DateTime @default(now())
}

🌍 Environment Configuration

# .env.example
NODE_ENV=development
PORT=3000

# Database
DATABASE_URL="postgresql://user:pass@localhost:5432/mydb"

# Security
JWT_SECRET=your-super-secret-jwt-key
CORS_ORIGIN=http://localhost:3000

# Logging
LOG_LEVEL=info

🐳 Docker Support

Quick Start with Docker

# Build and run
docker-compose up --build

# Run in detached mode
docker-compose up -d

Docker Configuration

# docker-compose.yml
version: '3.8'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - NODE_ENV=production
    depends_on:
      - db
  
  db:
    image: postgres:13
    environment:
      - POSTGRES_DB=myapi
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=password

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🌟 Star this project if it helped you!

Made with ❤️ by the Backend Buddy team

Report BugRequest FeatureDocumentation