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

yash-auth-flow

v1.0.16

Published

Production-ready multi-account authentication library (Auth Forge) for Node.js, Express, Prisma, and PostgreSQL. Secure JWT auth, OTP, and dynamic email verification flow.

Readme

yash-auth-flow logo

yash-auth-flow (Auth Forge)

npm version npm downloads license PRs Welcome

A production-ready, high-performance multi-account authentication library (Auth Forge) for Node.js, Express, Prisma, and PostgreSQL. Designed for scalability and ease of use, yash-auth-flow provides a complete, secure authentication solution out-of-the-box..

Table of Contents

Features

  • Multi-Account Support: Manage multiple account types (e.g., Personal, Work) under a single User identity.
  • Dynamic Verification: Built-in support for 6-digit OTP and UUID-based email verification links.
  • Security First: Pre-configured with Helmet, Express Rate Limit, and Bcrypt (12 rounds).
  • JWT Based: Modern access and refresh token management.
  • Prisma Integration: Ships with a ready-to-use Prisma schema.
  • Email Templates: Sleek, ready-to-send HTML templates for verification.
  • Verification Preference: Users can choose their preferred verification type (OTP or LINK) via their profile, falling back to system defaults.

Installation

npm install yash-auth-flow

Quick Start

1. Setup Prisma

Copy the provided schema from prisma/schema.prisma to your project and run:

npx prisma db push

2. Configure Environment Variables

Create a .env file based on .env.example:

DATABASE_URL="postgresql://..."
ACCESS_TOKEN_SECRET="your-secret"
REFRESH_TOKEN_SECRET="your-secret"

3. Usage Example

import { AuthService, authMiddleware, UserService } from 'yash-auth-flow';
import express from 'express';

const app = express();
app.use(express.json());

// Registration
app.post('/register', async (req, res) => {
  const { email, password, fullName } = req.body;
  const result = await AuthService.register(email, password, fullName);
  res.json(result);
});

// Protected Route
app.get('/profile', authMiddleware, (req: any, res) => {
  res.json({ user: req.user, account: req.account });
});

// Edit Profile (Change Verification Type)
app.put('/profile/edit', authMiddleware, async (req: any, res) => {
  const { verificationType } = req.body;
  const result = await UserService.editProfile(req.user.id, { verificationType });
  res.json(result);
});

app.listen(3000);

Multi-Account Logic

yash-auth-flow allows a User to have multiple Accounts. For example:

  • A user can login with type: "personal"
  • Later, they can create or link an account with type: "work"
  • Both accounts belong to the same User.id, allowing shared profiles or settings.

Security

yash-auth-flow follows security best practices:

  • Password Hashing: Uses bcrypt with 12 salt rounds by default.
  • Rate Limiting: Protects against brute-force attacks via express-rate-limit.
  • Header Security: Includes helmet for secure HTTP headers.
  • JWT Best Practices: Secure token signing (HS256) and refresh rotation.

Keywords

auth, authentication, prisma, jwt, multi-account, otp, node, express, security, postgresql, auth-flow, login, signup, session, authorize, postgres, auth-forge, backend, rest-api, user-management, access-token, refresh-token, session-management, signup-logic, login-logic, rbac, secure-auth, auth-library