A Role-Based Access Control (RBAC) Dashboard built with the MERN stack (MongoDB, Express.js, React, Node.js) that demonstrates user authentication and authorization.
- 🔐 User Authentication (Login/Register)
- 👥 Role-Based Access Control (Admin/User)
- 👤 User Profile Management
- 🔑 Password Update Functionality
- 📊 Admin Dashboard with User Management
- 🌐 Protected Routes
- 💾 Persistent Auth State
- 🎨 Modern UI Design
- React 19
- Redux Toolkit (State Management)
- React Router v7
- Axios (API calls)
- Vite (Build Tool)
- Node.js
- Express.js
- MongoDB (Database)
- JWT (Authentication)
- Bcrypt (Password Hashing)
Before running this project, make sure you have:
- Node.js (v16 or higher)
- MongoDB installed locally or MongoDB Atlas account
- Git
├── backend/
│ ├── controller/
│ ├── middleware/
│ ├── models/
│ ├── routes/
│ └── server.js
└── frontend/
├── src/
│ ├── actions/
│ ├── api/
│ ├── features/
│ ├── pages/
│ └── App.jsx
└── package.json
- Clone the repository:
git clone https://github.com/jamilahmed2/admin-dashboard-MERN
cd admin-dashboard-MERN
- Install backend dependencies:
cd backend
npm install
- Install frontend dependencies:
cd ../frontend
npm install
- Create .env files:
Backend (.env):
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
Frontend (.env):
VITE_APP_API_URL=backend url
REACT_APP_SERVER_URL=backend url
- Start the backend server:
cd backend
npm run dev
- Start the frontend development server:
cd frontend
npm run dev
npm run both
- Access the application:
- Frontend: http://localhost:5173
- Backend: http://localhost:5000
- POST /api/auth/register - Register new user
- POST /api/auth/login - Login user
- PUT /api/users/update-profile - Update user profile
- PUT /api/users/update-password - Update user password
- GET /api/admin/getAllUsers - Get all users (Admin only)
- DELETE /api/admin/deleteUser/:id - Delete user (Admin only)
- PUT /api/admin/updateAdminProfile - Update admin profile
- PUT /api/admin/updateAdminPassword - Update admin password
- Password Hashing
- JWT Authentication
- Protected Routes
- Role-Based Access
- Input Validation
- Error Handling
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
LinkedIn - https://www.linkedin.com/in/jamil-ahmed-54655220b Project Link: https://github.com/jamilahmed2/admin-dashboard-MERN