This is the backend server of a full-stack authentication and password reset application. It handles secure user registration, login, forgot password, and password reset via email using Node.js, Express, MongoDB, and JWT.
- π User Registration & Login
- π JWT-based Authentication
- π© Forgot Password (via email)
- β»οΈ Secure Reset Password (token with expiry)
- π Password hashing with
bcryptjs - π Email handling via
nodemailer - π Reset token securely generated using built-in
cryptomodule - π CORS enabled for frontend integration
- π¦ Environment variables for secure configs
- π’ Node.js β JavaScript runtime for backend
- π Express.js β Web framework
- ποΈ MongoDB β NoSQL database
- π JWT (jsonwebtoken) β Token-based authentication
- π bcryptjs β For password hashing
- π§ͺ crypto β Built-in Node module for generating secure tokens
- π Nodemailer β For sending reset password emails
- 𧬠dotenv β Manage environment variables
| Method | Route | Description |
|---|---|---|
| POST | /api/register | Register new user |
| POST | /api/login | Login and get token |
| POST | /api/forgot-password | Send reset link |
| POST | /api/reset-password | Reset password |
You can test the backend using:
- β Postman (send requests manually)
- β Frontend React App (connected via Axios)