complete-auth-system
v1.0.1
Published
A powerful CLI tool to set up a complete authentication system for MERN stack projects, featuring user registration, email verification, 2FA, OTP-based login, password authentication, and advanced security measures like account lock after failed attempts.
Maintainers
Keywords
Readme
Complete Auth System
A simple, ready-to-use authentication system for full-stack developers.
Overview
complete-auth-system saves you time by providing a pre-built authentication system with all essential features. No need to rebuild authentication from scratch for every project - just install, configure, and go!
Key Features
- ✓ User Registration
- ✓ Email Verification
- ✓ 2-Factor Authentication
- ✓ Login with OTP
- ✓ Login with Password
- ✓ Login with OTP and Password Both
- ✓ Forget / Reset Password
- ✓ Profile Management
- ✓ Token Management
- And Many more...
- You Just need to change some things according to your need and you are good to go.
Installation
# Basic installation
npx complete-auth-system <folder_name>
# Custom frontend/backend folder names
npx complete-auth-system <folder_name> --frontend <frontend_folder_name> --backend <backend_folder_name>Setup
Backend Configuration
Create a .env file in the backend directory with the following variables:
PORT=7000
MONGO_URI=mongodb+srv://username:[email protected]/complete-auth
FRONTEND_URL=http://localhost:5173
EMAIL_USER="[email protected]"
EMAIL_PASS="your-app-password" # Generate app password from your email provider
NODE_ENV=development
JWT_SECRET=your_jwt_secret
JWT_REFRESH_SECRET=your_jwt_refresh_secret
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secretFrontend Configuration
Create a .env file in the frontend directory:
VITE_API_BACKEND_API_URL=http://localhost:7000/api/v1
NODE_ENV=developmentProject Structure
Frontend
src/
├── components/ # UI components
├── pages/ # Application pages
├── redux/ # State management
├── lib/ # Utility libraries
├── assets/ # Static assets
└── App.jsx # Main application componentBackend
├── config/ # Configuration files
├── controllers/ # Request handlers
├── middleware/ # Custom middleware
├── models/ # Database models
├── routes/ # API routes
├── services/ # Business logic
├── utils/ # Helper functions
├── uploads/ # File uploads directory
└── server.js # Entry pointGetting Started
- Install the package using the npx command
- Configure environment variables
- Start the backend:
cd <folder_name>/backend && npm run dev - Start the frontend:
cd <folder_name>/frontend && npm run dev
Note
This package provides a complete authentication system that you can customize to suit your project needs. The email verification feature requires you to generate an app password from your email provider.
