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

backforge-cli

v1.7.0

Published

BackForge CLI - Production-ready backend scaffolder (Global CLI wrapper)

Readme

backforge-cli

npm version CI License: MIT Node.js Version Bun Version

Global CLI for BackForge - Production-ready backend scaffolder with enterprise-grade security and logging.

Installation

npm install -g backforge-cli

Usage

# Interactive mode
backforge

# With project name
backforge my-backend

# Skip dependency installation
backforge my-backend --no-install

What is backforge-cli?

backforge-cli is a global CLI wrapper around backforge-core. It provides a convenient backforge command for users who prefer global installation.

When to use backforge-cli?

Use backforge-cli if you:

  • Prefer global CLI tools
  • Want a short command (backforge instead of npx backforge-core)
  • Create BackForge projects frequently

Use create-backforge if you:

  • Prefer not installing global packages
  • Want to always use the latest version
  • Follow npm create/init conventions
# Using backforge-cli (global)
npm install -g backforge-cli
backforge my-project

# Using create-backforge (recommended)
npm create backforge@latest my-project

Features

Every BackForge project includes production-ready features:

Security

  • helmet() - Security HTTP headers (prevents XSS, clickjacking, etc.)
  • cors() - Configurable cross-origin resource sharing
  • rateLimit() - DDoS protection (100 requests per 15 minutes per IP)
  • hpp() - HTTP parameter pollution prevention
  • compression() - Response compression
  • Body limits - Prevents memory exhaustion (10MB default)

Logging & Monitoring

  • Winston - Enterprise-grade structured logging
  • Daily rotation - Automatic log archival (30-day retention)
  • Separate logs - error.log, combined.log, exceptions.log
  • HTTP logging - Morgan middleware integration
  • JSON format - Compatible with DataDog, Splunk, ELK, CloudWatch

Error Handling

  • Async error handling - express-async-errors (no try/catch needed)
  • Centralized middleware - Single error handler
  • Graceful shutdown - Proper cleanup on SIGTERM/SIGINT
  • Unhandled rejections - No silent crashes

Stack Options

Choose from 8 production-tested combinations:

  • Runtimes: Node.js or Bun (auto-detected)
  • Languages: TypeScript or JavaScript
  • Frameworks: Express or Fastify
  • ORMs: Mongoose (MongoDB) or Prisma (SQL)

Commands

# Create new project
backforge my-backend

# Skip installation
backforge my-backend --no-install

# Help
backforge --help

# Version
backforge --version

Generated Project Structure

my-backend/
├── src/
│   ├── config/
│   │   ├── database.ts      # Database connection with retry
│   │   └── logger.ts        # Winston + daily rotation
│   ├── controllers/         # Route controllers
│   ├── models/              # Database models
│   │   └── User.model.ts    # Example user model
│   ├── routes/              # API routes
│   │   └── health.routes.ts
│   ├── services/            # Business logic
│   ├── middlewares/         # Custom middlewares
│   ├── utils/               # Utility functions
│   ├── app.ts               # App + security setup
│   └── server.ts            # Entry point + graceful shutdown
├── logs/                    # Auto-generated logs
├── .env                     # Environment variables
├── .gitignore
├── package.json
├── tsconfig.json            # (TypeScript projects)
└── README.md

Example Output

// app.ts - Security already configured!

import helmet from 'helmet';
import cors from 'cors';
import rateLimit from 'express-rate-limit';
import hpp from 'hpp';
import compression from 'compression';
import logger from './config/logger';

const app = express();

// Security middlewares
app.use(helmet());
app.use(cors({ origin: process.env.CORS_ORIGIN || '*' }));
app.use(hpp());

// Rate limiting (DDoS protection)
const limiter = rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 100,                  // 100 requests per IP
});
app.use('/api/', limiter);

// Compression
app.use(compression());

// HTTP request logging
app.use(morgan('combined', {
  stream: { write: (msg) => logger.info(msg.trim()) }
}));

Package Ecosystem

BackForge provides three packages:

1. create-backforge (Recommended for most users)

npm create backforge@latest

Advantages:

  • No installation needed
  • Always uses latest version
  • Standard npm create pattern

2. backforge-core (For direct usage)

npx backforge-core

Advantages:

  • Direct access to core library
  • Can be used programmatically
  • No global installation

3. backforge-cli (This package - for global CLI)

npm install -g backforge-cli
backforge

Advantages:

  • Short command (backforge)
  • Installed once, use anywhere
  • Traditional CLI feel

Environment Variables

Configure your generated project:

# Server
PORT=3000
NODE_ENV=development

# Database (MongoDB)
MONGODB_URI=mongodb://localhost:27017/myapp

# Database (Prisma - PostgreSQL)
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"

# Security
CORS_ORIGIN=https://yourdomain.com

# Logging
LOG_LEVEL=info  # error | warn | info | debug

Development Workflow

After generating a project:

# Install dependencies (if skipped)
npm install

# Development mode (auto-reload)
npm run dev

# Production mode
npm start

# Build (TypeScript only)
npm run build

# Linting
npm run lint
npm run lint:fix

# Formatting
npm run format

Updating

# Update to latest version
npm update -g backforge-cli

# Check current version
backforge --version

Uninstalling

npm uninstall -g backforge-cli

Why Global CLI?

Some developers prefer global CLIs because:

  • Shorter commands: backforge vs npm create backforge
  • Faster execution: No download on each run
  • Familiar pattern: Like create-react-app, vue create, etc.
  • Offline usage: Works without internet (after installation)

Links

  • Main Project: https://github.com/Codewithevilxd/backforge
  • npm (backforge-cli): https://www.npmjs.com/package/backforge-cli
  • npm (backforge-core): https://www.npmjs.com/package/backforge-core
  • npm (create-backforge): https://www.npmjs.com/package/create-backforge
  • Website: https://Codewithevilxd.org
  • Documentation: https://Codewithevilxd.org/docs
  • Issues: https://github.com/Codewithevilxd/backforge/issues

License

MIT © BackForge


Part of BackForge - Production-ready backends in seconds.