Skip to content

Latest commit

 

History

History
177 lines (142 loc) · 4.18 KB

File metadata and controls

177 lines (142 loc) · 4.18 KB

Employee Attendance Management System

A modern web application built with Next.js 14, TypeScript, Prisma, and SQL Server for managing employee attendance with geo-fencing capabilities.

Features

Authentication

  • Secure login and registration system
  • Role-based access control (Admin and Employee)
  • Password change functionality
  • Geo-fencing for location-based access
  • Biometric registration on android, ios, and windows

Employee Features

  • Check-in and check-out functionality
  • Check-in and check-out functionality via biometrics
  • View personal attendance history
  • Monthly attendance overview
  • Weekly hours visualization
  • Personal profile management

Admin Features

  • View all employee attendance records
  • Real-time attendance monitoring
  • Employee attendance reports
  • Export attendance data to CSV
  • Admin dashboard with statistics

Dashboard Analytics

  • Present/Late/Absent statistics
  • Monthly attendance charts
  • Weekly hours tracking
  • Attendance rate calculations

Technology Stack

  • Frontend: Next.js 15, TypeScript, Tailwind CSS
  • UI Components: shadcn/ui
  • Backend: Next.js API Routes
  • Database: SQL Server
  • ORM: Prisma
  • Authentication: JWT (jose)
  • Charts: Recharts
  • Styling: Tailwind CSS

Prerequisites

  • Node.js 18.x or higher
  • SQL Server
  • npm or yarn

Installation

  1. Clone the repository:
git clone KabiruH/attendance_project
cd employee-attendance-system
  1. Install dependencies:
npm install
  1. Set up environment variables:
DATABASE_URL="sqlserver://server:port;database=ATTENDANCEDB;user=username;password=password;trustServerCertificate=true"
JWT_SECRET="your-jwt-secret"
  1. Run Prisma migrations:
npx prisma migrate dev
  1. Start the development server:
npm run dev

Project Structure

src/
├── app/
│   ├── (auth)/
│   │   ├── login/
│   │   └── register/
│   ├── (dashboard)/
│   │   ├── dashboard/
│   │   ├── attendance/
│   │   ├── reports/
│   │   └── profile/
│   └── api/
│       ├── auth/
│       └── attendance/
├── components/
│   ├── ui/
│   ├── dashboard/
│   └── reports/
├── lib/
│   ├── db/
│   ├── auth.ts
│   └── geofence.ts
└── types/

Database Schema

model Employees {
  id         Int          @id @default(autoincrement())
  name       String?      @db.VarChar(100)
  email      String       @unique @db.VarChar(100)
  role       String?      @default("Employee") @db.VarChar(10)
  password   String       @db.VarChar(255)
  created_at DateTime?    @default(now())
  Attendance Attendance[]
}

model Attendance {
  id             Int       @id @default(autoincrement())
  employee_id    Int
  date           DateTime  @db.Date
  check_in_time  DateTime?
  check_out_time DateTime?
  status         String    @default("Absent") @db.VarChar(10)
  Employees      Employees @relation(fields: [employee_id], references: [id])
}

API Endpoints

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration
  • POST /api/auth/logout - User logout
  • GET /api/auth/check - Check authentication status
  • POST /api/auth/change-password - Change user password

Attendance

  • GET /api/attendance - Get attendance records
  • POST /api/attendance - Create attendance record
  • GET /api/attendance/status - Get attendance status

Security Features

  • Password hashing with bcrypt
  • JWT-based authentication
  • Geo-fencing for location-based access
  • Role-based access control
  • Protected API routes
  • Input validation and sanitization

Contributing

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Submit a pull request

License

Optimum Limited

Support

For support, please contact the email in this profile.

Acknowledgments

Would you like me to expand on any particular section or add more details?