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

@payal9913/create-node-backend

v2.0.0

Published

A CLI tool to generate Node.js backend boilerplates

Readme

Node js Backend Boilerplate

A modern Node.js backend boilerplate with Express.js, MongoDB, authentication, file uploads, and more.

Features

  • 🔐 Authentication with JWT (Access & Refresh tokens)
  • 📁 File uploads with Multer & Cloudinary integration
  • 🧩 Modular architecture (MVC pattern)
  • 🛡️ Middleware for authentication and error handling
  • 📝 Comprehensive API error handling
  • 🔄 MongoDB connection with Mongoose
  • 💬 Real-time communication using Socket.IO
  • ⚡ Async/await patterns with proper error handling

Quick Start

Install using NPM

# Create a new project
npx @payal9913/create-node-backend your_folder_name

# Navigate to the project
cd your_folder_name

# Install dependencies
npm install

# Start development server
npm start

Manual Setup

  1. Clone this repository
  2. Install dependencies: npm install
  3. Configure environment variables (see below)
  4. Start the server: npm start

Environment Variables

Create a .env file in the root directory with the following variables:

NODE_ENV == "dev"
PORT=8000
MONGODB_URI=your_mongodb_connection_string
CORS_ORIGIN=* 

# JWT Configuration
ACCESS_TOKEN_SECRET=your_access_token_secret
ACCESS_TOKEN_EXPIRY=1d
REFERESH_TOKEN_SECRET=your_refresh_token_secret
REFERESH_TOKEN_EXPIRY=10d

# Cloudinary Configuration
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

Getting Cloudinary Credentials

To use the file upload functionality with Cloudinary:

  1. Sign up at Cloudinary
  2. Navigate to your dashboard
  3. Copy your Cloud Name, API Key, and API Secret to your .env file

Project Structure

├── core/
│   ├── config/
│   │   ├── constant.js
│   │   └── db.js
│   ├── controllers/
│   │   └── authentication.controller.js
│   ├── middlewares/
│   │   ├── auth.middleware.js
│   │   └── fileuploader.middleware.js
│   ├── models/
│   │   └── user.models.js
│   ├── routes/
│   │   └── authentication.routes.js
│   ├── utils/
│   │   ├── apiError.js
│   │   ├── apiResponse.js
│   │   ├── asyncHandler.js
│   │   └── cloudinary.js
│   ├── app.js
│   └── server.js
├── package.json
└── .env

Available Scripts

  • npm start - Starts the server with nodemon for development
  • npm test - Runs the test suite

API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login an existing user
  • POST /api/auth/refresh-token - Get a new access token using refresh token
  • POST /api/auth/logout - Logout the user

File Uploads

This boilerplate includes middleware for handling file uploads with Multer and storing them on Cloudinary. See the fileuploader.middleware.js for implementation details.

Error Handling

The API includes a comprehensive error handling system with custom error classes and middleware for consistent error responses.

Security Best Practices

  • JWT-based authentication
  • Password hashing
  • Protected routes with middleware
  • CORS configuration
  • Request validation

License

ISC

Author

Payal Suthar


Happy coding! 🚀