π Table of Contents
- π€ Introduction
- βοΈ Tech Stack
- π Features
- π Folder Structure
- π€Έ Quick Start
- π Usage
- π API Endpoints
- π Troubleshooting
- β¨ 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
π 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
π View Own Attendance Records
π Attendance Summary by Month and Year
π 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-MERNInstallation
Create a .env.local file in the backend folder
PORT=5000
MONGO_URI=YOUR_MONGO_URI
JWT_SECRET=tu8861sRFQyXDRHSetup Backend
cd backend
npx nodemon server.jsSetup Frontend
cd frontend
npm startOpen http://localhost:3000 in your browser to view the project.
- Use the login credentials of an Admin user.
- Access the Admin Dashboard to manage attendance.
- Use employee login credentials.
- View personal attendance records.
- 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.
- POST
/api/auth/register: Register a new user - POST
/api/auth/login: User login
- 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
- GET
/api/admin/users: Get all users - PUT
/api/admin/user/:id: Update user details
- Ensure your IP is whitelisted in MongoDB Atlas.
- Double-check your
MONGO_URIin the.env.localfile.
- Check
cors()configuration inbackend/server.js.
- Make sure to clear
localStorageand log in again:
localStorage.removeItem("token");git checkout -b feature-namegit commit -m 'Add some feature'git push origin feature-nameFeel 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.