[Mã code 91651]

Source code phần mềm quản lý nhân sự bản web - HRM - Human Resources Management

  (1 Đánh giá)
  0       23    

HRM System: Employee, Attendance, Leave, Payroll | Next.js 16 + TypeScript + Prisma | JWT Auth + RBAC

Danh mục
Thể loại
Ngày đăng
08-4-2026
Loại file
Full code
File download
 .rar [ MB]
CAM KẾT TỪ NGƯỜI BÁN
Code đầy đủ có thể phát triển thêm trong tương lai
Hỗ trợ cài đặt, vào mục help ở demo
Có chức năng báo cáo thống kê
Hỗ trợ phát triển trong tương lai


Source code
1

Đánh giá (1)
5/5

Ngày tham gia
19/10/2022

Cervo HRM - Human Resource Management System

HRM,source,Management,phan mem hrm HRM,source,Management,phan mem hrm HRM,source,Management,phan mem hrm HRM,source,Management,phan mem hrm

Cervo HRM is a comprehensive, enterprise-grade Human Resource Management System built with modern technologies.


🎯 Overview

Cervo HRM is a complete HR management solution featuring:

  • Employee Management - Full CRUD with import/export capabilities
     
  • Attendance Tracking - GPS & IP-based check-in/out with approval workflow
     
  • Leave Management - Request, approve, and balance tracking
     
  • Payroll Processing - Automated calculations with payslip generation
     
  • Role-Based Access Control - Granular permissions per role
     
  • Audit Logging - Complete activity tracking
     
  • Multi-Company Support - Manage multiple organizations

✨ Features

Core Modules

Module Features
Dashboard Real-time statistics, quick actions, recent activity
Employees Directory, profiles, contracts, bank accounts, CSV import
Departments Organization structure, head/manager assignment
Attendance Check-in/out, GPS tracking, IP validation, admin view
Leave Request workflow, approval system, balance tracking
Payroll Run management, auto-calculation, payslip generation
Reports Headcount, leave summary, payroll reports, CSV export
Notifications In-app alerts, broadcast announcements
Audit Log Complete activity trail
Support Tickets Issue tracking and resolution

Role-Based Access Control

Role Capabilities
ADMIN Full system access
EXECUTIVE Company-level management
HR HR operations, payroll, employees
MANAGER Department management, leave approval
USER Personal data, leave requests

🔑 Demo Credentials

After running the seed script, use these accounts:

Role Email Password
Admin admin@cervo.com password123
HR hr@cervo.com password123
Manager manager@cervo.com password123
Employee employee@cervo.com password123

🚀 Quick Start

Prerequisites

  • Node.js 18+
  • PostgreSQL 15+ or SQLite
  • npm/yarn/pnpm

Installation

# 1. Download the repository
# extract cervo.zip
# go to cervo-main folder

cd cervo

# 2. Install dependencies
npm install

# 3. Set up environment
cp .env.example .env
# Edit .env with your database URL

# 4. Initialize database
npx prisma generate
npx prisma db push

# 5. Seed demo data
npm run seed

# 6. Start development server
npm run dev

Open http://localhost:3000 in your browser.


📁 Project Structure

cervo/
├── prisma/
│   ├── schema.prisma      # Database schema
│   ├── migrations/        # Database migrations
│   └── seed.ts            # Demo data seeder
├── src/
│   ├── actions/          # Server Actions (API)
│   │   ├── auth.ts       # Authentication
│   │   ├── employees.ts  # Employee management
│   │   ├── departments.ts
│   │   ├── leave.ts      # Leave management
│   │   ├── attendance.ts # Attendance tracking
│   │   ├── payroll.ts    # Payroll processing
│   │   ├── notifications.ts
│   │   └── reports.ts
│   ├── app/              # Next.js App Router
│   │   ├── (auth)/       # Login, Register
│   │   ├── employees/    # Employee pages
│   │   ├── departments/  # Department pages
│   │   ├── leave/        # Leave pages
│   │   ├── attendance/   # Attendance pages
│   │   ├── payroll/      # Payroll pages
│   │   └── ...
│   ├── components/       # React components
│   │   └── ui/          # UI primitives
│   └── lib/              # Utilities
│       ├── authz.ts      # RBAC permissions
│       ├── session.ts    # JWT session
│       └── prisma.ts    # Database client
└── public/              # Static assets

🛠️ Technology Stack

Category Technology
Framework Next.js 16 (App Router)
Language TypeScript 5
Database PostgreSQL / SQLite
ORM Prisma 7
Auth JWT (jose) + bcrypt
Styling Tailwind CSS
Icons Material Symbols

📖 Documentation

READ HERE


🔐 Security Features

  • JWT-based session management
  • Password hashing with bcrypt
  • Role-based access control (RBAC)
  • Audit logging for all actions
  • Protected routes via middleware
  • Input validation on all forms
  • Prisma ORM (SQL injection prevention)

📊 Database Models

18 complete models with proper relations and indexes:

