DEV Community

Ijas Ahammed
Ijas Ahammed

Posted on

Understanding HR Domain

What We'll Cover

Before diving into architecture and code, we need to gain a deep understanding of the HR domain. In this post, I'll break down the six core HR processes that every modern HR Management System must handle:

  1. Recruitment & Hiring
  2. Employee Onboarding
  3. Attendance & Time Tracking
  4. Leave Management
  5. Payroll Processing
  6. Performance Management

By the end, you'll have a clear mental model of how these processes work and their key challenges.

Why Domain Understanding Matters

Before I learned this: I thought I could jump straight into designing microservices. Big mistake! Without understanding the domain, you'll:

  • Miss critical features
  • Create wrong service boundaries (Split services wrongly)
  • Build systems that don't match real-world workflows
  • Struggle with naming and consistency

The Truth

60% of system design is understanding the problem.

40% is implementing the technical solution.


1️⃣ Recruitment & Hiring

The Workflow

Step Process
1 πŸ“„ Job Requisition
2 πŸ“’ Job Posting
3 πŸ“₯ Applications Received
4 πŸ” Screening
5 πŸ—£οΈ Interviews
6 πŸ“‘ Offer
7 βœ… Acceptance
8 πŸš€ Onboarding

The process begins with Job Requisition, where a department identifies the need for a new hire and gets approval to fill the position.

Next, the role is shared publicly during Job Posting, allowing potential candidates to learn about the opportunity and apply.

Once applications come in, they are collected under Applications Received, creating a pool of interested candidates.

During Screening, resumes and applications are reviewed to shortlist candidates who best match the job requirements.

Shortlisted candidates move to Interviews, where their skills, experience, and fit for the role are evaluated through discussions.

After interviews, a selected candidate receives an Offer, which includes job details such as role, salary, and joining date.

If the candidate agrees, Acceptance confirms their decision to join the organisation.

Finally, Onboarding helps the new employee settle in through documentation, training, and introductions to the team.

Key Components

Stakeholders

  • Hiring Manager β€” Initiates and owns the job requisition.
  • Recruiter β€” Manages the end-to-end recruitment process.
  • Interview Panel β€” Assesses candidate skills, experience, and suitability.
  • HR Administrator β€” Handles final approvals and employment formalities.

Critical Features

Feature Description Complexity
Job Posting Publish job openings across multiple platforms like the company website and job portals Medium
Application Tracking Track and manage candidates through different hiring stages High
Interview Scheduling Schedule interviews using calendar integration and meeting rooms Medium
Candidate Scoring Collect and compare interviewer feedback using standard forms Medium
Offer Management Create offers, manage approvals, and collect digital signatures High

Business Rules

  1. Approval Before Posting

    Every job requisition must receive budget and management approval before it can be published.

  2. Minimum Candidate Screening

    A defined minimum number of candidates must be screened to ensure fair and competitive selection.

  3. Mandatory Interview Feedback

    All interview panel members must submit feedback before a hiring decision can be made.

  4. Offer Validity Period

    Job offers are valid only for a fixed time frame (usually 7–15 days) after which they expire automatically.

  5. Background Verification Required

    Final hiring confirmation is completed only after successful background and document verification.

Real-World Challenge

Scenario:

A single candidate may apply for multiple job openings using the same or different details, leading to duplicate records.

Solution:

Create a centralised candidate profile using a unique identifier (such as email or phone number). Each candidate has one master profile in the system. Multiple job applications are linked to the same profile.


2️⃣ Employee Onboarding

The Workflow

Step Stage Name
1 Offered
2 Document Submission
3 Background Check
4 Account Creation
5 Asset Assignment
6 First Day Setup
7 Active

The onboarding begins when the candidate receives and accepts the job offer, officially confirming their entry into the organisation.

Once the offer is accepted, the candidate is asked to submit all required documents for verification and record-keeping purposes.

After the documents are collected, the company performs a background verification to ensure all provided information is accurate.

When verification is completed successfully, official company accounts and system access are created for the new employee.

With digital access ready, necessary work assets such as laptops, ID cards, or other tools are assigned.

