Skip to content

MenathNDGD/Employee-Attendance-System-MERN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


Employee Attendance System

reactdotjs javascript html5 css3 nojedotjs expressjs nodemon mongodb

Employee Attendance System - MERN

The Employee Attendance System is a web-based solution designed to track employee attendance and work hours efficiently. Built using React.js, HTML, CSS, and JavaScript for the frontend and powered by Node.js for the backend, it ensures seamless performance and scalability. The system supports MongoDB for secure and reliable data storage. Key features include user authentication and role management, employee check-in and check-out, automated work hour calculation, real-time attendance tracking, and comprehensive reporting with data visualization, making it a powerful tool for workforce management. πŸš€
  1. πŸ€– Introduction
  2. βš™οΈ Tech Stack
  3. πŸ”‹ Features
  4. πŸ“ Folder Structure
  5. 🀸 Quick Start
  6. πŸš€ Usage
  7. πŸ”— API Endpoints
  8. 🐞 Troubleshooting
  9. ✨ Contributing

The Employee Attendance System is built with React.js, Node.js, and MongoDB to track attendance efficiently. Key features include user authentication, role management, check-in/out, automated work hour calculation, real-time tracking, and detailed reports, ensuring seamless workforce management and reducing manual workload.

  • React JS
  • JavaScript
  • HTML5
  • CSS3
  • Node JS
  • Express JS
  • Nodemon
  • MongoDB

Admin Features:

πŸ‘‰ Add, Edit, and Delete Employee Attendance

πŸ‘‰ View All Attendance Records for a Selected User

πŸ‘‰ Monthly Attendance Summary with Present, Absent, and Leave Days

πŸ‘‰ User Management (Add, View, and Update User Details)

πŸ‘‰ Secure Admin Access with Role-Based Authorization

Employee Features:

πŸ‘‰ View Own Attendance Records

πŸ‘‰ Attendance Summary by Month and Year

General Features:

πŸ‘‰ User Authentication (Login, Registration)

πŸ‘‰ Protected Routes using JWT Tokens

πŸ‘‰ Responsive UI for Desktop and Mobile Devices

Employee-Attendance-System-MERN/
β”œβ”€β”€ backend/                            # Backend Directory (Node.js, Express, MongoDB)
β”‚   β”œβ”€β”€ middleware/                     # Express Middlewares
β”‚   β”‚   └── auth.js                     # Authentication Middleware
β”‚   β”œβ”€β”€ models/                         # Mongoose Models
β”‚   β”‚   β”œβ”€β”€ Attendance.js               # User Schema
β”‚   β”‚   └── User.js                     # Attendance Schema
β”‚   β”œβ”€β”€ routes/                         # API Routes
β”‚   β”‚   β”œβ”€β”€ admin.js                    # Admin Routes
β”‚   β”‚   β”œβ”€β”€ attendance.js               # Attendance Routes
β”‚   β”‚   └── auth.js                     # Authentication Routes
β”‚   β”œβ”€β”€ .env.example                    # Examples of Environment Variables
β”‚   β”œβ”€β”€ .env.local                      # Environment Variables for backend
β”‚   └── server.js                       # Express Server Configuration
β”œβ”€β”€ frontend/                           # Frontend Directory (React.js)
β”‚   β”œβ”€β”€ public/                         # Public Assets and Index.html
β”‚   β”œβ”€β”€ src/                            # Source Code Folder
β”‚   β”‚   β”œβ”€β”€ assets/                     # All Project Assets
β”‚   β”‚   β”œβ”€β”€ components/                 # Reusable Components
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.css              # Styles for Navbar Component
β”‚   β”‚   β”‚   └── Navbar.jsx              # Navigation Bar Component
β”‚   β”‚   β”œβ”€β”€ pages/                      # React Pages (Screens)
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboardPage/     # Admin Dashboard for Attendance Management
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboard.css  # CSS Styles for Admin Dashboard
β”‚   β”‚   β”‚   β”‚   └── AdminDashboard.jsx  # Admin Dashboard React Component
β”‚   β”‚   β”‚   β”œβ”€β”€ LoginPage/              # USer Login for Attendance Management
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Login.css           # CSS Styles for User Login
β”‚   β”‚   β”‚   β”‚   └── Login.jsx           # User Login React Component
β”‚   β”‚   β”‚   β”œβ”€β”€ OverviewPage/           # Attendance Details Overview
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Overview.css        # CSS Styles for Attendance Overview
β”‚   β”‚   β”‚   β”‚   └── Overview.jsx        # Attendance Details Overview React Component
β”‚   β”‚   β”‚   └── RegisterPage/           # User Registration Page
β”‚   β”‚   β”‚       β”œβ”€β”€ Register.css        # CSS Styles for User Registration
β”‚   β”‚   β”‚       └── Register.jsx        # User Registration React Component
β”‚   β”‚   β”œβ”€β”€ App.js                      # Main React Component
β”‚   β”‚   β”œβ”€β”€ index.css                   # Global Styles
β”‚   β”‚   └── index.js                    # React DOM Renderer
β”‚   β”œβ”€β”€ package-lock.json               # Packages & Dependencies
β”‚   └── package.json                    # Project Installed Packages & Dependencies
└── nonRelatedAssets/                   # Assets for the GitHub Repo (Non-related to the Project)

