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.
- π 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
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
Install all packages in both client/
and server/
folders:
read the .env.example file and create .env file based on the .env.example file