Design an Employee Directory and Organization Hierarchy
Serve fast employee search, profiles, and direct or transitive reporting relationships while HR changes propagate safely.
Problem statement
Design an internal employee directory for about one million employees. Employees must search by name, email, or employee ID, view an authorized profile, and navigate a person's manager and direct reports. The system is read-heavy and search should be fast.
Extend the design to list all transitive reportees, and explain what happens when an employee leaves. For this exercise, assume a separate HR system is the authority for employment and manager changes; the directory may build asynchronous read projections, but must make freshness and stale-state behavior explicit.
Payroll, recruiting, performance reviews, and arbitrary social-graph relationships are outside scope.
What to build
- Find active employees by name, email, or stable employee ID.
- Return an authorized employee profile and employment state.
- Return a manager, direct reports, and a paginated transitive-report view.
- Project versioned HR joins, changes, departures, and reorganizations with bounded lag.
At scale
- Assume one million current employee profiles, a 20:1 read-to-write ratio, and up to 5,000 directory reads per second at peak.
- Assume p95 latency targets of 300 ms for search and 150 ms for profile or direct-hierarchy reads.
- Assume acknowledged HR changes should become visible in all projections within five minutes and no accepted source version may be silently lost.
- Assume a transitive-report query may cover tens of thousands of employees and must therefore be paginated or exported asynchronously.