Skip to content

This project is a secure authentication system built using the MERN stack (MongoDB, Express.js, React, Node.js). It provides user registration and login functionality, utilizing JWT (JSON Web Tokens) for secure authentication. Designed with a clear folder structure and proper environment variable handling React,Node, Express, MongoDB, and JWT.

Notifications You must be signed in to change notification settings

AdityaGadbail/mern-authentication-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MERN Authentication System πŸ”

A secure and modern full-stack authentication system built using the MERN Stack (MongoDB, Express.js, React.js, Node.js). This project provides robust authentication with JWT, protected routes, and security best practices for real-world production apps.


πŸš€ Features

  • πŸ” JWT (JSON Web Token) Authentication
  • πŸ”„ User Login & Registration with hashed passwords (bcrypt)
  • βœ… Protected Routes for authenticated users only
  • πŸ’Ύ MongoDB with Mongoose for flexible data models
  • βš™οΈ Express.js API with proper middlewares
  • 🌐 React.js Frontend using Context API or Redux
  • πŸ“¦ Node.js Backend with modular route handling
  • πŸ“¬ Error Handling with user-friendly messages
  • 🧠 Token Storage via HTTP-only cookies or localStorage
  • πŸ”„ Auto Login on page refresh (token-based auth)
  • 🚫 Logout Functionality
  • πŸ” Secure headers & CORS enabled

🧱 Tech Stack

Frontend:

  • React.js
  • Axios
  • Tailwind CSS or CSS Modules (if used)
  • React Router DOM

Backend:

  • Node.js
  • Express.js
  • MongoDB (with Mongoose)
  • JSON Web Token (JWT)
  • Bcrypt for password hashing
  • dotenv for environment variables
  • CORS middleware

πŸ› οΈ Installation & Setup

Step 1: Install Dependencies

Install all packages in both client/ and server/ folders:

step 2 : Add .env file

read the .env.example file and create .env file based on the .env.example file

step 3 : For Client - npm run dev

step 4 : For Server - node server.js

About

This project is a secure authentication system built using the MERN stack (MongoDB, Express.js, React, Node.js). It provides user registration and login functionality, utilizing JWT (JSON Web Tokens) for secure authentication. Designed with a clear folder structure and proper environment variable handling React,Node, Express, MongoDB, and JWT.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published