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

devil-backend-nodejs

v4.1.0

Published

A production-ready Node.js + Express + MongoDB backend boilerplate CLI

Readme

🚀 devil-backend-nodejs

A production-ready Node.js + Express + MongoDB backend boilerplate CLI with built-in utilities and common helper functions.

npm version npm downloads license


⚡ Quick Start

Scaffold a new backend project in seconds:

npx devil-backend-nodejs my-app

🛠️ CLI Flags (Skip Prompts)

Customize your project structure directly from the command line:

# Add specific features
npx devil-backend-nodejs my-app --cloudinary
npx devil-backend-nodejs my-app --email-gmail
npx devil-backend-nodejs my-app --email-brevo
npx devil-backend-nodejs my-app --razorpay
npx devil-backend-nodejs my-app --stripe
npx devil-backend-nodejs my-app --docker

# Combine multiple features
npx devil-backend-nodejs my-app --cloudinary --email-brevo --razorpay --docker

# Other options
npx devil-backend-nodejs my-app --no-install
npx devil-backend-nodejs --help

📋 Features

  • Standardized API Responses: Built-in ApiError and ApiResponse classes.
  • Async Handling: asyncHandler to eliminate try-catch blocks in controllers.
  • Authentication: JWT-based auth with middleware.
  • Database: Mongoose configuration with pagination support.
  • Security: Pre-configured Helmet, CORS, Rate Limiting, and HPP.
  • Integrations: Easy setup for Cloudinary, Razorpay, Stripe, Gmail, and Brevo.
  • Docker Support: Optional Docker and Docker Compose configuration.

🏗️ Generated Project Structure

my-app/
├── src/
│   ├── config/
│   │   ├── db.js
│   │   └── constants.js
│   ├── controllers/
│   │   └── authController.js
│   ├── middleware/
│   │   ├── authMiddleware.js
│   │   ├── errorHandlerMiddleware.js
│   │   ├── rateLimiter.js
│   │   └── roleCheckMiddleware.js
│   ├── models/
│   │   └── userModel.js
│   ├── routes/
│   │   ├── authRoutes.js
│   │   └── index.js
│   ├── utils/
│   │   ├── ApiError.js
│   │   ├── ApiResponse.js
│   │   └── generateToken.js
│   └── validators/
│       └── authValidator.js
├── app.js
├── server.js
├── .env
└── package.json

📦 Install as a Utility Package

You can also use the utilities and helpers in your existing projects:

npm install devil-backend-nodejs

🛠️ Backend Utilities

commonJS

const { asyncHandler, ApiError } = require('devil-backend-nodejs');

ESM / TypeScript

import { asyncHandler, ApiError } from 'devil-backend-nodejs';

| Utility | Description | Example | | :--- | :--- | :--- | | asyncHandler | Wrap async controllers | asyncHandler(async (req, res) => {}) | | paginate | MongoDB pagination | await paginate(Model, query, { page, limit }) | | ApiError | Standard error class | new ApiError(404, 'Not found') | | ApiResponse | Standard response class | new ApiResponse(200, data, 'Success') | | generateToken | Generate JWT token | generateToken(userId) | | generateOTP | 6 digit OTP | generateOTP() | | randomString | Random string | randomString(32) | | slugify | Text to URL slug | slugify('Hello World') -> hello-world | | capitalize | Capitalize string | capitalize('hello') -> Hello | | capitalizeWords | Capitalize all words | capitalizeWords('hello world') | | formatDate | Format date | formatDate(new Date()) -> 21 Mar 2026 | | timeAgo | Relative time | timeAgo('2026-03-20') -> 1 day ago | | pick | Pick object fields | pick(req.body, ['name', 'email']) | | exclude | Exclude object fields | exclude(user, ['password']) | | isEmptyObject | Check empty object | isEmptyObject({}) -> true | | calculatePagination | Pagination meta | calculatePagination(100, 2, 10) | | validateEnv | Validate env vars | validateEnv(['JWT_SECRET', 'MONGO_URI']) |


☁️ Cloudinary Helper

Set env variables:

CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
const {
  uploadToCloudinary,
  uploadImageToCloudinary,
  deleteFromCloudinary,
} = require('devil-backend-nodejs');

// File upload (pdf, doc etc)
const file = await uploadToCloudinary(buffer, originalname, mimetype, 'documents');

// Image upload
const img = await uploadImageToCloudinary(buffer, originalname, mimetype, 'avatars');

// Delete
await deleteFromCloudinary(publicId);

💳 Payment Helpers

Razorpay

Set env variables:

RAZORPAY_KEY_ID=your_key_id
RAZORPAY_KEY_SECRET=your_key_secret
const { createOrder, verifyPayment } = require('devil-backend-nodejs');

// Create order
const order = await createOrder(499, 'INR');

// Verify payment
const isValid = verifyPayment(orderId, paymentId, signature);

Stripe

Set env variables:

STRIPE_SECRET_KEY=your_secret_key
STRIPE_WEBHOOK_SECRET=your_webhook_secret
const { createPaymentIntent, constructWebhookEvent } = require('devil-backend-nodejs');

// Create payment intent
const intent = await createPaymentIntent(499, 'inr');

// Verify webhook
const event = constructWebhookEvent(req.body, req.headers['stripe-signature']);

📧 Email Helpers

Gmail (SMTP)

[email protected]
GMAIL_PASS=your_app_password
const { sendGmail, sendOTPGmail, sendWelcomeGmail } = require('devil-backend-nodejs');

await sendGmail('[email protected]', 'Subject', '<h1>Hello!</h1>');
await sendOTPGmail('[email protected]', '123456');
await sendWelcomeGmail('[email protected]', 'Sachin');

Brevo

BREVO_API_KEY=your_api_key
BREVO_SENDER_EMAIL=your_verified_email
BREVO_SENDER_NAME=your_name
const { sendBrevo, sendOTPBrevo, sendWelcomeBrevo } = require('devil-backend-nodejs');

await sendBrevo('[email protected]', 'Subject', '<h1>Hello!</h1>');
await sendOTPBrevo('[email protected]', '123456');
await sendWelcomeBrevo('[email protected]', 'Sachin');

📱 Frontend Package

For React hooks and frontend helpers, use our companion package:

npm install devil-frontend

npm version


👤 Author

Sachin Tiwari


📄 License

MIT © Sachin Tiwari