https://github.com/hailex798/fullstack-intern
Welcome to the User Management System, a full-stack web application built using the MERN Stack (MongoDB, Express.js, React.js, Node.js).
https://github.com/hailex798/fullstack-intern
axios bycrypt context-api express mongodb nodejs react reactjs tailwindcss
Last synced: about 2 months ago
JSON representation
Welcome to the User Management System, a full-stack web application built using the MERN Stack (MongoDB, Express.js, React.js, Node.js).
- Host: GitHub
- URL: https://github.com/hailex798/fullstack-intern
- Owner: Hailex798
- Created: 2024-12-09T15:42:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-10T11:44:23.000Z (over 1 year ago)
- Last Synced: 2025-02-14T07:51:22.445Z (over 1 year ago)
- Topics: axios, bycrypt, context-api, express, mongodb, nodejs, react, reactjs, tailwindcss
- Language: JavaScript
- Homepage: https://fullstackintern.vercel.app/
- Size: 5.38 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ **User Management System** - MERN Stack Assignment
[](https://fullstackintern.vercel.app/)
[](https://github.com/Hailex798/FullStack-Intern)
### **๐ Overview**
Welcome to the **User Management System**, a full-stack web application built using the **MERN Stack** (MongoDB, Express.js, React.js, Node.js).
This project showcases:
๐ **Authentication** - Login/Signup functionality with secure JWT-based authentication.
๐ฏ **Role-Based Access Control** - Specific user privileges for **Admins**, **Agents**, and **Users**.
๐ **Context API** - For managing user data efficiently in local browser storage.
---
## **๐ Assignment**
The Assignment was provided in a Google Docs file, where the frontend Code was also provided.

---
## โจ **Features**
### ๐ **Authentication**
- **Sign-up** ๐: Users can create accounts with their name, email, and password.
- Default role: **Admin**.
- No duplicate emails allowed!
- **Login** โ
: Access your account securely with your credentials.
- User role is displayed in the header.
### ๐ **Role-Based Access Control**
Depending on their role, users have access to different functionalities:
- **๐ Admin**:
- Can create both **Agents** and **Users**.
- Full access to the **User Management** module.
- **๐ ๏ธ Agent**:
- Can create **Users** only.
- Limited access to the **User Management** module.
- **๐โโ๏ธ User**:
- No access to User Management.
- Redirected to a "Restricted Access" page when attempting unauthorized actions.
---
## ๐จ **Visual Overview**
Below are visual previews of the applicationโs various pages and features. Click on the dropdown arrows to view the corresponding screenshots.
*Visit the [Live Site](https://fullstackintern.vercel.app/) for a full experience!* ๐
## Login Page

---
## Login Successful

---
## MongoDB User Credentials Data

๐ Authentication (Click to Expand)
- A SignUp Page for creating User Credentials.
## SignUp Page

---
## SignUp Successful Page

๐ Admin (Click to Expand)
- Admin LoggedIn Dashboard + User Management
## Admin Page User Management

---
## Admin Page User Management Agent ID Creation

---
## Admin Page User Management User ID Creation

๐ User (Click to Expand)
- User LoggedIn Dashboard + User Management
## User Page

---
## User Page User Management

---
## User Page User Settings

---
## ๐๏ธ **How It Works**
### **Authentication Flow**
1. **Sign-Up**:
- User enters name, email, and password.
- Data is sent to the backend and stored securely in MongoDB.
2. **Login**:
- Credentials are validated, and a JWT is issued.
- The token is stored in the browser (Context API).
3. **Protected Routes**:
- Based on the user's role, access is granted or restricted.
---
## ๐ ๏ธ **Tech Stack**
### **Frontend**
- **React.js** โ๏ธ
- **Tailwind CSS** ๐จ
- **React Router** ๐ - For navigation and protected routing.
- **Context API** ๐ฆ - For storing user data securely in local browser storage.
### **Backend**
- **Node.js** ๐ณ
- **Express.js** ๐ค๏ธ
- **MongoDB** ๐ - For database management.
- **JWT (JSON Web Tokens)** ๐ - For authentication and role-based authorization.
- **bcrypt.js** ๐ - For password hashing.
### **Build & Tools**
- **Vite** โก - Blazing fast build tool for frontend.
- **Axios** ๐ - For seamless API calls.
- **dotenv** ๐ก๏ธ - For managing environment variables.
---
## ๐๏ธ **Folder Structure**
Organized for scalability and maintainability:
### Project Structure

```
User-Management/
โโโ backend/
โ โโโ config/ # Database connection setup
โ โโโ controllers/ # Business logic for routes
โ โโโ middlewares/ # JWT and role-based auth checks
โ โโโ models/ # MongoDB schemas
โ โโโ routes/ # API endpoints
โ โโโ server.js # Entry point for the backend
โโโ client/
โ โโโ public/ # Static assets
โ โโโ src/
โ โ โโโ components/ # Reusable UI components
โ โ โโโ pages/ # Page-level components
โ โ โโโ App.js # Main app component
โ โ โโโ index.js # React entry point
โโโ README.md
```
---
## ๐ **Setup Instructions**
1. **Clone the Repository** ๐
```bash
git clone https://github.com/your-repo-url.git
cd User-Management
```
2. **Install Dependencies** ๐ ๏ธ
- Backend:
```bash
cd backend
npm install
```
- Frontend:
```bash
cd client
npm install
```
3. **Configure Environment Variables** ๐
- In the `backend` directory, create a `.env` file with:
```
MONGO_URI=
JWT_SECRET=
```
4. **Start the Servers** ๐ฅ๏ธ
- Backend:
```bash
cd backend
npm start
```
- Frontend:
```bash
cd client
npm run dev
```
5. **Access the Application** ๐
Open `http://localhost:5173` in your browser.
---
## ๐ฎ **Future Enhancements**
- Add **Forgot Password** and **Reset Password** functionality.
- Improve the UI for better user experience.
- Add analytics for Admins to monitor system usage.
---
## ๐ **Conclusion**
This project is a testament to the power of the MERN stack, demonstrating how to integrate frontend and backend for seamless functionality. With role-based access, it offers a secure and scalable solution for user management.
---
Let me know if you'd like any other tweaks! ๐