Copy one folder into your Express.js project. Configure what you need. Get 16 production-ready endpoints instantly.
// That's it. 3 lines to add auth to your project.
import { createConfig, createAuthModule } from './auth/index.js';
const config = createConfig({ session: { secure: false } });
app.use('/auth', createAuthModule(config));
Features
All features are disabled by default. Enable only what your project needs โ zero bloat.
Register, login, logout with argon2id hashing. Secure by default.
Server-side sessions with httpOnly cookies. List and revoke devices.
Forgot password flow with secure, hashed, single-use tokens.
6-digit OTP verification. Console adapter for dev, Nodemailer for prod.
No Passport.js. Direct implementation with automatic account linking.
Track every login with device info, IP address, and timestamps.
Temporary lock after failed attempts. Auto-expires, no admin needed.
Structured JSON logs for every auth event. Debug and monitor easily.
Helmet, CSRF protection, enumeration prevention, rate limiting.
How It Works
Download the latest release from GitHub Releases. Copy src/auth/ into your project โ you own the code.
Call createConfig() with the features you need. Everything is opt-in. Add SESSION_SECRET to your .env.
One line: app.use('/auth', createAuthModule(config)). Your existing MongoDB connection and routes are untouched.
Why
Every Express project needs auth. Why write 500+ lines every time?
โ Without ModularAuth-Kit
// User model, password hashing, session store,
// login controller, register controller,
// forgot-password, reset-password, email service,
// CSRF middleware, rate limiter, cookie config,
// session rotation, account lockout logic,
// Google OAuth flow, input validation,
// error handling, audit logging...
//
// 500+ lines. Every. Single. Project.
// And you still forget enumeration protection.
โ With ModularAuth-Kit
import { createConfig, createAuthModule } from './auth/index.js';
const config = createConfig({
session: { secure: false },
passwordRecovery: { enabled: true },
emailVerification: { enabled: true },
loginHistory: { enabled: true },
sessionManagement: { enabled: true },
security: {
accountLockout: { enabled: true },
},
});
app.use('/auth', createAuthModule(config));
๐ค AI-Powered
Paste a single prompt to your AI coding agent (Cursor, Copilot, Gemini). The agent analyzes your project, asks what you need, and wires everything up automatically.
โ
I've analyzed your project:
โข Express 5.x found in src/app.ts
โข MongoDB connected via mongoose.connect()
โข Missing deps: argon2, zod
โ
Installed 2 packages
โ
Added SESSION_SECRET to .env
โ
Added 4 lines to src/app.ts
โ
TypeScript: 0 errors
โ
Server started on :3000
โ
POST /auth/register โ 201
โ
POST /auth/login โ 200
โ
GET /auth/me โ 200
Auth is ready. 16 endpoints available.
Built With