AttendEase is a complete, production-ready HR management platform built for small to mid-sized teams. From GPS-based check-ins and leave management to payroll generation and role-based dashboards β everything your team needs in one place.
π Live Demo: employee-attendance-pi.vercel.app
Try the live demo instantly β no signup required.
| Role | Password | |
|---|---|---|
| π¨βπΌ Admin | admin@attendance.com |
admin123 |
| π¨βπ» Employee | Register at /register |
β |
Note: The very first registered user is automatically promoted to Admin. All subsequent registrations become employees and must be managed by the admin.
| Feature | Details |
|---|---|
| Employee Management | Add, edit, deactivate employees; bulk CSV import; auto Employee ID generation |
| Attendance Control | View all attendance records; override status; bulk import; export to Excel/PDF |
| Leave Management | Approve or reject with comments; auto leave balance deduction; attendance sync on approval |
| Payroll Engine | Monthly bulk generation using a formula-based system; edit bonuses; finalize & lock; email payslips |
| Reports & Analytics | Today's stats, monthly bar charts, department pie charts, 6-month trend line, top performers |
| Audit Trail | Every admin action logged with old/new values, IP address, and timestamp |
| Department & Shift Mgmt | Create departments and work shifts with late-arrival thresholds |
| Settings | Configure geo-fence radius, office coordinates, and SMTP email |
| Feature | Details |
|---|---|
| GPS Check-in / Check-out | Location validated via Haversine formula; strict or lenient geo-fence mode |
| Attendance History | Calendar view + monthly attendance table; export personal records |
| Leave Application | Apply for Sick, Casual, Annual, or Unpaid leave; track balance and status |
| Payslip | View monthly salary breakdown; download as PDF |
| Notifications | Real-time bell with 30-second polling; mark as read |
httpOnlyJWT cookie β not accessible via JavaScript- Bcrypt password hashing (12 salt rounds)
- Role-based middleware protecting all routes
- Auto-logout after 7 days (configurable)
- One check-in per calendar day enforced
- Auto checkout after 12 hours if employee forgets
| Layer | Technology | Why |
|---|---|---|
| Framework | Next.js 16 (App Router) | Full-stack β SSR + API routes in one |
| Language | TypeScript 5 (strict) | Catch errors at build time, not runtime |
| Database | MongoDB Atlas + Mongoose v9 | Flexible schema, serverless-friendly |
| Auth | JWT + bcryptjs | Stateless, scalable, secure cookies |
| Styling | Tailwind CSS v4 | Direct CSS imports, zero config |
| Animation | GSAP + framer-motion | Cinematic scroll reveals + micro-animations |
| UI Effects | Magic cursor + Radar | Custom sparkle cursor, radar overview section |
| Charts | Recharts | React-native, lightweight charting |
| Export | SheetJS + jsPDF | Excel and PDF on client and server |
| Nodemailer | SMTP-based, no vendor lock-in | |
| Icons | Lucide React | Consistent, tree-shakeable icon set |
| Deployment | Vercel | Zero-config CI/CD from GitHub |
graph TB
subgraph Client["π₯οΈ Browser / Mobile"]
Home["Landing Page"]
LoginPage["Login / Register"]
AdminUI["Admin Dashboard"]
EmpUI["Employee Panel"]
end
subgraph Middleware["π Next.js Middleware"]
JWT["JWT Token Verify"]
RoleCheck["Role Check\n(admin / employee)"]
end
subgraph API["βοΈ API Routes (Next.js)"]
AuthAPI["/api/auth/*"]
AttendAPI["/api/attendance/*"]
LeaveAPI["/api/leaves/*"]
PayrollAPI["/api/payroll/*"]
ReportAPI["/api/reports/*"]
ExportAPI["/api/export/*"]
NotifAPI["/api/notifications/*"]
AuditAPI["/api/audit-logs/*"]
end
subgraph DB["ποΈ MongoDB Atlas"]
Users[("Users")]
Attendance[("Attendance")]
Leaves[("Leaves")]
Payroll[("Payroll")]
Notifications[("Notifications")]
AuditLogs[("Audit Logs")]
Departments[("Departments")]
Shifts[("Shifts")]
end
subgraph External["π¦ External Services"]
SMTP["SMTP Email"]
GPS["Browser GPS API"]
end
Home --> LoginPage
LoginPage --> AuthAPI
AuthAPI -->|httpOnly JWT cookie| JWT
JWT --> RoleCheck
RoleCheck -->|admin| AdminUI
RoleCheck -->|employee| EmpUI
AdminUI --> AttendAPI & LeaveAPI & PayrollAPI & ReportAPI & ExportAPI & AuditAPI
EmpUI --> AttendAPI & LeaveAPI & NotifAPI
AttendAPI <--> Attendance & Users
LeaveAPI <--> Leaves & Users
PayrollAPI <--> Payroll & Attendance
ReportAPI <--> Attendance & Departments
NotifAPI <--> Notifications
AuditAPI <--> AuditLogs
AuthAPI <--> Users
PayrollAPI -->|payslip email| SMTP
LeaveAPI -->|status email| SMTP
AttendAPI -->|validate location| GPS
erDiagram
USER {
ObjectId _id PK
string name
string email
string password
string role
string employeeId
ObjectId department FK
ObjectId shift FK
number salary
date joiningDate
object leaveBalance
boolean isActive
}
DEPARTMENT {
ObjectId _id PK
string name
string description
ObjectId managerId FK
boolean isActive
}
SHIFT {
ObjectId _id PK
string name
string startTime
string endTime
number workingHours
number lateThresholdMinutes
}
ATTENDANCE {
ObjectId _id PK
ObjectId userId FK
date date
date checkIn
date checkOut
number workingMinutes
string status
string notes
object location
boolean outOfOffice
ObjectId overriddenBy FK
}
LEAVE {
ObjectId _id PK
ObjectId userId FK
string leaveType
date startDate
date endDate
number totalDays
string reason
string status
ObjectId approvedBy FK
string adminComment
}
PAYROLL {
ObjectId _id PK
ObjectId userId FK
number month
number year
number basicSalary
number presentDays
number absentDays
number lateDays
number netSalary
number bonuses
string status
}
NOTIFICATION {
ObjectId _id PK
ObjectId userId FK
string title
string message
string type
boolean isRead
string link
}
AUDITLOG {
ObjectId _id PK
ObjectId performedBy FK
string action
string targetModel
object oldValues
object newValues
string ipAddress
date timestamp
}
USER ||--o{ ATTENDANCE : "marks"
USER ||--o{ LEAVE : "applies"
USER ||--o{ PAYROLL : "receives"
USER ||--o{ NOTIFICATION : "gets"
USER }o--|| DEPARTMENT : "belongs to"
USER }o--|| SHIFT : "assigned"
USER ||--o{ AUDITLOG : "performs"
perDay = basicSalary Γ· 26
absentDeduction = absentDays Γ perDay
lateDeduction = βlateDays Γ· 3β Γ perDay
unpaidDeduction = unpaidLeaveDays Γ perDay
netSalary = basicSalary - absentDeduction - lateDeduction - unpaidDeduction + bonuses
attendance/
β
βββ app/
β βββ (auth)/
β β βββ login/ # Login page with Back to Home
β β βββ register/ # Register β first user auto becomes Admin
β β
β βββ (dashboard)/
β β βββ admin/
β β β βββ page.tsx # Dashboard β stats, charts, overlay loader
β β β βββ employees/ # CRUD + bulk CSV import
β β β βββ attendance/ # View + override + export (mobile responsive)
β β β βββ leaves/ # Approve/reject with overlay ChipLoader
β β β βββ payroll/ # Generate + finalize (mobile responsive)
β β β βββ departments/ # Manage departments
β β β βββ shifts/ # Manage shifts
β β β βββ reports/ # Charts + top performers
β β β βββ audit-logs/ # Full audit trail with filters
β β β βββ settings/ # Geo-fence + SMTP config
β β β
β β βββ employee/
β β βββ page.tsx # Dashboard β check-in, stats, collapsible sidebar
β β βββ attendance/ # Calendar view + monthly history
β β βββ leaves/ # Apply + track + cancel
β β βββ payslip/ # View + PDF download
β β βββ notifications/ # All notifications
β β
β βββ api/
β β βββ auth/ # login, register, logout, me
β β βββ users/ # CRUD + bulk import
β β βββ departments/ # CRUD
β β βββ shifts/ # CRUD
β β βββ attendance/ # checkin, checkout, override, import
β β βββ leaves/ # apply, approve, reject, cancel
β β βββ payroll/ # generate, finalize, update bonuses
β β βββ reports/ # monthly, dept, trend, top-performers
β β βββ export/ # attendance, employees, payslip PDF
β β βββ notifications/ # fetch, mark-read, mark-all-read
β β βββ audit-logs/ # filtered log viewer
β β βββ settings/ # geo-location config
β β
β βββ page.tsx # Landing page β hero + features + radar + cinematic
β βββ layout.tsx # Root layout β MagicCursor, AnimatedBackground
β βββ globals.css # Neumorphic tokens + GSAP keyframes
β
βββ components/
β βββ ui/
β β βββ neu-card.tsx # Neumorphic card system
β β βββ neu-button.tsx # Neumorphic buttons
β β βββ neu-badge.tsx # Status badges
β β βββ neu-toast.tsx # Toast notification system
β β βββ chip-loader.tsx # Branded circuit-board SVG loader
β β βββ magic-cursor.tsx # Global sparkle cursor effect
β β βββ magic-cursor-client.tsx# Client wrapper for SSR compatibility
β β βββ radar-effect.tsx # Radar sweep + floating icons
β β βββ cinematic-hero.tsx # GSAP scroll-pinned cinematic hero
β β βββ animated-background.tsx# Neural particle background
β β βββ flow-field-background.tsx
β β βββ empty-state.tsx
β β
β βββ home/
β β βββ project-radar-section.tsx # AttendEase feature overview with radar
β β
β βββ layout/
β β βββ admin-sidebar.tsx # Collapsible admin sidebar
β β βββ employee-sidebar.tsx # Collapsible employee sidebar
β β βββ header.tsx # Top header with notification bell
β β
β βββ attendance/
β β βββ attendance-table.tsx # Responsive attendance table
β β
β βββ charts/ # Recharts wrappers (Bar, Pie, Line)
β
βββ models/
β βββ User.ts
β βββ Attendance.ts
β βββ Department.ts
β βββ Shift.ts
β βββ Leave.ts
β βββ Payroll.ts
β βββ Notification.ts
β βββ AuditLog.ts
β
βββ lib/
β βββ db.ts # MongoDB connection with cache
β βββ auth.ts # JWT sign + verify (full payload)
β βββ middleware-helpers.ts # getAuthUser, requireAuth, requireAdmin
β βββ email.ts # Nodemailer SMTP setup
β βββ geolocation.ts # Haversine distance formula
β βββ auditLogger.ts # Audit log helper
β βββ SidebarContext.tsx # Sidebar collapse state (localStorage)
β
βββ types/
β βββ index.ts # All TypeScript interfaces & types
β
βββ middleware.ts # Route protection + role-based redirect
βββ next.config.ts
βββ tsconfig.json
βββ .env.local # Environment variables (never commit)
- Node.js 18+ (LTS)
- MongoDB Atlas free tier account
- Gmail account with App Password enabled (for SMTP)
git clone https://github.com/Konete326/Employee-Attendance.git
cd Employee-Attendancenpm install# Database
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/attendease
# Authentication
JWT_SECRET=your_minimum_32_character_random_secret_here
JWT_EXPIRES_IN=7d
# Email (Gmail SMTP)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_gmail_app_password
# Application URL
NEXT_PUBLIC_APP_URL=http://localhost:3000
# Office Geo-location (set your office coordinates)
OFFICE_LAT=24.8607
OFFICE_LNG=67.0011
OFFICE_RADIUS_METERS=100npm run devOpen http://localhost:3000 in your browser.
Navigate to /register β the first user automatically becomes Admin. After that, only the Admin can add new employees from the dashboard.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/login |
Public | Login β sets httpOnly JWT cookie |
POST |
/api/auth/register |
Public | First user only β auto Admin |
GET |
/api/auth/me |
Any | Get current user info |
POST |
/api/auth/logout |
Any | Clear JWT cookie |
GET |
/api/users |
Admin | List all employees |
POST |
/api/users |
Admin | Create new employee |
PUT |
/api/users/[id] |
Admin | Update employee details |
POST |
/api/attendance/checkin |
Employee | GPS-validated check-in |
POST |
/api/attendance/checkout |
Employee | Check-out |
PUT |
/api/attendance/[id] |
Admin | Override attendance status |
POST |
/api/leaves/apply |
Employee | Submit leave request |
PUT |
/api/leaves/[id]/approve |
Admin | Approve leave |
PUT |
/api/leaves/[id]/reject |
Admin | Reject leave with comment |
POST |
/api/payroll |
Admin | Generate monthly payroll |
PATCH |
/api/payroll/[id] |
Admin | Finalize payroll record |
GET |
/api/reports/top-performers |
Admin | Top attendance performers |
GET |
/api/export/attendance |
Admin | Export attendance to Excel |
GET |
/api/export/payslip/[id] |
Admin | Download payslip PDF |
GET |
/api/audit-logs |
Admin | Paginated audit trail |
GET |
/api/notifications |
Any | Fetch notifications |
PATCH |
/api/notifications/[id] |
Any | Mark notification as read |
npm run dev # Start dev server β http://localhost:3000
npm run build # Production build (Turbopack)
npm run start # Start production server
npm run lint # ESLint checkAttendEase uses a custom Neumorphic design system built entirely with CSS variables:
| Token | Purpose |
|---|---|
--neu-bg |
Page background (#1a1a2e) |
--neu-surface |
Card surface |
--neu-accent |
Primary accent (#818cf8 β indigo) |
--neu-shadow-dark |
Neumorphic dark shadow |
--neu-shadow-light |
Neumorphic light shadow |
--neu-text |
Primary text |
--neu-text-secondary |
Secondary/muted text |
Animations:
ChipLoaderβ circuit-board SVG animation for all loading statesMagicCursorβ global indigo sparkle trail following the cursorGSAP ScrollTriggerβ cinematic 7-second scroll-pinned hero revealframer-motionβ radar pulse + floating icon animations
AttendEase is deployed on Vercel with automatic deployments on every git push to main.
Environment variables must be set in the Vercel dashboard under Project β Settings β Environment Variables.