Skip to content

This project demonstrates a robust user authentication system using the MERN stack (MongoDB, Express.js, React.js, Node.js). It includes features such as user registration, login, and secure access to protected route

Notifications You must be signed in to change notification settings

Sadanand1256/-User-Authentication-in-MERN-Stack-main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

User Authentication in MERN Stack

This project demonstrates a robust user authentication system using the MERN stack (MongoDB, Express.js, React.js, Node.js). It includes features such as user registration, login, and secure access to protected routes.

Table of Contents

Features

  • User Registration: New users can create an account.
  • User Login: Existing users can log in to access protected resources.
  • JWT Authentication: Secure user sessions using JSON Web Tokens.
  • Protected Routes: Restrict access to certain routes based on authentication status.
  • Password Hashing: Secure user passwords with bcrypt.

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

Ensure you have the following installed:

  • Node.js
  • MongoDB
  • npm (Node Package Manager) or yarn

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/User-Authentication-in-MERN-Stack.git
  2. Navigate to the project directory:

    cd User-Authentication-in-MERN-Stack
  3. Install server-side dependencies:

    cd server
    npm install
  4. Install client-side dependencies:

    cd ../client
    npm install

Usage

  1. Start MongoDB server:

    mongod
  2. Start the backend server:

    cd server
    npm start
  3. Start the frontend server:

    cd ../client
    npm start
  4. Open your browser and navigate to http://localhost:3000.

Folder Structure

User-Authentication-in-MERN-Stack/
├── client/                 # React frontend
│   ├── public/             # Public assets
│   └── src/                # Source files
│       ├── components/     # React components
│       ├── pages/          # React pages
│       ├── services/       # API services
│       └── App.js          # Main React component
├── server/                 # Express backend
│   ├── config/             # Configuration files
│   ├── controllers/        # Route controllers
│   ├── models/             # Mongoose models
│   ├── routes/             # Express routes
│   └── server.js           # Entry point
└── README.md               # This file

About

This project demonstrates a robust user authentication system using the MERN stack (MongoDB, Express.js, React.js, Node.js). It includes features such as user registration, login, and secure access to protected route

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages