An advanced authentication system built with features like email verification, OTP handling, password reset, protected routes, and a clean frontend UI.
- π User Signup with Email Verification
- π§ Welcome Email on Signup
- β Email OTP Verification
- π Secure Login System
- π Protected Routes
- π€ Forgot and Reset Password
- πͺ Logout Functionality
- π User Dashboard Access
- π Reusable Email Templates
- π Frontend Integration with Auth APIs
advanced-auth/
β
βββ backend/
β βββ controllers/
β βββ routes/
β βββ utils/
β βββ services/
β βββ middlewares/
β βββ server.js
β
βββ frontend/
β βββ public/
β βββ src/
β β βββ components/
β β βββ pages/
β β βββ services/
β β βββ App.js
β βββ index.html
β
βββ README.md
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/signup |
Register a new user and send OTP |
| POST | /api/auth/verify-email |
Verify user's email using OTP |
| POST | /api/auth/login |
Login with email and password |
| POST | /api/auth/logout |
Logout the current user |
| POST | /api/auth/forgot-password |
Send password reset link/email |
| POST | /api/auth/reset-password |
Reset password using token or OTP |
| GET | /api/auth/check-auth |
Check if the user is authenticated |
- π Signup Page
- π Login Page
- β Email Verification Page
- π Forgot Password Page
- π Reset Password Page
- π Dashboard Page
- Node.js
- Express.js
- MongoDB (Mongoose)
- Nodemailer
- JWT
- React.js
- Tailwind CSS
- Axios
- React Router
- π Welcome Email
- β OTP Verification Email
- π Password Reset Email
All templates are clean, responsive, and customizable.
- Auth tokens are stored securely.
- Middleware to protect backend routes.
- Conditional frontend rendering based on auth state.
# Clone the repository
git clone https://github.com/your-username/advanced-auth.git
cd advanced-auth
# Backend setup
cd backend
npm install
npm run dev
# Frontend setup
cd ../frontend
npm install
npm startCreate a .env file in the backend/ directory with:
PORT=5000
MONGO_URI=your_mongo_connection_string
JWT_SECRET=your_jwt_secret
EMAIL_USER=your_email@example.com
EMAIL_PASS=your_email_password
CLIENT_URL=http://localhost:3000
Contributions are welcome! Feel free to open issues or submit pull requests.
For any queries or suggestions:
- Email: iamshehbaz01@gmail.com
- GitHub: @Shehbaz456
- LinkedIn: Shehbaz