A full-stack web application for managing employee tasks and administrative operations. The system features role-based authentication, task management, and real-time status tracking.
- User registration with role selection (Admin/Employee)
- Secure login with JWT authentication
- Role-based access control
- Create and assign tasks to employees
- View all employees and their task statistics
- Monitor task completion rates
- Real-time task status updates
- View assigned tasks
- Update task status (Complete/Failed)
- Track personal task statistics
- Real-time task count updates
- React.js with Vite
- React Router for navigation
- Tailwind CSS for styling
- Axios for API calls
- JWT for authentication
- Node.js
- Express.js
- MongoDB with Mongoose
- JWT for authentication
- Bcrypt for password hashing
- CORS for cross-origin requests
- bash
- cd Backend
- npm init -y
Create a .env
file in the Backend directory with:
- MONGO_URI=your_mongodb_connection_string
- JWT_SECRET=your_jwt_secret
- PORT=4000
- bash
- cd ems
- npm install
- bash
- cd Backend
- node index.js
- bash
- cd ems
- npm run dev
POST /api/auth/register
- Register new userPOST /api/auth/login
- User loginGET /api/auth/admin
- Admin protected routeGET /api/auth/user
- User protected route
POST /api/auth/user/assigne
- Create new taskPATCH /api/auth/user/updateTaskStatus/:taskId
- Update task statusGET /api/auth/user/AllEmployees
- Get all employees and their tasks
The system uses JWT (JSON Web Tokens) for authentication. Tokens are stored in localStorage and included in the Authorization header for protected routes.
- name (String, required)
- email (String, required, unique)
- password (String, required)
- role (String, enum: ["user", "admin"])
- firstName (String, required)
- lastName (String)
- email (String, required, unique)
- userId (ObjectId, ref: "User")
- tasks (Array of ObjectId, ref: "Task")
- taskCounts (Object containing task statistics)
- active (Boolean)
- newTask (Boolean)
- completed (Boolean)
- failed (Boolean)
- taskTitle (String, required)
- taskDescription (String, required)
- taskDate (Date, required)
- category (String, required)
- assignee (ObjectId, ref: "Employee")
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.