Self-hosted, production-grade authentication system rivaling Auth0 and Firebase. Complete control, zero vendor lock-in, unlimited customization.
Overall Production Readiness: 72% | Average Maturity: 6.7/10
Enterprise-grade security without vendor lock-in. Complete control over your authentication infrastructure at zero recurring costs.
Auth0 Cost:
$0.023/user/month
Vendor Lock-in:
High Risk
Setup Time:
2 hours+
Industry best practices with 19 integrated security features
Battle-tested architecture for real-world applications
Clean REST API with comprehensive documentation
JWT, 2FA, OAuth, device management, and more
Track sessions, devices, and user activity
30+ environment variables for customization
Comprehensive authentication features for modern applications
| Feature | Status | Description |
|---|---|---|
| Email/Password | ✅ Production | bcryptjs with 12 salt rounds, strength validation |
| Google OAuth 2.0 | ✅ Production | Firebase Admin SDK integration |
| Two-Factor (2FA) | ✅ Production | TOTP with backup codes |
| Magic Links | 🔄 Q2 2025 | Email-based passwordless login |
| WebAuthn/FIDO2 | 📋 Q4 2025 | Biometric authentication |
| SAML 2.0 | 📋 Q4 2025 | Enterprise SSO support |
Built with modern technologies and best practices
┌─────────────────────────────────────────────────────────┐
│ Client Applications Layer │
│ (Web, Mobile, Third-party Applications) │
└───────────────────────┬─────────────────────────────────┘
│ HTTPS/REST API
│ JWT Authentication
┌───────────────────────▼─────────────────────────────────┐
│ Express.js Application Server │
│ ┌────────────────────────────────────────────────────┐ │
│ │ Security Middleware Layer │ │
│ │ • CORS • Helmet • Rate Limiting • Auth │ │
│ └────────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ API Route Handlers │ │
│ │ /auth /users /permissions /sessions │ │
│ └────────────────────────────────────────────────────┘ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ Business Logic Services │ │
│ │ • Email • Firebase • Storage • Backup │ │
│ └────────────────────────────────────────────────────┘ │
└───────────┬─────────────┬─────────────┬─────────────────┘
│ │ │
┌───────▼──────┐ ┌───▼────────┐ ┌─▼─────────────┐
│ MongoDB │ │ Firebase │ │ AWS S3/IPFS │
│ Database │ │ Auth SDK │ │ Storage │
└──────────────┘ └────────────┘ └───────────────┘
{
// Authentication
username: String (unique, indexed)
email: String (unique, indexed)
password: String (bcrypt hashed)
// Profile
firstName, lastName, dateOfBirth
profilePicture: String (S3 URL)
// Security
twoFactorAuth: {...}
trustedDevices: [...]
sessions: [...]
// Metadata
lastLogin, loginCount, totalSessions
}
Get up and running in 10 minutes
git clone https://github.com/hanan-bhatti/authn.git
cd authn
npm install
# or
yarn install
cp .env.example .env
Edit .env with your configuration:
# Server
PORT=5000
NODE_ENV=development
BASE_URL=http://localhost:5000
# Database
MONGO_URL=mongodb://localhost:27017/authn
# JWT Secret (IMPORTANT)
JWT_SECRET=your-super-secret-minimum-32-characters
# Email Service
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
# Development mode with hot reload
npm run dev
# Production mode
npm start
RESTful API endpoints for seamless integration
Production: https://api.yourdomain.com/api
Development: http://localhost:5000/api
Get current user profile
Update user profile
Upload profile picture
Change user password
Get trusted devices
Get active sessions
Multiple deployment strategies for any infrastructure
Containerized deployment with Docker Compose for easy scaling and management
docker-compose up -d
Process manager for Node.js with cluster mode and auto-restart capabilities
pm2 start ecosystem.config.js
Traditional VPS deployment with full control over infrastructure and configuration
ssh ubuntu@your-ec2-ip
Container orchestration for high-availability and automatic scaling in production
kubectl apply -f deployment.yaml
Platform-as-a-Service for quick deployment without infrastructure management
git push heroku main
Simple cloud hosting with App Platform or traditional droplet deployment
doctl apps create
Production-ready Nginx configuration with SSL, rate limiting, and security headers
upstream authn_backend {
server localhost:5000;
}
server {
listen 443 ssl http2;
server_name api.yourdomain.com;
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
location / {
proxy_pass http://authn_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Industry-leading security with 19 integrated features
const saltRounds = 12;
const hashedPassword =
await bcrypt.hash(password, saltRounds);
Questions, feedback, or need enterprise support?
Need help with custom features, deployment, security audits, or training?
Join our community for free support and discussions