Build an HR record whose leave engine is correct rather than approximately correct. Stack: your choice, Postgres, Docker Compose, a domain with TLS, and a transactional email provider. People: personal details, employment start and end, contract type, working pattern (which days, how many hours), manager, and team. Contracts are versioned with effective dates; changing a working pattern in June must not rewrite January. The leave engine, which is the whole build: - Leave types you define — annual, sick, parental, unpaid — each with its own rules. - Accrual: a rate per period, pro-rated by working pattern and by start date within the period, with a configurable carry-over cap and expiry date for carried days. - Requests are in **working days for that person's pattern**, so a four-day-a-week employee taking a fortnight uses eight days, not ten, and a public holiday inside the range does not count. Holidays come from a calendar you maintain per location. - Balance at any date, computed rather than stored, showing accrued, taken, booked and remaining, with the arithmetic visible so a dispute can be settled by looking. - Approval by the manager, with a rejection reason, and an email to both sides. - A team calendar showing who is away, and a warning when approving would leave a team below a minimum you set. Write the tests for this first: accrual for a mid-year joiner, carry-over expiring, a half-day request, a request spanning a public holiday, and a working-pattern change mid-request. Documents: per person, with a type, an expiry where relevant, and a retention period after which they are deleted with the deletion logged. Alert on documents expiring within thirty days. Org chart derived from the manager field, not maintained separately. Data protection, because this is the most sensitive database a small company runs: role-based access with managers seeing only their reports, an audit log of who viewed whose record, and a per-person export producing everything held about them. Do not build payroll, recruitment or performance reviews.