Skip to content

A secure user authentication system built with the MERN stack, featuring user login/signup, email verification via OTP, and password reset functionality using email OTP. Includes separate client and server setups with environment-specific configurations.

Notifications You must be signed in to change notification settings

shozabali06/User-Authentication-MERN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MERN User Authentication System

Live Demo

Click here to see live demo

Features

  • User login and signup.
  • Email verification via OTP.
  • Password reset functionality via email OTP.

Installation Instructions

  1. Clone the repository:
git clone https://github.com/shozabali06/User-Authentication-MERN.git
  1. Navigate to the project directory:
cd User-Authentication-MERN

Server Setup

  1. Navigate to the server folder:
cd server
  1. Install dependencies:
npm install
  1. Configure environment variables: Create a .env file in the server 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>
  2. Start the server:

npm run server

Client Setup

  1. Navigate to the client folder:
cd client
  1. Install dependencies:
npm install
  1. Configure environment variables: Create a .env file in the client folder and add the following:

    VITE_BACKEND_URL=<url-for-server-side>
  2. Start the client:

npm run dev

Commands Summary

Server Commands

  • Install dependencies: npm install
  • Run the server: npm run server

Client Commands

  • Install dependencies: npm install
  • Run the client: npm run dev

Environment Variables Summary

Server Folder

  • MONGODB_URI: MongoDB connection string.
  • JWT_SECRET: Secret key for JSON Web Token.
  • NODE_ENV: development or production.
  • 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 to 3000.
  • ORIGIN: URL of the client application.

Client Folder

  • VITE_BACKEND_URL: URL of the server application.

Feel free to reach out for further assistance or feature suggestions!

About

A secure user authentication system built with the MERN stack, featuring user login/signup, email verification via OTP, and password reset functionality using email OTP. Includes separate client and server setups with environment-specific configurations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages