0%
Product Architecture Interviews: User Flows, APIs, Data Models, Feeds, Real Time and Privacy
APIs for Product Features
Once you know the flows, the promises and the main screens, the next step in the framework is the API. In a product round the API is not an exercise in REST conventions. It is the contract that makes the screens possible: what the client asks for, what it gets back, and what happens when the user does something. This lesson covers how to derive that contract from the product, how to shape it for screens and clients, and how to handle the product specific details interviewers like to probe: pagination that survives new content, counters and viewer specific state, partial responses, and mutations that are safe to retry. For REST versus gRPC versus GraphQL, status codes, versioning and the general mechanics of pagination and idempotency, see the API Design Interviews course; here we stay on the product side.
Two sources of endpoints
Almost every endpoint in a product API comes from one of two places. Screens that load data produce reads. User actions produce writes. If you sketched the main screens in step one, the reads are nearly done: the home feed, a post detail, a profile, a search results page, a notifications list. If you listed flows, the writes are nearly done: publish a post, like, unlike, comment, follow, report, mark as sold, hold seats, check out.
This is a useful discipline because it keeps the API small and justified. An endpoint that no screen loads and no action triggers is a sign that you are designing from the database outward rather than from the product inward. In an interview, five to eight endpoints for the core flows is usually the right size. You can mention that admin, settings and analytics endpoints exist without writing them.
Read models per screen
A read model is the shape of data a particular screen needs, regardless of how it is stored. The home feed card needs the post, a slice of the author's profile, media URLs at the right size, counters, and viewer specific flags. The profile screen needs the user's header, the viewer's follow relationship with them, a post count, and a grid of thumbnails. These shapes are different, even though they draw on the same entities.
Designing one read per screen, each returning that screen's read model, has several benefits. The client renders with one request. The server can optimise each read path separately, for example by precomputing the feed and caching the profile header. And each response can carry exactly the viewer specific fields that screen needs, without leaking others.
A compact sketch for a photo app might look like this:
Eight lines, and every one traces to a screen or an action. That is the density to aim for on the board.
Name mutations after what the user did
Write endpoints work best when they describe the user's action rather than the storage change. Like a post is clearer and safer than update the likes table, and follow a user is clearer than insert a row into follows. Action shaped mutations let the server enforce product rules in one place: a like checks that the viewer can see the post, that they are not blocked, and that rate limits are respected. They also give you natural places to emit events, such as a like event that drives notifications and counters.
The same principle applies to state changes with business meaning. A marketplace seller marks an item reserved, not patches its status field. A ticket buyer holds seats, not inserts hold rows. When the action has rules, such as only the seller can reserve and only for a buyer who messaged them, the action endpoint is where those rules live.
What each response returns after a write
A good product mutation returns the resulting object or the fields the client needs to render the new state. When a user publishes a post, the response includes the created post with its id, its server timestamp and its processing state, so the client can show it at the top of the profile immediately. When a user likes, the response can include the new liked state and an updated count. This directly supports the read your own writes promise from lesson two: the client does not need to reread from a replica that might lag.
What the interviewer is checking here
At this step interviewers are usually checking three things. Do the endpoints map to the product, or to tables? Does each screen render with a small number of calls? Are writes shaped around user actions with rules enforced on the server? A compact list that passes those three checks, written in a couple of minutes, is stronger evidence than a long, carefully formatted specification. If the interviewer wants a full request and response for one endpoint, they will ask, and you can expand that one.
Working an example out loud
For a used furniture marketplace, you might say: the screens are search results, listing detail, my listings and a conversation; the actions are create listing, message seller, make offer, and mark reserved or sold. So the reads are a search endpoint with filters and a cursor, a listing detail that includes seller summary and whether the viewer has an open conversation, a my listings list with states, and a conversation with messages paginated backwards. The writes are create listing, send message, which creates the conversation on first use, make offer, and a transition endpoint for listing state that only the seller can call. That paragraph takes about forty seconds and gives the interviewer the whole API surface in a form they can check against the flows.
Reads that serve more than one screen
Sometimes two screens need almost the same read model. A profile grid and a search results grid might both show thumbnails with a small overlay. It is tempting to reuse one endpoint, and sometimes that is right. The test is whether the screens will evolve together. If the search grid will soon need relevance highlights and the profile grid will need pinned posts, separate reads that happen to share a response type today will save a painful split later. In an interview, a sentence like these two grids share a card shape but are separate reads, because they page differently and will change independently shows you are thinking about the product's future rather than only its first version.
Authentication and the viewer
Nearly every product read depends on who is asking, so the viewer's identity is an implicit parameter on every call. It normally comes from a session token or access token validated at the gateway, which passes a trusted user id to the services behind it. Do not put the viewer id in the URL or the body for reads such as the home feed, because then a client could ask for someone else's feed. The feed endpoint is simply GET home, and the server knows whose home it is. Mentioning this in one line closes an obvious hole and shows that you think about the API from an attacker's point of view as well as a user's.
Errors as product states
Product APIs also need a small vocabulary of errors that map to screens. Not found and gone for deleted content, forbidden for a private account the viewer does not follow, conflict for an item that was just sold, too many requests for a rate limit, and a validation error that points at the field the user must fix. Each of these drives a distinct user experience: a removed post state, a request to follow prompt, a sold banner, a slow down message, an inline field hint. You do not need to list status codes, but naming the product states your errors must support makes the API feel complete. The API Design Interviews course covers error formats in depth.
Before writing an endpoint, name the screen that loads it or the user action that triggers it. If you cannot name either, leave it out. This keeps the sketch small, keeps it product shaped and gives you a ready justification for every line on the board.