Company ←→ Department ←→ Employee ←→ User
    ↓
LeaveType ←→ LeaveBalance
    ↓
LeaveRequest ←→ LeaveApproval
    ↓
AttendanceRecord ←→ AttendanceApproval
    ↓
PayrollRun ←→ PayrollItem ←→ Payslip
    ↓
Notification, AuditLog, Ticket

🌐 Deployment

Vercel (Recommended)

  1. Push to GitHub
  2. Connect to Vercel
  3. Set environment variables
  4. Deploy

Railway / Render

  1. Create PostgreSQL database
  2. Set DATABASE_URL environment variable
  3. Deploy with npm run build && npm start

Docker

FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npx prisma generate
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]

 

 


XEM THÊM ==> Hướng dẫn cài đặt chi tiết

HÌNH ẢNH DEMO


HRM,source,Management,phan mem hrm

HRM,source,Management,phan mem hrm

HRM,source,Management,phan mem hrm


HƯỚNG DẪN CÀI ĐẶT

Cervo HRM - Installation Guide

This guide covers complete installation of Cervo HRM on your local machine or server.


Prerequisites

Required Software

Software Version Download
Node.js 18+ nodejs.org
npm/yarn/pnpm Latest Comes with Node.js
PostgreSQL 15+ postgresql.org

Alternative: You can use SQLite for development (no installation required).


Step 1: Clone Repository

git clone <cervo git>
cd cervo


Step 2: Install Dependencies

npm install

Or with yarn/pnpm:

yarn install
# or
pnpm install

Step 3: Configure Environment

Option A: PostgreSQL (Production)

  1. Create a PostgreSQL database:
CREATE DATABASE cervo_hrm;
CREATE USER cervo_user WITH ENCRYPTED PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE cervo_hrm TO cervo_user;
  1. Create .env file:
cp .env.example .env
  1. Edit .env:
DATABASE_URL="postgresql://cervo_user:your_password@localhost:5432/cervo_hrm"
SESSION_SECRET="your-super-secret-session-key-min-32-chars"

Option B: SQLite (Development Only)

  1. Edit .env:
DATABASE_URL="file:./dev.db"
SESSION_SECRET="dev-secret-key-for-local-development-only"
  1. Update prisma/schema.prisma:
datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

Step 4: Generate Prisma Client

npx prisma generate

This generates the Prisma client based on your schema.


Step 5: Create Database Tables

npx prisma db push

This creates all tables in your database.


Step 6: Seed Demo Data (Optional)

npm run seed

This creates:

  • 1 Company (Cervo Global)
  • 3 Departments (Engineering, HR, Marketing)
  • 4 Users (Admin, HR, Manager, Employee)
  • 7 Employees
  • Leave Types & Balances
  • Sample Payroll Run

Step 7: Start Development Server

npm run dev

The app will be available at http://localhost:3000.


Verification Checklist

After installation, verify:

  • Homepage loads without errors
  • Login with demo credentials works
  • Dashboard displays statistics
  • Can navigate to Employees, Leave, Attendance pages
  • No console errors in browser DevTools

Common Issues

Issue: "Cannot find module '@prisma/client'"

Solution:

npx prisma generate
npm install

Issue: "Connection refused to database"

Solution:

  1. Verify PostgreSQL is running
  2. Check DATABASE_URL in .env
  3. Ensure database exists

Issue: "Migration failed"

Solution:

npx prisma db push --force-reset

⚠️ This will delete all data!

Issue: "Port 3000 already in use"

Solution:

PORT=3001 npm run dev

Development Commands

Command Description
npm run dev Start development server
npm run build Build for production
npm run start Start production server
npm run lint Run ESLint
npx prisma studio Open Prisma database GUI
npx prisma db push Sync schema to database
npx prisma migrate dev Run migrations (creates tables)
npm run seed Seed demo data

Production Build

# Build the application
npm run build

# Start production server
npm run start

Docker Setup (Optional)

Dockerfile

FROM node:18-alpine AS builder

WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npx prisma generate
RUN npm run build

FROM node:18-alpine AS runner
WORKDIR /app
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./
COPY --from=builder /app/prisma ./prisma
ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "server.js"]

Docker Compose

version: '3.8'
services:
  app:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgresql://user:pass@db:5432/cervo
    depends_on:
      - db
  db:
    image: postgres:15-alpine
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=pass
      - POSTGRES_DB=cervo
    volumes:
      - postgres_data:/var/lib/postgresql/data
volumes:
  postgres_data:

 




Nguồn: Topcode.vn

BÌNH LUẬN (0)


ĐÁNH GIÁ (1)

ĐIỂM TRUNG BÌNH

5
1 Đánh giá
Code rất tốt (1)
Code tốt (0)
Code rất hay (0)
Code hay (0)
Bình thường (0)
Thành viên
Nội dung đánh giá
17:00 - 8/4/2026
Code rất tốt
Code rất tốt và phù hợp để phát triển
HỖ TRỢ TRỰC TUYẾN