Interview with a FAANG engineer.

An Interview with a FAANG engineer

Watch someone solve the photo sharing service problem in an interview with a FAANG engineer and see the feedback their interviewer left them. Explore this problem and others in our library of interview replays.

Build a Photo Sharing App for Up to 1 Billion Users: System Design Interview with a FAANG Engineer - YouTube

Interview Summary

Problem type

Photo Sharing Service

Interview question

Design a photo-sharing service which allows users to:

  1. Upload a photo on their profile.
  2. See photos uploaded by other users the user follows.

Interview Feedback

Feedback about Frumious Cronut (the interviewee)

Advance this person to the next round? Yes
How were their technical skills? 4/4
How was their problem solving ability? 4/4
What about their communication ability? 4/4

Feedback about Platinum Lambda (the interviewer)

Would you want to work with this person? Yes
How excited would you be to work with them? 4/4
How good were the questions? 4/4
How helpful was your interviewer in guiding you to the solution(s)? 4/4

Interview Transcript

Platinum Lambda: Do you have an interview coming up in the next few weeks?
Frumious Cronut: Yeah, so actually I've got an interview with Stripe Friday and then the second half of that interview Monday where I'll be doing a system design interview then. Cool.

Platinum Lambda: All right, well, I hope this gets you started. I'm going to go ahead and paste the question here and if you've seen this before, let me know, I can swap it out.

Frumious Cronut: Oh yeah, I've seen that before, but so happy to swap that out. For the sake of practice, happy to kind of go with this and see how well I do. Okay.

Platinum Lambda: All right. Let's get started. Have a look in the LUTO if you have any questions on it.

Frumious Cronut: Yeah, absolutely. So, I mean, the way I've seen this done before is like going through functional requirements, non-functional requirements, talking about core entities and like an API design and then getting into like a high level design. So that's the process I'd like to follow, if that sounds good with you.

Platinum Lambda: Yep, sounds good.

Frumious Cronut: Awesome. Okay, so for functional requirements, we want users to upload photos of their profiles and see photos uploaded by other users that a user follows. The first question there is for these users, is that going to be anonymous or can we assume that users have authenticated and signed in when they posted the photos?

Platinum Lambda: Let's assume the users have authenticated, signed in.

Frumious Cronut: Okay, cool. And then so uploading a photo on their profile. That assumes like users have a profile that other users can view.

Platinum Lambda: That's correct.

Frumious Cronut: Cool. So user profiles, viewing other user profiles. Is that gated by some mechanism? Can you only view, do we have private profiles, public profiles, you can only see user profiles for users that you follow, that sort of thing?

Platinum Lambda: So let's assume that you can only see a profile if you click follow on that user and that user accepts the follow request.

Frumious Cronut: Okay, so only see profiles of users who follow. We haven't talked about following yet. Let's talk about those requirements.

Frumious Cronut: We want to see photos uploaded by other users. So that sounds just like a feed of content. So are there particular requirements around that feed? Is it algorithmic? Is it just most recent?

Platinum Lambda: Yes. Essentially when the user brings up their feed, they should see the most recent.

Frumious Cronut: Cool. And you mentioned recommendations which reminded me, do we want to be able to recommend user follows?

Platinum Lambda: Yeah, let's do that. Let's assume, you know, let's provide a notification capability where, you know, a user periodically gets suggested up to three suggestions of, hey, you know, let's tailor this way where they might be interested in certain celebrities.

Frumious Cronut: Okay, so those follow recommendations are only for celebrities.

Platinum Lambda: Right, limited to celebrities or high-profile accounts.

Frumious Cronut: Gotcha. Gotcha. And then so the solid recommendations. So we've also got search. So I guess we also want to be able to search for other users and search for other photos.

Platinum Lambda: That's right.

Frumious Cronut: Okay, search for other users, search for other...
Platinum Lambda: Search for users, because when you search a user, you bring up the profile; you'll see their photo. So there's no need to search the photo separately.

Frumious Cronut: Okay, cool. Now when we talk about user uploaded photos, what sorts of data is included in that upload? Can you add a caption? Are there filters?

Platinum Lambda: Yes. The only piece of metadata will be the caption of the photo and the location where the photo was taken.

Frumious Cronut: And will other users be able to comment on photos or react to the photo?

