This project is an authentication service built using the MERN stack (MongoDB, Express.js, React.js, Node.js). It provides a secure way to manage user authentication, including registration, login, password reset, and more.
git clone https://github.com/KUNAL01011/Auth-Service.gitMONGO_URL = ...
PORT = ...
NODE_ENV = development
JWT_SECRET = ....
#E-mail
SMTP_HOST = ....
SMTP_PORT = ...
SMTP_SERVICE = ....
SMTP_MAIL = ...
SMTP_PASSWORD = ...
RESET_URL = ....npm run buildnpm run dev- User registration with email verification
- User login with JWT authentication
- Password reset functionality
- Secure password hashing with bcrypt
Before you begin, ensure you have the following installed:
-
Clone the repository:
git clone git@github.com:KUNAL01011/Auth-Service.git
- cd Auth
- npm install
- npm run dev
- cd frontend
- npm install
- npm run dev
npm init -y
npm i express mongoose cookie-parser mailtrap bcryptjs dotenv jsonwebtoken crypto
npm i nodemon -D
- create the server by the help of express.js
- make a connection to the database
- make a default setup of mvc arch
- create the user model
- create the signup controller
- hashing the password
- generate the cookie and set the cookie
- sending the mail to activate the account
- create the logout controller
- simple delete the jwt cookie form the client
- create the signin controller
- take the email and password check if correct then login and if not return error msg
- create forgot password controller
- first redirect the forgot page and take the email
- if email exist than generate the random link by using crypto pakeage
- and send the link by a mail
- if user click on the reset password this will redirect to reset page
- take the link and match if corrent the generate new password
- and save that password and return to the user
- create a get user profile controller
- create a middleware that check the cookie is valid or not if not then send invalid user
- we need something called a email address or password
- steps to generate new password
- login to your email account
- enable the two factor authentication
- click on the security button and search the app password
- In the drop down menu select the other custom name and give the name nodemailler and click generate
- copy the password and paste into your env the password look like this : akds slkd slkd lied
nodemailer is a node pakeage that use to send the mail
- setup the transport that given by the nodemailer
- transport is a service that use the smtp protocol to send the mail
- initialize the react app by this commond : npm create vite@latest ./
- install tailwind css and configure it.
- React-Router-Dom : for nevigation
- Framer-motion : Animation
- Tailwind css : for css
- zustand : for statemanagement
- Normal ui design you can modify according to you


