Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Restaurant Staff Scheduling System

Design a small weekly shift-scheduling service for restaurant managers, with a clear data model and APIs, an existing availability algorithm, and consistent, conflict-free assignments.

Problem statement

Design a staff scheduling system for restaurants. Each manager sets up next week's shifts, gets the employees who can work each shift from an existing availability algorithm, assigns people, and publishes the schedule.

No employee may be booked for two shifts at the same time, and the system picks consistency over availability: it rejects a change it cannot check safely rather than risk a wrong schedule.

What the system must do. - Let a manager create next week's shifts and assign employees to them. - Use the availability algorithm as a black box (a part we call but do not design): the service sends it a shift and gets back the employees available for that shift. - Choose consistency over availability when the two conflict. - The system is small: 50 restaurants with 50 employees each. Scaling is not the focus; the data model and the APIs are.

For this exercise, assume: - Each shift has one or more positions, and each position needs one employee with a given role (for example, two servers and one cook). - The availability algorithm decides from data this service does not own, such as preferences and time off.

It does not see this service's assignments, so it can list an employee who is already booked at that time. Its answer can change over time, it usually answers within 200 milliseconds, and it is sometimes unavailable. - Managers and employees view the published schedule.

An employee can ask to swap a shift with a coworker; the swap takes effect only after the coworker and the manager approve. - A position holds at most one employee, and a retried request never creates a duplicate assignment or approval.

Out of scope: how the availability algorithm works, payroll, hiring, demand forecasting, point-of-sale operations, and labor-law rules.

What to build

  1. A manager can see which employees are available for a shift. The service gets this list from the existing availability algorithm, which it treats as a black box.
  2. A manager can create next week's shifts with role-specific positions, assign available employees, validate conflicts, and publish one versioned weekly schedule.
  3. Managers and employees can read the current published schedule and see whether a newer draft or change is pending.
  4. An employee can request a swap that becomes effective only after the coworker and manager approve an eligible, conflict-free replacement.

At scale

  • 50 restaurants with 50 employees each, about 2,500 employees in total. For this exercise, assume up to 300 shift positions per restaurant each week, about 15,000 in total.
  • For this exercise, assume at most about 20 schedule changes and 200 schedule reads per second at the busiest time, when managers publish next week's schedules. Scaling is not a focus at this size.
  • For this exercise, target 300 milliseconds p95 for healthy schedule reads and one second p95 for a definitive assignment, publication, or swap-transition response.
  • For this exercise, assume accepted schedule changes survive a zone failure, employee notifications may lag by one minute, and schedule plus approval history is retained for three years.