Platinum Lambda: Yes, let's assume right now for a given photo it can be liked and there can also be comments on the photo as well.

Frumious Cronut: Okay, cool. I feel like we've captured a lot here. Is there anything else as far as functional requirements that should be noted?

Platinum Lambda: I think you got it. Good. I think in terms of the end user, client, device, you don't have to worry about that.

Frumious Cronut: Right, so we can assume that users can access the app from a mobile device or desktop or anything like that. Also, that we can integrate with some authentication service.

Platinum Lambda: Yep.

Frumious Cronut: So, when it comes to non-functional requirements, are there any limits around, for example, like the photo upload size or anything like that?

Platinum Lambda: Let's assume the limit on photo upload size is 10 megabytes.

Frumious Cronut: And do we have any estimates around like daily active users or stuff like that?

Platinum Lambda: Yeah, let's assume for the service there are 1 billion daily active users.

Frumious Cronut: Wow. And so are there limits around how many posts they can make a day?

Platinum Lambda: No, there's no limits.

Frumious Cronut: So sounds like no limits on writes. I'll assume reads is the same. I guess it probably doesn't make sense to get into capacity planning yet, but would be nice to get an idea of, you know, in general, our users like writing or viewing photos more often than they're writing?

Platinum Lambda: Yeah, you can assume the read/write ratio is about 80/20, 80% reads, 20% writes.

Frumious Cronut: Yeah. So when it comes to like consistency and availability, low latency, the things that are sticking out to me right now is that we probably want very high availability around viewing photos, but it doesn't necessarily have to be hyper consistent. It's fine if it takes some time to see the latest photos from users you follow.

Platinum Lambda: Yeah, I mean for the app, yeah. High availability, low latency.

Frumious Cronut: Okay. Eventually consistent. So thinking more about the non-functional requirements and aspects where it's important to focus on latency, consistency, etc., is there anything else worth calling out that I should keep in mind?

Platinum Lambda: No, this looks good to me.

Frumious Cronut: Okay, cool. So we've got a lot here. I'm kind of, I'll just get into like some of the core entities that we're going to be working with.

Platinum Lambda: Right. Users, of course, have photos, comments.

Frumious Cronut: Yeah, exactly. What else here? We mentioned celebrities, so can we talk a little bit more about that? Are we talking about different user types or is that just an emergent product of the system based on how popular an account is?

Platinum Lambda: Yeah, I would classify that as a different user type. You can assume it's a different user.

Frumious Cronut: Different users for verified users.

Platinum Lambda: Exactly.

Frumious Cronut: And essentially, you could probably think of this user as those users that are verified users.

Platinum Lambda: I see. Okay.

Frumious Cronut: Gotcha. If we have verified users, then that means in our functional requirements we need some way to register and verify a user, correct?

Platinum Lambda: So, essentially if a user has more than 100,000 followers, they automatically become flagged.

Frumious Cronut: Okay, so when you say automatically flagged, do we need to get anything around a process that verifies their ID?

Platinum Lambda: Yeah, we can assume it's automated, handled in the background.

Frumious Cronut: Gotcha. So we got verified users, normal users, we have some photos, we have some comments. I think for the most part, those are our entities. So let's talk about API design.

Platinum Lambda: Sure, for uploading a photo, right?

Frumious Cronut: So let's talk about how we want to handle that. For uploading a photo, we want to use multipart file upload.
In the event of a 200 success, just return the photo ID.

Platinum Lambda: Correct.

Frumious Cronut: To handle the metadata of the photo, the location, and any other information, we can handle that in a separate API request after uploading the photo.

Platinum Lambda: Sounds good.

Frumious Cronut: For the follow service, we could handle it with a POST request to userID follow. There would be no request body; the action here is sufficient given the request itself. Then we can return a 204 empty body response.

Platinum Lambda: Sounds good.

Frumious Cronut: And then as users might want to view their follows, we can implement that with a GET request to retrieve all follows, and we might want to paginate that as well.

Platinum Lambda: Yeah, pagination is an important aspect or could become very significant as the user base grows.

Frumious Cronut: As for the feed, a similar GET request could return photos from users the authenticated user follows. The response could include a list of photos, each with a relevant thumbnail URL and ID. We might also include the created time for display.

Platinum Lambda: Agreed.

Frumious Cronut: Overall, I think we have a well-rounded design to approach this system.