A secure Authentication API built with Node.js & Express.
Includes JWT-based authentication, password hashing, role-based access control (RBAC), and Nodemailer email services for user verification and password recovery.
- ✅ User Registration & Login
- 🔒 Password Hashing using bcrypt
- 🔑 Authentication using JWT (JSON Web Token)
- 🛡️ Role-based Authorization (Admin/User)
- 📩 Email Service with Nodemailer
- Account Verification Email
- Password Reset via Email Link
- 🔐 Secure Routes (Protected APIs)
- 📦 MongoDB integration with Mongoose
- Backend: Node.js, Express.js
- Database: MongoDB (Mongoose ODM)
- Authentication: JWT, bcrypt
- Email Service: Nodemailer + Gmail/SMTP
- Environment: dotenv
FULLSTACK
│── controller/
│ └── user.controller.js
│── middleware/
│ └── auth.middleware.js
│── model/
│ └── User.model.js
│── prisma/
│── routes/
│ └── user.routes.js
│── utils/
│ └── dg.js
│── .env
│── .gitignore
│── decription.md
│── index.js
│── package.json
│── package-lock.json
│── README.md
git clone https://github.com/your-username/node-auth-api.git
cd node-auth-api
2️⃣ Install dependencies
npm install
3️⃣ Setup environment variables
PORT=5000
DATABASE_URL=your_database_connection_string
JWT_SECRET=your_jwt_secret_key
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_email_password_or_app_password
4️⃣ Start the server
npm start