- User login and signup.
- Email verification via OTP.
- Password reset functionality via email OTP.
- Clone the repository:
git clone https://github.com/shozabali06/User-Authentication-MERN.git
- Navigate to the project directory:
cd User-Authentication-MERN
- Navigate to the server folder:
cd server
- Install dependencies:
npm install
-
Configure environment variables: Create a
.env
file in theserver
folder and add the following:MONGODB_URI=<your-mongodb-connection-string> JWT_SECRET=<your-jwt-secret> NODE_ENV=development # or production SMTP_USER=<your-smtp-username> SMTP_PASS=<your-smtp-password> SENDER_EMAIL=<your-sender-email> PORT=3000 # optional, defaults to 3000 ORIGIN=<url-for-client-side>
-
Start the server:
npm run server
- Navigate to the client folder:
cd client
- Install dependencies:
npm install
-
Configure environment variables: Create a
.env
file in theclient
folder and add the following:VITE_BACKEND_URL=<url-for-server-side>
-
Start the client:
npm run dev
- Install dependencies:
npm install
- Run the server:
npm run server
- Install dependencies:
npm install
- Run the client:
npm run dev
MONGODB_URI
: MongoDB connection string.JWT_SECRET
: Secret key for JSON Web Token.NODE_ENV
:development
orproduction
.SMTP_USER
: SMTP username for email service.SMTP_PASS
: SMTP password for email service.SENDER_EMAIL
: Email address used to send OTPs.PORT
: (Optional) Server port, defaults to3000
.ORIGIN
: URL of the client application.
VITE_BACKEND_URL
: URL of the server application.
Feel free to reach out for further assistance or feature suggestions!