On the first working day, basic system setup, orientation, and introductions are completed to help the employee get started smoothly.

Finally, the onboarding process concludes as the employee becomes fully active and begins normal work responsibilities.

Data to Collect

Category Examples
Personal Name, DOB, Gender, Address, Emergency contacts
Professional Previous employment, Education, Certifications
Financial Bank account, PAN/Tax ID, Salary account
Compliance Work permits, Right to work documents

Edge Cases

❗ What if the background check fails after offer acceptance?

  • If the background check fails after the offer is accepted, the company may withdraw the offer based on its internal policy. Legal and compliance teams usually review the case before taking a final decision.

❗ What if the employee doesn't submit documents on time?

  • If the employee does not submit documents on time, a short grace period is usually given. If delays continue, the issue may be escalated, and the onboarding process can be temporarily paused.

3️⃣ Attendance & Time Tracking

Attendance Methods

No. Method Description
1 Biometric (Fingerprint / Face) Attendance is marked using fingerprint or face scan at the office.
2 RFID Card Swipe Employees swipe their ID card on a machine to record attendance.
3 Mobile App (GPS-based) Attendance is marked through a mobile app with location tracking.
4 Web Portal (Manual) Employees manually log in to a website to mark attendance.
5 Beacon / Bluetooth (Office Entry) Attendance is automatically captured when entering the office using Bluetooth.

Shift Management:

  • Fixed shifts (9 AM - 6 PM)
  • Flexible hours (core hours + flexible)
  • Rotating shifts (for 24/7 operations)
  • Night shifts (with allowances)

Attendance Status:

  • Present (On time)
  • Late (Grace period: 15-30 mins)
  • Half Day (Less than X hours)
  • Absent
  • Work from Home
  • On Leave
  • Holiday

Overtime Calculation:

  • Regular hours: 8 hours/day
  • Overtime: > 8 hours
  • Weekend work: 2x multiplier
  • Holiday work: 3x multiplier

Business Rules

  • Employees can be up to 15 minutes late without penalty.
  • A full day counts only if 8 hours are worked.
  • Working 4–6 hours is counted as a half day.
  • Overtime is valid only with manager approval.
  • Attendance issues must be corrected within 3–5 days.

The Tricky Part: Timezone Handling

Challenge: Global team with employees in multiple time zones.

Example:

  • HQ in India (IST)
  • Employee working from the USA (EST)
  • Check-in at 9 AM EST = 7:30 PM IST (previous day!)

Solution: Store all timestamps in UTC, convert time only for display and reports based on each employee’s assigned time zone.


4️⃣ Leave Management

Leave Types Hierarchy

Annual Leave Quota

Leave Type Description
Earned Leave Leave accumulated monthly based on days worked.
Casual Leave Short-term leave granted annually for personal needs.
Sick Leave Leave provided annually for illness or medical reasons.
Compensatory Off Leave earned by working extra hours or on holidays.
Maternity Leave Leave granted to female employees as per company policy and law.
Paternity Leave Leave granted to male employees around childbirth, as per policy.
Loss of Pay Unpaid leave taken when no other leave balance is available.

The Leave Request Workflow

Leave Request Workflow

Leave Balance Calculation

Below is an example of how leave balance and accrual logic might be adopted in an HR management system. Accrual means that leave gets added little by little over time. Instead of giving all leave at once, the system adds some every month.

Earned Leave

  • Every month, you earn 1.5 days
  • Over a full year: 1.5 Γ— 12 = 18 days

  • If you don’t use all your earned leave, you can carry it forward:

    • You can carry forward only up to 10 days into the next year
    • Anything above 10 days is removed or settled
  • Encashment means converting unused leave into money

    • Earned Leave can be converted into salary
    • Example: 5 unused days β†’ paid as money

Casual Leave

This is for short, unexpected needs.

  • You get 12 days per year
  • All 12 days are given at once on January 1st
  • Cannot be carried to next year
  • Cannot be converted to money
  • If not used β†’ it expires
Leave Type Days / Year Carry Forward Encashment Expiry
Earned Leave 18 Up to 10 days Yes Excess removed
Casual Leave 12 No No Expires yearly

