Preparing your design workspace

Loading the problem and your latest saved attempt…

Design the APIs and Backend Behind a Preferences Page

Practice turning a given mock of an app's preferences page into APIs and a backend: one fast page load, controls that save on their own, other services that must honor changes within a minute, and a privacy switch that must fail safe.

Problem statement

Design the APIs and backend behind a preferences page, starting from a mock of the page.

For this exercise, assume you are given this mock of the Preferences page of a consumer AI assistant app, used on the web and in mobile apps: - General: theme (system, light or dark) and language (one of 30). - Notifications: email on or off for 'Product news' and for 'Weekly summary', and push on or off for 'Reply ready'. - Personalization: a text box, 'How should the assistant answer you?', of up to 1,500 characters. - Data controls: a switch, 'Use my conversations to improve the models', which is on by default. There is no Save button. Each control saves on its own when it changes (the text box when the user stops typing), and the page shows 'Saved' or an error next to that control. A user who never changed a setting sees its default. Settings belong to the account, so the same values apply on every device; another device shows a change the next time its page loads or is refreshed.

Also assume other services act on these settings.

The email service checks the two email switches before each email, the push service checks the push switch, the assistant reads the language and the personalization text on every reply, and the training-data pipeline checks the data-controls switch each time it takes a conversation, including conversations from before the switch changed.

Product teams add new settings a few times a month, and older app versions must keep working when they meet a setting they do not know.

For this exercise, these are out of scope: sign-in and accounts, the email and push senders themselves, the training pipeline itself, removing data already used for training, team or admin-managed settings, and running in more than one region.

What to build

  1. Opening the page shows every setting in the mock with the user's value or its default, in one fast load on web and mobile.
  2. Changing a control saves just that setting; the page shows 'Saved' or a clear error beside it, and invalid values are rejected.
  3. The email, push, assistant and training-data services act on a changed setting within 1 minute, and the user's other devices show it when their page next loads.
  4. Product teams can add a setting with a default without changing the page's API, and older app versions keep working.

At scale

  • For this exercise, assume 100 million users. The page is opened about 5 million times a day, and settings change about 5 million times a day, with peaks of 500 changes a second.
  • For this exercise, assume the other services read settings about 200,000 times a second at peak, mostly the assistant on every reply, and each read must take under 10 ms at the 95th percentile. The page should load within 300 ms and a change should be saved within 500 ms.
  • For this exercise, assume a saved change is never lost, saving one setting never undoes another, and for each setting the user's last change on a device is the one that sticks, even when that device retries a request; when two devices change the same setting at about the same time, the change the server receives last wins.
  • For this exercise, assume the services act on a change within 1 minute, and if the training-data pipeline cannot tell whether a user's data-controls switch is on, it must treat it as off.