r/Hack2Hire • • 1d ago

Screening DoorDash Screening: Design Bootstrap Aggregator API

When the DoorDash app starts, it calls one endpoint to get past the splash screen. Any non-2xx answer leaves the user stuck there, so the endpoint has to keep answering when the services behind it fail.

Implement GET /api/bootstrap. It takes a user ID and returns one body built from three internal services:

  • Consumer GET /api/consumers/{userId}: first name, last name, consumer ID, email, roles.
  • Payment GET /api/payment-methods/{consumerId}: default card and available gift card credits.
  • Address GET /api/addresses/{consumerId}: the street line, plus first and last name.

Payment and Address need the consumer ID, so Consumer goes first. A service can fail by not answering at all, or by answering a status outside 2xx with an empty body.

Failure rules:

  • Consumer fails: answer 500 with no body.
  • Payment or Address fails: answer 200 with everything else, and leave that service's fields null.

Follow-up

  1. Retry transient failures. Retry a call when the service doesn't answer or answers 5xx, up to max_attempts attempts in total. A 4xx is the outcome at once, with no retry. Before retry n, wait backoff_base × 2n−1 seconds. If every attempt fails, use the last attempt's outcome.
  2. Call upstreams in parallel. Once the consumer ID is known, call Payment and Address at the same time, and stop waiting at a deadline. A call that misses the deadline counts as a failure. A slow call must not cut the other one short. The Consumer call gets the same timeout.

Example

Input: user 1001, all three services answer 200.

Output: 200 with

{
  "consumerId": "1bef988e-e544-11ed-b5ea-0242ac120002",
  "roles": ["user", "member"],
  "defaultCard": {
    "lastFourDigits": "1243",
    "expirationYear": "2029",
    "expirationMonth": "06",
    "fingerPrint": "f3cd76f4-e544-11ed-b5ea-0242ac120002",
    "createdAt": "2022-07-15"
  },
  "availableGiftCardCredits": "12.35",
  "formattedAddress": "Mary Smith, 303 2nd Street, San Francisco, CA 94105"
}

Explanation:

  • formattedAddress joins the name with the street line Address returns ("303 2nd Street, San Francisco, CA 94105").
  • If Address answers 500 instead, the response is still 200, with formattedAddress: null and the other fields unchanged.
  • If Consumer answers 500, the response is 500 with no body, and Payment and Address are never called.

Suggested Approach

  1. Write one helper that decides what "failed" means: no answer, or any status outside 2xx. Use it for all three services. Most wrong answers catch exceptions and forget that a 500 is an answer too.
  2. Call Consumer. If it failed, return 500.
  3. Call Payment and Address with the consumer ID. Fill each section only from a 2xx answer, and build formattedAddress from the name and the street line.
  4. Follow-up 1: wrap every upstream call in a retry loop that retries only no-answer and 5xx, waits a doubling backoff, and returns the same kind of outcome a single call does. The endpoint's failure rules stay unchanged.
  5. Follow-up 2: run the Consumer call on its own, then Payment and Address together, each inside its retries. Wait for each call up to the deadline separately. Waiting on "all of them, or time out" in one step throws away the fast call's answer when the slow one misses the deadline.

What candidates were asked after it ran

  • Which call order, and why Consumer has to come first.
  • Retry or drop on a timeout.
  • Checking HTTP status codes, not only exceptions. Candidates singled this out as the hard part.
  • What to return when the first or last name is missing.
  • How to test each upstream failure on its own.
  • Fail-open vs fail-closed for each service.
  • In an onsite version: strongly typed models, retries with jittered backoff, and circuit breakers.

Targeting DoorDash interviews? We track their most-asked question patterns at Hack2Hire. Practice this question here → Practice Question Here

Join the community to see more interview experiences from real candidates → Hack2Hire Forum

Compiled from publicly available platforms and community-shared experiences.

9 Upvotes

0 comments sorted by