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

@qwickapps/auth

v1.0.0

Published

Pure TypeScript authentication contracts and shared logic for QwickApps - platform agnostic foundation library

Readme

@qwickapps/auth-backend

Pure TypeScript authentication logic for QwickApps backend services. Platform agnostic - works with Node.js, Deno, Bun, and edge functions.

Features

  • 🔒 Pure Backend Logic - No browser dependencies, server-side focused
  • 🌐 Platform Agnostic - Works with Node.js, Deno, Bun, and edge runtimes
  • 🛡️ Security First - Password validation, secure token generation, input sanitization
  • 📝 TypeScript - Full type safety with comprehensive interfaces
  • 🎯 Modular - Import only what you need
  • Zero Dependencies - Lightweight with minimal external dependencies

Installation

npm install @qwickapps/auth-backend

Quick Start

import { 
  validateRegistrationData, 
  validateSignInData,
  hashPassword,
  verifyPassword,
  createStandardAuthError 
} from '@qwickapps/auth-backend';

// Validate user registration
const { isValid, errors, sanitized } = validateRegistrationData({
  email: '[email protected]',
  password: 'SecurePass123!',
  name: 'John Doe'
});

if (!isValid) {
  console.error('Validation errors:', errors);
}

// Hash password for storage
const hashedPassword = await hashPassword(sanitized.password);

// Verify password during login
const isCorrectPassword = await verifyPassword('SecurePass123!', hashedPassword);

Core Types

interface AuthUser {
  id: string;
  email: string;
  emailVerified: boolean;
  name?: string;
  avatarUrl?: string;
  phoneNumber?: string;
  lastSignInAt?: Date;
  createdAt: Date;
  updatedAt: Date;
  metadata?: Record<string, any>;
}

interface AuthSession {
  user: AuthUser;
  accessToken: string;
  refreshToken?: string;
  expiresAt?: Date;
  tokenType: string;
}

interface AuthResult<T = any> {
  data: T | null;
  error: AuthError | null;
}

Password Validation

import { validatePassword, generateSecurePassword } from '@qwickapps/auth-backend';

// Validate password strength
const result = validatePassword('MyPassword123!');
console.log(result.isValid); // true/false
console.log(result.score);   // 0-4 strength score
console.log(result.feedback); // Array of suggestions

// Generate secure password
const securePassword = generateSecurePassword(16);

Environment Detection

import { Environment, isNode, isDeno, isBun } from '@qwickapps/auth-backend';

console.log(Environment.current); // 'node' | 'deno' | 'bun' | 'unknown'
console.log(isNode); // boolean
console.log(isDeno); // boolean

// Get environment variables (works across runtimes)
const dbUrl = Environment.getEnv('DATABASE_URL');

Auth Provider Interface

Implement the AuthProvider interface for your specific backend:

import { AuthProvider, AuthResult, AuthUser } from '@qwickapps/auth-backend';

class MyAuthProvider implements AuthProvider {
  async initialize(): Promise<void> {
    // Initialize your auth provider
  }

  async signUp(credentials: SignUpCredentials): Promise<AuthResult<AuthUser>> {
    // Implement user registration
  }

  async verifyCredentials(credentials: SignInCredentials): Promise<AuthResult<AuthUser>> {
    // Implement credential verification
  }

  // ... implement other required methods
}

Error Handling

import { createStandardAuthError, AUTH_ERRORS } from '@qwickapps/auth-backend';

// Create consistent error responses
const error = createStandardAuthError('INVALID_CREDENTIALS');
console.log(error.message); // "Invalid email or password"

// All available error types
console.log(AUTH_ERRORS.USER_NOT_FOUND); // "User not found"
console.log(AUTH_ERRORS.EMAIL_NOT_VERIFIED); // "Please verify your email..."

Platform Support

  • Node.js 16+
  • Deno 1.28+
  • Bun 1.0+
  • Edge Functions (Supabase, Vercel, Cloudflare Workers)

Security Features

  • Password strength validation with customizable requirements
  • Secure token generation using crypto APIs
  • Input sanitization to prevent injection attacks
  • Constant-time password verification
  • JWT-like token utilities (simplified - use proper JWT libs in production)

Development vs Production

This library includes simplified implementations of cryptographic functions for development and prototyping. In production:

  • Use proper bcrypt/argon2 for password hashing
  • Use established JWT libraries (jsonwebtoken, jose)
  • Use proper CSRF protection
  • Implement rate limiting
  • Use secure session storage

License

Copyright (c) 2025 QwickApps.com. All rights reserved. This software is proprietary and confidential.