MERN-Authentication-sys
├── LICENSE
├── README.md
├── backend
│ ├── Controllers
│ │ └── AuthController.js
│ ├── Middlewares
│ │ ├── Auth.js
│ │ └── AuthValidation.js
│ ├── Models
│ │ ├── User.js
│ │ └── db.js
│ ├── Routes
│ │ ├── AuthRouter.js
│ │ └── ProductRouter.js
│ ├── index.js
│ ├── package-lock.json
│ └── package.json
├── frontend
├── README.md
├── package-lock.json
├── package.json
├── public
│ ├── favicon.ico
│ ├── index.html
│ ├── logo192.png
│ ├── logo512.png
│ ├── manifest.json
│ └── robots.txt
└── src
├── App.css
├── App.js
├── App.test.js
├── RefreshHandler.js
├── index.css
├── index.js
├── logo.svg
├── pages
│ ├── Home.js
│ ├── Login.js
│ └── Signup.js
├── reportWebVitals.js
├── setupTests.js
└── utils.js
- Project Name:
FULL-STACK AUTHENTICATION SYSTEM - Description: Web app with full-stack authentication using the
MERN stack. - Purpose: Secure user authentication with role-based access control.
- Frontend: React.js (Hosted on Vercel)
- Backend: Node.js with Express.js (Hosted on Render)
- Database: MongoDB (User data storage)
- Frontend:
- React Components: Login, Register, Dashboard, Admin Panel
- State Management: Context API/Redux
- Routing: React Router
- Backend:
- Express Routes: Auth routes, protected routes
- Middleware: JWT verification, Role-based authorization
- Database:
- User Schema: User data including roles
- User Registration:
- Frontend sends POST request to
/auth/signup - Backend hashes password, saves user in MongoDB, responds with success/error
- Frontend sends POST request to
- User Login:
- Frontend sends POST request to
/auth/login - Backend verifies credentials, generates JWT, responds with token and role
- Frontend stores token and role
- MindMap to avoid JWT TOKEN Spoofing
- ChatGpt Response : Click to View
- Frontend sends POST request to
- Protected Routes:
- Frontend checks JWT token, sends with requests
- Backend verifies token, checks user role, allows/denies access
- User Schema and signup/login endpoints:
- How to start locally:

