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

backend-auth

v1.0.9

Published

A CLI to generate Express backend boilerplates with Authentication (PostgreSQL/Prisma & MongoDB/Mongoose)

Readme

🚀 backend-auth

The Universal Authentication API Generator for Node.js

backend-auth is a powerful CLI tool that generates production-ready, battle-tested backend authentication systems instantly. Stop writing boilerplate auth code—just run a single command and get a fully configured Node.js server with JWT authentication, security middlewares, database connections, and user models.

✨ Features

  • ⚡ Instant Setup: Get a running API in seconds, not hours.
  • 🛠️ Multiple Stacks: Choose between Express + MongoDB (Mongoose) or Express + PostgreSQL (Prisma).
  • 🧩 Feature Injection System: Add modular, self-contained features directly into your existing project (e.g., OTP Verification, Roles).
  • 🔒 Secure by Default: Comes pre-configured with helmet, cors, bcryptjs, and JSON Web Tokens (JWT).
  • 📝 TypeScript Ready: Fully typed out of the box.

📦 Getting Started

You do not need to install the package globally. You can run it instantly using npx:

npx backend-auth init

The CLI will prompt you for:

  1. Project Name: The directory where your backend will be generated.
  2. Framework: Choose Express.
  3. Database: Choose MongoDB or PostgreSQL.
  4. ORM: Choose Mongoose or Prisma.

Once generated, your project will come with an auto-generated .env file containing connection URIs, a secure JWT secret, and ports.

Running your new project:

cd <your-project-name>
npm run dev

🧩 Adding Features

backend-auth uses an "additive" feature injection system. Once you generate a base project, you can inject modular features into it.

For example, to add an Email/Phone OTP (One-Time Password) Verification system to your project:

# Make sure you are inside your generated project folder!
npx backend-auth add otp

This will safely inject the routes, controllers, and services needed for OTP verification directly into your codebase.

Available Features

  • otp - OTP Generation & Verification flow
  • More features like roles (RBAC) and forgot-password coming soon!

📂 Project Structure

A generated backend-auth API is beautifully organized:

├── src/
│   ├── config/      # Database connections & environment variables
│   ├── controllers/ # Route handlers (e.g., authController.ts)
│   ├── middleware/  # JWT validation & error handling
│   ├── models/      # Database schemas (Mongoose) or Prisma clients
│   ├── routes/      # Express API routes
│   ├── utils/       # Helpers like jwt token generation
│   ├── app.ts       # Express app configuration
│   └── index.ts     # Server entrypoint
├── prisma/          # (Only if using Prisma/PostgreSQL)
├── .env             # Environment Variables
├── .backend-auth.json # Internal configuration state
├── package.json
└── tsconfig.json

🤝 Contributing

Contributions are always welcome! Feel free to open issues or submit Pull Requests to expand template support (e.g., NestJS, Fastify).

📄 License

MIT