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

@devcoons/next-node-auth-utils

v0.1.0

Published

Minimal, framework-agnostic authentication utilities for Next.js and Node.js.

Downloads

8

Readme

next-node-auth-utils

Minimal, framework-agnostic authentication utilities for Next.js and Node.js.

Provides strong password hashing, session claim helpers, UA/IP fingerprinting, and random ID generation — all split cleanly between browser-safe, Next.js, and Node-only modules.


Features

  • Argon2 password hashing (Node-only)
  • User-Agent / IP hash extraction with Next.js adapters
  • Claims helpers for roles & permissions
  • Zod-based password strength validation
  • Random ID generation (URL-safe base64)
  • Tree-shakeable ESM build with full TypeScript types
  • No framework lock-in — works in Node, Next.js, and any headers-compatible runtime

Installation

npm install next-node-auth-utils

Requires Node.js ≥ 18 and Next.js ≥ 13.4.


Usage

Node.js (API / worker)

import { randomId } from "next-node-auth-utils"
import { hashPassword, verifyPassword } from "next-node-auth-utils/node"

async function example() {
  const id = randomId()
  const hash = await hashPassword("StrongPassw0rd!")
  const ok = await verifyPassword(hash, "StrongPassw0rd!")

  console.log({ id, ok })
}

Next.js (Middleware or Route Handler)

import { NextResponse } from "next/server"
import { getUaHash, getIpHint } from "next-node-auth-utils/next"

export function middleware(req) {
  const ua = getUaHash(req)
  const ip = getIpHint(req, { bindIp: true })
  console.log({ ua, ip })
  return NextResponse.next()
}

Claims Helpers

import { hasRoles, hasPermissions } from "next-node-auth-utils"

const session = {
  sid: "abc",
  user_id: "u1",
  iat: Date.now(),
  exp: Date.now() + 3600_000,
  claims: { roles: ["admin"], permissions: ["read", "write"] }
}

console.log(hasRoles(session, "admin")) // → true

Password Strength Validation

import { validatePasswordStrength } from "next-node-auth-utils"

const result = validatePasswordStrength("weakpass")
if (!result.ok) console.error(result.error)

API Surface

| Import Path | Description | |--------------|-------------| | next-node-auth-utils | Core helpers (random ID, password validation, claims) | | next-node-auth-utils/node | Node-only Argon2 hashing | | next-node-auth-utils/next | Next.js-specific UA/IP helpers |


Project Goals

  • Keep all code framework-agnostic by default.
  • Cleanly separate Node-only and Next entry points.
  • Ship zero browser-incompatible code in ESM bundles.
  • Favor clarity and correctness over magic.

Requirements

  • Node.js ≥ 18
  • TypeScript ≥ 5.3
  • Next.js ≥ 13.4 (for next entry point)

License

MIT © 2025 devcoons