Follow these steps to set up the project locally on your machine.

Prerequisites

Make sure you have the following installed on your machine:

Cloning the Repository

git clone https://github.com/MenathNDGD/Employee-Attendance-System-MERN.git
cd Employee-Attendance-System-MERN

Installation

Create a .env.local file in the backend folder

PORT=5000
MONGO_URI=YOUR_MONGO_URI
JWT_SECRET=tu8861sRFQyXDRH

Setup Backend

cd backend
npx nodemon server.js

Setup Frontend

cd frontend
npm start

Open http://localhost:3000 in your browser to view the project.

Admin Login

  • Use the login credentials of an Admin user.
  • Access the Admin Dashboard to manage attendance.

Employee Login

  • Use employee login credentials.
  • View personal attendance records.

Admin Dashboard

  • Select a user and view all attendance records.
  • Add, Edit, or Delete attendance day by day.
  • View monthly summaries for Present, Absent, and Leave days.

Auth Routes

  • POST /api/auth/register: Register a new user
  • POST /api/auth/login: User login

Attendance Routes

  • GET /api/attendance/:userId: Get attendance by user
  • GET /api/attendance/summary/:userId: Get attendance summary by month
  • POST /api/attendance: Add attendance
  • PUT /api/attendance/:id: Update attendance
  • DELETE /api/attendance/:id: Delete attendance

Admin Routes

  • GET /api/admin/users: Get all users
  • PUT /api/admin/user/:id: Update user details

1. MongoDB Connection Error:

  • Ensure your IP is whitelisted in MongoDB Atlas.
  • Double-check your MONGO_URI in the .env.local file.

2. CORS Errors:

  • Check cors() configuration in backend/server.js.

3. Invalid Token Error:

  • Make sure to clear localStorage and log in again:
localStorage.removeItem("token");

1. Fork the repo.

2. Create a new branch:

git checkout -b feature-name

3. Make your changes.

4. Commit your changes:

git commit -m 'Add some feature'

5. Push to the branch:

git push origin feature-name

6. Open a Pull Request.

Feel free to tailor these contents according to your specific preferences or any additional details you want to include!

  • Contributions: Contributions are welcome! Feel free to fork the repository, make changes, and submit a pull request.

  • Feedback: If you have any feedback or suggestions, I would love to hear from you. Reach out via the contact form on the portfolio or open an issue on GitHub.

About

The Employee Attendance System is built with React.js, Node.js, and MongoDB to track attendance efficiently. Key features include user authentication, role management, check-in/out, automated work hour calculation, real-time tracking, and detailed reports, ensuring seamless workforce management and reducing manual workload.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors