Skip to main content
MIT License ยท TypeScript ยท Node.js

node-auth

Database-agnostic JWT authentication and communication bus for Node.js

โœจ AI-powered setupThe node-auth MCP server lets your AI assistant configure the entire library โ€” stores, strategies, webhooks and more โ€” via natural language.
Try the AI assistant โ†’
npm install @nik2208/node-auth

Choose your recipe

Pick the authentication strategy that fits your app. Mix and match multiple recipes.

๐Ÿ”‘

Email / Password

Classic email and password authentication with bcrypt hashing and password reset flow.

View docs โ†’
๐ŸŒ

OAuth / Social

Sign in with Google, GitHub, or any custom OAuth 2.0 provider using GenericOAuthStrategy.

View docs โ†’
๐Ÿช„

Magic Link

Passwordless login via email. First magic-link login counts as email verification.

View docs โ†’
๐Ÿ“ฑ

SMS OTP

One-time password codes delivered via SMS for phone verification or 2FA.

View docs โ†’
๐Ÿ”

TOTP 2FA

Time-based one-time passwords compatible with Google Authenticator and Authy.

View docs โ†’
๐Ÿข

Multi-Tenancy

Isolate users and data across multiple tenants with tenant-aware RBAC.

View docs โ†’
โš™๏ธ

Admin Panel

Self-contained admin dashboard: user management, sessions, roles, tenants, and policy controls.

View docs โ†’
๐Ÿ”—

Account Linking

Link multiple OAuth providers to one account. Safe conflict resolution via IPendingLinkStore.

View docs โ†’
๐Ÿ“ก

Event Bus & Tracking

Publish and subscribe to auth events (login, signup, failureโ€ฆ) with AuthEventBus. Track telemetry with a single tools.track() call.

View docs โ†’
๐Ÿ””

Real-time SSE

Push live notifications to connected browsers via Server-Sent Events. No WebSocket server needed.

View docs โ†’
๐Ÿช

Webhooks

Forward auth events to external services with HMAC-signed outgoing webhooks, or execute dynamic inbound scripts in a secure vm sandbox.

View docs โ†’
๐Ÿ“Š

Telemetry

Persist every auth event to any database via ITelemetryStore and query the history through the tools router.

View docs โ†’
๐Ÿค–

AI Setup (MCP)

Configure the entire library via natural language using the companion MCP server โ€” works with VS Code Copilot, Cursor, and Claude.

View docs โ†’

Why node-auth?

Featurenode-authOthers
Database supportAny DB via interfaceSpecific DBs only
Auth strategies5+ built-in recipesVaries
Self-hostedโœ… AlwaysPaid tier or limited
JWT tokensโœ… Access + refresh pairOften session-only
AI-assisted setupโœ… MCP server includedโŒ
LicenseMITMixed

Works with any database ยท Any Node.js framework ยท MIT License

If node-auth saves you time, consider โค๏ธ sponsoring the project โ€” it helps keep it maintained and growing.