Business Rules

  1. Advance notice required

    • Some leaves must be applied early
    • Example:
      • Casual Leave β†’ 2 days before
      • Earned Leave β†’ 7 days before
  2. Blackout periods

    • During important times (year-end, major projects)
    • Leave may not be allowed
  3. Maximum continuous leave

    • You can’t take too many days in a row
    • Example: max 10 consecutive days
  4. Half-day leave

    • The company decides whether half-day leave is allowed
  5. Leave cancellation rules

    • Leave may need to be cancelled before a certain date
    • Late cancellation may still count as leave

5️⃣ Payroll Processing

Salary Structure

  • CTC (Total yearly pay): $100,000
  • Fixed Pay (80%)
    • Basic Salary: $40,000
    • HRA: $20,000
    • Special Allowance: $20,000
  • Variable Pay (15%)
    • Bonuses and incentives (performance-based)
  • Benefits (5%)
    • Provident fund, insurance, meal vouchers

Payroll Process (Monthly)

  1. Collect attendance data
  2. Calculate working and leave days
  3. Identify Loss of Pay (LOP)
  4. Calculate gross salary
  5. Add bonuses or overtime
  6. Deduct PF, tax, and other deductions
  7. Calculate net salary
  8. Generate payslip
  9. Transfer salary to the bank

Deductions

Mandatory

  • Income tax
  • Provident Fund (12% of basic)
  • Professional tax
  • Insurance (if applicable)

Optional

  • Loan or advance recovery
  • Meal charges
  • LOP deductions

Tax Calculation

  • Tax is calculated using slabs (higher income β†’ higher tax rate)
  • Allowed deductions reduce taxable income (insurance, loans, donations)

Payroll Cycle

  • Day 1–25: Attendance tracking
  • Day 26–30: Data freeze
  • Next month Day 1–5: Payroll processing & approval
  • Day 7: Salary paid
  • Day 10: Payslip shared

Important Edge Cases

  • Mid-month joining β†’ salary paid proportionally
  • Mid-month resignation β†’ final settlement
  • Salary revision β†’ arrears calculation
  • Recoveries β†’ adjusted in last salary

Payroll ensures employees are paid accurately, on time, and legally compliant.


6️⃣ Performance Management

Performance management is how a company checks how well an employee is doing their job.

  • At the start, employees are told what they need to work on.
  • During the year, progress is checked.
  • Employees and managers both give feedback.
  • HR reviews everything to keep it fair.
  • Finally, feedback is shared in a one-on-one meeting.

Based on performance

  • Good performance leads to a salary increase or promotion.
  • Average performance gets a normal increment.
  • Poor performance may need improvement training or further action.

This process helps employees grow and improves overall company performance.

Rating Scale

Employees are rated on a scale of 1 to 5, where 5 is excellent and 1 is poor performance.

5: Exceptional (Top 5%)
4: Exceeds Expectations (25%)
3: Meets Expectations (60%)
2: Needs Improvement (9%)
1: Unsatisfactory (1%)
Enter fullscreen mode Exit fullscreen mode

360-Degree Feedback

The final rating comes from 360-degree feedback:

  • Manager: 50%
  • Peers: 20%
  • Direct reports: 15%
  • Self-review: 15%

Link to Compensation

This final rating decides salary increment and promotion:

  • Rating 5 β†’ 15–20% hike + eligible for promotion
  • Rating 4 β†’ 10–15% hike
  • Rating 3 β†’ 5–8% hike
  • Rating 2 β†’ 0–3% hike + improvement plan
  • Rating 1 β†’ No hike + possible exit discussion

Domain Model Summary

Here's a quick reference of the entities we discovered:

Domain Key Entities
Recruitment Job, Candidate, Application, Interview, Offer
Onboarding Employee, Document, Task, Asset
Attendance AttendanceRecord, Shift, Timesheet, Overtime
Leave LeaveRequest, LeaveBalance, LeaveType
Payroll Payslip, SalaryComponent, Deduction, Tax
Performance Review, Goal, Feedback, Rating

Top comments (0)