Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Photo Album Sharing App

Design a web app where people upload photos and group them into albums. An album can be shared with chosen people or through a link, and sharing can be taken back within a minute.

Problem statement

Design a photo web app where people keep their photos, group them into albums and share the albums with others.

For this exercise, assume a signed-in user uploads photos (JPEG or PNG, up to 20 MB each) and finds them in a personal library. The user can create albums and put one photo in any number of albums. The user can take a photo out of an album without deleting it, and can delete a photo for good.

An album's owner can share it with chosen people. Each person is either a viewer, or a contributor who may add their own photos. The owner can also share the album through a link that lets anyone who holds it view the album.

Also assume that a photo is shared only by sharing an album that holds it. A photo added by a contributor stays in that contributor's library. The album owner can take it out of the album but cannot delete it. The owner can stop sharing at any time. A person who was given an album opens it from a shared-with-me list.

An album page shows its photos as a grid of small preview images, 50 at a time. Opening a photo shows a larger version.

Also assume that up to 100 photos are uploaded each second at peak, and the average original is 4 MB. Album pages are opened up to 5,000 times a second at peak. An album page request should answer within 300 ms at the 95th percentile, which means 95 out of 100 requests.

The preview images load after that request and are not counted. At the 95th percentile, a new photo should appear in its albums within 10 seconds of the upload finishing.

Also assume that the removed people and the link must lose access within 1 minute after an owner stops sharing, including for images held in caches. Pictures already on someone's screen cannot be recalled. An album holds at most 10,000 photos.

Photo editing, search by content, face recognition, comments, printing, payments and use in more than one region are out of scope.

What to build

  1. A signed-in user uploads photos and finds each one in their library with preview images once it is processed. Sending the same upload again never creates a second photo.
  2. A user creates albums, puts a photo in any number of albums, takes it out of an album without deleting it, and deletes a photo for good.
  3. An owner shares an album with chosen people as viewers or contributors, or through a link, and can stop sharing at any time.
  4. People open their own albums and albums shared with them as pages of preview images. They can open a larger version of a photo, but only while they are allowed to.

At scale

  • For this exercise, assume up to 100 photo uploads a second at peak, with an average original of 4 MB and a limit of 20 MB.
  • For this exercise, assume album pages are opened up to 5,000 times a second at peak and each page shows 50 previews. The page request should answer within 300 ms at the 95th percentile (95 out of 100 requests). The preview images load after the page request and are not counted.
  • For this exercise, assume a finished upload appears in its albums within 10 seconds at the 95th percentile.
  • For this exercise, assume that within 1 minute of an owner stopping a share, the removed people and the link get no new album data. They also get no new image bytes, including from caches.
  • For this exercise, assume an album holds at most 10,000 photos and a photo can be in many albums.