Leave management platform for 30,000+ employees
Powered accruals, proration, and multi-level approvals across one of the largest HR rollouts on the platform.
- Domain
- Product engineering · HR systems
- Role
- Engineering owner, end to end
- Stack
- Node.jsNestJSPostgreSQLTypeORMAWS
The problem
Leave looks simple on a feature card. It is brutal once it touches a real organization. Different countries have different statutory minimums. Different companies have different accrual policies. Different employees join and leave mid-year. Some leave is paid, some is unpaid, some converts to no-pay only after a balance hits zero. Approvals route through one manager, two managers, or HR, depending on the leave type and the company's structure.
I owned the build of the leave engine that had to handle all of that, for an enterprise platform serving 30,000+ employees, with payroll integration on the other end.
What I built
The platform breaks down into a few cooperating pieces.
A configurable accrual engine. Policies are data, not code. Customers describe their leave types, accrual rules, carry-forward limits, and reset dates in a configuration model, and the engine evaluates it. New leave types do not need a deploy.
Real-time balance computation. Every balance request runs against the same evaluator the accrual jobs use, so what employees see in the UI is always consistent with what payroll uses at month end. Proration for mid-cycle joiners and leavers is computed on demand, not stored, so retroactive policy changes apply cleanly.
Multi-level approval workflows. Approval chains are described per leave type and per role. The engine stitches in the right approvers, handles delegation, and surfaces a clean state machine the UI can render without needing to know the rules.
Payroll integration for compliance-sensitive scenarios. The hardest cases are no-pay leave and statutory edge cases, where the leave system has to talk to payroll without blocking either side. I designed a contract that lets the leave system signal payroll, get back authoritative compensation outcomes, and reflect them in the employee view, all without coupling the two systems' release cycles.
Decisions and tradeoffs
Configuration over code. Tempting to hardcode the common cases and treat the rest as edge cases. Wrong call at this scale. The configuration model added upfront complexity, but it eliminated months of customer-specific code branches over the life of the platform.
Computed balances, not stored balances. A stored balance is fast to read and slow to fix. A computed balance is slower to read and impossible to get out of sync. Indexing and a thin caching layer brought the read cost into a fine range.
Approvals as a state machine, not a workflow library. An off-the-shelf workflow engine can model anything, which means it can also hide intent. A small, explicit state machine for leave approvals was easier for the team to reason about and easier to debug when a request got stuck.
Outcome
The platform shipped and ran 30,000+ employees through real leave cycles without the kind of payroll surprises that get HR systems removed from procurement shortlists. Dashboard performance also improved sharply after I refactored the analytics queries that fed it, by tuning execution paths and indexes the previous shape of the data had hidden.