InterviewLegend

Walk Through and Defend Your Own Architecture

Signature problem
Alex Chen24 min readGuide updated 60 real interview reports
In this lesson
  • Draw a system you built in five minutes, in an order an interviewer can follow
  • Answer the follow-ups Citi interviewers ask about your design: duplicates, partial failures, slow dependencies and dead letters
  • Talk about scaling and security with real mechanisms, and know what each Citi grade is expected to show

Understanding the problem

The prompt

Something like this, from the middle of a technical or hiring-manager round: "It says here you did XYZ. Now architect it on this white board." You pick up the marker and draw a system you built yourself. Then the interviewer asks how you designed the services, how they talk to each other, what happens when one of them fails, and how you would scale it to more users.

There's rarely a classic "design Twitter from scratch" round at Citi. Design tends to show up inside the senior technical and hiring-manager rounds, and the most common form of it is this one. In a March 2026 senior engineer loop in Chennai, the ask was the architecture of the current project and what the candidate personally contributed. A 2025 full-stack Java round in Pune wanted to hear "how I designed microservices and ensured performance and security." Even a 2025 intern interview in India asked, "How would you scale your project to handle more users?" The concept questions come next, and they come fast. A senior Java loop in Pune in June 2026 had a second round full of them: Kafka versus RabbitMQ, Kafka idempotency, dead letter queues, the saga pattern, how to cut API latency. The hiring-manager round after that added sharding versus partitioning. An SVP loop in Pune (2024) asked about "distributed systems, and resiliency," and a Toronto senior Java round back in 2021 asked how you would design your previous project as microservices.

So the round grades two things at once. Can you explain a real system clearly, and do you understand why it's built the way it is? The second part is where people come apart. Someone who wired up Kafka because the team already had it can describe the boxes. They can't say what happens when a consumer crashes after writing to the database and before committing its offset. This lesson works the method on a sample system, a funds transfer service of the kind most bank engineers have touched. Swap in your own project as you read. Every deep dive below is a question you should be able to answer about your system, in your system's terms.

The Citi angle
Most Citi design conversations happen in Java and Spring Boot microservice roles, and the questions follow suit. Expect more on failure handling and message delivery than on drawing boxes. Expect interruptions too: interviewers cut in with an edge case instead of waiting for you to finish.

Before you draw, frame it in two minutes

Don't start with boxes. Start with one sentence on what the system does and who uses it, then the numbers. Citi interviewers rarely sit through a long requirements phase. They cut in with an edge case early, so this has to be quick. It also stops you drawing a system bigger than the one you ran.

What the sample system does

Retail customers move money from one of their accounts to another account, at the same bank or at a different one, from the mobile app or the website. A transfer to another bank goes out over a payment network. Customers can check a transfer's status, and they get a notification when it completes or fails. Every transfer passes a fraud check before money moves.

Draw and defend

  • Start a transfer and get a transfer id back
  • Check the fraud score, hold the funds, send the payment out
  • Undo the debit cleanly if the payment fails
  • Report status and notify the customer

Mention, then leave alone

  • How the fraud model scores a transfer
  • The payment network's internals, which you can't change
  • Statements, interest and the general ledger
  • Login and customer onboarding

The numbers and the hard rules

Use your own system's real numbers if you know them, and if you don't, round and say so. For the sample, picture three million transfers a day, which is about 35 a second on average (3,000,000 divided by 86,400). Payday mornings run maybe ten times higher, so design for around 350 a second at peak. Each transfer produces four or five events, which puts the message bus at under 2,000 events a second. That's a modest load for Kafka. The hard rules matter more than the traffic. Money must never move twice and must never vanish halfway. Every state change needs an audit trail that survives for years. Status reads can be a few seconds stale, but a balance used to approve a debit can't be.

  • Transfers: 3 million a day. About 35 a second on average and roughly 350 a second on a payday peak. Small for the hardware, which is why the round goes to correctness.
  • Events on the bus: under 2,000 a second. Four or five events per transfer at peak. One modest Kafka cluster handles this with plenty of room to spare.
  • Duplicate money movement: zero. The rule that shapes the design. Retries happen at every layer, so every layer needs a way to recognize a repeat.
  • Audit history: kept for years. Banks keep transaction records for several years under regulation. Plan storage and archiving for that from day one.

The records, in words

Three records carry the design. A transfer is one customer request to move money. It holds who asked, the two accounts, the amount and currency, the idempotency key the client sent, and a status. The status starts as pending, then moves to funds held, then sent, and ends as completed, failed or reversed. An account holds a balance and an amount on hold. A hold is money set aside for a transfer that hasn't settled yet, so the customer can't spend it twice while the payment is in flight. A transfer event is one fact about a transfer, such as "funds held" or "payment settled", with its own event_id. Other services react to those events, and the event_id is how they spot one they've already handled.

Where each record lives
TableFields
transferstransfer_id · customer_id · from_account · to_account · amount · currency · idempotency_key · status · created_at
accountsaccount_id · balance · held_amount · version
outboxevent_id · transfer_id · event_type · payload · published_at
processed_eventsconsumer_name · event_id · processed_at
Transfers and their outbox share one database, so a status change and its event commit together. Accounts belong to the Account service. Each consumer keeps its own record of event ids it has already handled.

The API

Three calls are enough. Only the first one moves money, so it's the one that needs an idempotency key. A mobile app on a weak connection will retry a timed-out request, and that retry must not start a second transfer.

The interface
Request
Mobile or web appAPI gatewaystart a transfer
POST /transfers { from_account, to_account, amount, idempotency_key }
transfer_id, status
Same key, same transfer: a retried request returns the first result.
Mobile or web appAPI gatewaycheck one transfer
GET /transfers/{transfer_id}
status, amount, updated_at
Mobile or web appAPI gatewaylist recent transfers
GET /accounts/{account_id}/transfers?cursor=
transfers, next_cursor

The architecture end to end

Draw it in the order a request travels, left to right or top to bottom, and talk while you draw. Put the request path down first, then the asynchronous part, then the failure paths. In the diagram, blue is outside our system, violet is a service we run, amber moves messages, and green stores state. Click any box for what to say about it.

Loading diagram...

1) Request. The app posts the transfer with its idempotency key. The API gateway checks the token and passes a verified customer id to the Transfer service, which looks up the key. A repeat returns the existing transfer. A new key creates a pending transfer.

2) Check and hold. The Transfer service calls Fraud check with a short timeout. If the score passes, it asks the Account service to hold the amount. The hold succeeds only if the available balance covers it. The Transfer service then writes the new status, funds held, and a "send payment" event into Transfers and outbox in one transaction, and returns the transfer id to the app.

3) Send. The Outbox relay publishes the event to Kafka topics. The Payment adapter picks it up and submits the payment to the Payment network. When the network answers, the adapter publishes the outcome.

4) Finish or undo. On "settled", the Transfer service asks the Account service to capture the hold, which turns it into a real debit, and marks the transfer completed. On "failed", it releases the hold and marks the transfer failed. Either way, the Notification service tells the customer. This last stage makes the whole flow a saga, a chain of local transactions where each one has an undo, and most interviewers push on it first.

Technology choices

  • Spring Boot services for the violet boxes. Most of these loops are for Spring roles, and Spring questions arrive by name. A 2026 senior Java panel in India asked about transaction propagation and isolation levels, so know how a @Transactional method behaves when it calls another one.
  • A relational database for accounts and transfers. Money needs transactions that cover a balance check and an update together, plus constraints such as a unique idempotency key. That's exactly what Oracle or Postgres gives you.
  • Kafka for events, because several services need the same event, consumers need to replay after an outage, and per-transfer ordering comes free with a partition key. If your project used RabbitMQ or IBM MQ, defend that instead. The deep dive below compares them.
  • Resilience4j for timeouts, retries and circuit breakers around every call to another team's service or an outside network. It's the library Spring Cloud uses now that Netflix Hystrix is no longer developed.

Where interviewers interrupt

These are the follow-ups to rehearse. Each one shows up in Citi rounds as a short concept question, and each one lands harder when you answer it about your own system. A good answer says what your system did and what that choice cost you.

How do you make sure a transfer never happens twice?

Count the places a duplicate can come from. The app retries a request that timed out. The gateway retries a call to the Transfer service. After a crash, the outbox relay publishes an event twice, and Kafka redelivers a message when a consumer dies before committing its offset. Four layers, each retrying for good reasons. With three million transfers a day, even a one-in-ten-thousand duplicate rate means about 300 double payments a day.

BadRely on the client not retrying

Approach

Create a new transfer for every request that arrives, and tell the app team to disable retries on the transfer call.

Challenges

The app can't know whether a timed-out request reached the server, so turning off retries just trades duplicates for lost transfers. It also does nothing about the gateway, the relay or Kafka redelivering. This is the answer that makes an interviewer ask the next question harder.

GoodAn idempotency key on the API

Approach

The app generates a key per transfer attempt and sends it with every retry. The transfers table has a unique constraint on the customer and the key. A repeat request finds the existing row and returns its transfer id and status, and two racing requests can't both insert because the constraint rejects the second one.

Challenges

It protects only the front door. Once the event is on Kafka, a redelivered "send payment" message would still submit a second payment unless the consumer protects itself too. Keys also need a lifetime, so decide how long you keep them, such as 24 hours or as long as the transfer record.

GreatIdempotent at every hop

Approach

Keep the API key, then make every consumer idempotent as well. The Payment adapter records each event_id it handles in a processed-events table, in the same database transaction as its own work, and skips any id it has seen. It passes the transfer id to the payment network as a unique reference, so even the outside call can be recognized as a repeat. The Account service keys holds and captures on the transfer id.

Challenges

The processed-events table grows forever unless you expire old rows, and an expired id can't be recognized later, so the expiry has to outlast Kafka's retention. When the effect happens in another system, such as the payment network, you depend on that system honoring your reference. Ask, and if it doesn't, check status with it before resending.

When the interviewer says "Kafka idempotency", they may mean the producer setting. With idempotence turned on, the Kafka producer tags each message with a producer id and sequence number, and the broker drops a retried write it has already stored. That stops duplicates on the way into Kafka. It does nothing for a consumer that writes to a database and crashes before committing its offset. Say both halves, then point to the processed-events table as the part that protects the money.

begin transaction
insert event_id into processed_events (fails if seen: skip)
do the work: hold, send, notify
commit, then commit the Kafka offset

What happens if the debit works and the payment fails?

The hold lives in the accounts database, the transfer in another, and the payment in a system you don't own. No single transaction covers all three, which is why the saga question comes up. Any of the steps can fail after the one before it succeeded, and the customer's money can't be stuck in between.

BadCall each step in a row and hope

Approach

The Transfer service debits the account, then calls the payment network synchronously, all inside one request. If the network call throws, catch the exception and credit the account back.

Challenges

If the service crashes between the debit and the refund, nothing remembers that a refund is owed, so the money is gone until someone reconciles by hand. The request thread also waits on the slowest system in the chain, and a network that settles in batches can take minutes. A distributed transaction across all three would fix the gap in theory, but the payment network won't take part in one.

GoodAn orchestrated saga with compensation

Approach

Write the transfer's progress to its own table, and give each stage a local transaction plus an undo. Holding funds is undone by releasing them. A failed payment needs no undo of its own, and a capture is final. Acting as orchestrator, the Transfer service reads the current status, runs the next stage, and on a failure runs the undos in reverse. A crashed orchestrator resumes from the stored status.

Challenges

The orchestrator has to update its table and send a message for each step, and those are two systems. If it commits the status and dies before publishing, the payment never goes out and the transfer sits in funds held. Stuck transfers need a sweeper that finds them and either retries or compensates.

GreatSaga plus a transactional outbox

Approach

Write each status change and the event that announces it in one transaction, using the outbox table. The relay publishes from the outbox, so an event exists if and only if its status change committed. Add a timeout per step: a payment with no answer after, say, 15 minutes triggers a status query to the network before anything is reversed.

Challenges

The relay adds a little latency and can publish twice, which the idempotent consumers already handle. The timeout path is subtle. Release the hold on a payment that settled late, and the money has left the bank while the customer's balance says it never moved. That's why it asks the network first and why a daily reconciliation against the network's report stays in place.

Two traps catch people here. First, if both accounts sit in the same database, a transfer between them is one local transaction, so don't build a saga for it. Say that out loud, since it shows you only reach for the pattern when you need it. Second, know the two flavors. An orchestrated saga has one service directing the work, which is easier to follow and debug. A choreographed saga has each service react to the previous one's event, with no coordinator. That's fine for two steps and hard to trace at five. The multi-step workflows lesson covers both in depth.

The Citi angle
When you describe your undo steps, also say who finds the transfers that never finished, and how often. A sweeper job plus a daily reconciliation report is a strong answer at a bank like Citi. It shows you planned for the day the happy path breaks.

The fraud service is slow. What does your system do?

Run the thread math first. Say the Transfer service runs 10 instances with 200 request threads each, 2,000 threads in all. Normally a fraud call takes 50 milliseconds, so at 350 requests a second only about 18 threads are busy with it at any moment (350 times 0.05). If fraud slows to 10 seconds per call, 350 new requests a second each hold a thread for 10 seconds. That's 3,500 threads wanted, and all 2,000 are gone in under six seconds. Now the Transfer service is down too, for every customer, because of a dependency.

BadDefault timeouts and instant retries

Approach

Call fraud with the HTTP client's default settings, and retry immediately on any error, three times.

Challenges

Many HTTP clients wait far longer than any user will, so threads pile up exactly as in the math above. Instant retries triple the load on a service that is already struggling, which turns a slowdown into an outage on both sides.

GoodTight timeouts and retries with backoff

Approach

Give the call a timeout based on what fraud normally takes, such as 300 milliseconds. Retry once or twice, waiting a little longer each time with some randomness added (jitter), so retries from many instances don't arrive together.

Challenges

It caps how long one call can hurt, but when fraud is fully down, every request still waits out its timeout and retries before failing. You keep sending traffic to a service that can't answer, which slows its recovery.

GreatAdd a circuit breaker and a fallback

Approach

Wrap the call in a circuit breaker. While it's closed, calls go through and the breaker counts failures. When failures pass a threshold, such as half of the last 20 calls, it opens and fails every call instantly for a cooldown of maybe 30 seconds. Then it goes half-open and lets a few trial calls through. If they succeed it closes again. While it's open, a fallback decides: hold the transfer as pending review, or let small amounts through.

Challenges

Thresholds that are too sensitive open the breaker on a brief blip. The fallback is a business decision with risk attached, so a product or risk owner should agree to it in advance. Give each dependency its own thread pool (a bulkhead) too, or a slow payment network can still starve fraud calls.

If you used Resilience4j, name the settings you tuned: the sliding window, the failure rate threshold and the wait time in the open state. Interviewers who've run Spring services in production will ask what the numbers were, and "the defaults" invites a follow-up you don't want.

Why Kafka, and what about a message that keeps failing?

"Kafka versus RabbitMQ" is really a question about who keeps track of delivery. Kafka is often described as a dumb broker with smart consumers, and that exact phrase was on the June 2026 Pune concept list. The broker writes messages to a log and keeps them for a set time, and each consumer group remembers its own offset. RabbitMQ is the opposite: the broker routes each message to queues, tracks acknowledgements one message at a time, and deletes a message once it's handled.

Kafka and RabbitMQ, for this system
QuestionKafkaRabbitMQ
Several services need the same eventEach consumer group reads the same logNeeds an exchange that copies to a queue per service
Replay after a bug or outageReset the group's offset and rereadGone once acknowledged
OrderingWithin a partition, so key by transfer idWithin one queue with one consumer
Routing and per-message retryBasic, built on extra topicsRich routing and built-in dead lettering
For transfer events, replay and fan-out favor Kafka. For a simple job queue with routing rules, RabbitMQ is a perfectly good answer.

Now the poison message. A malformed event, or one that refers to an account that doesn't exist, will fail every time. Kafka delivers a partition in order, so a consumer that keeps retrying it blocks every transfer behind it in that partition. The fix is to retry a few times with backoff, then publish the message to a dead letter topic and move on. Alert on anything arriving there, and keep a tool to replay it once the cause is fixed. Be precise about what counts as poison. A transfer declined for insufficient funds isn't a failure to process. It's a normal outcome, and it belongs in the transfer's status, never in the dead letter topic. A database timeout isn't poison either, since it will probably work on the next try, so retry it in place. The Kafka toolbox lesson covers partitions and consumer groups if you need a refresher.

How would you scale it to ten times the users?

Ten times the sample is 3,500 transfers a second at peak. Go through the system box by box and say which ones change. The services are stateless, so add instances behind the gateway. Kafka grows by adding partitions, and the partition count caps how many consumers in a group can work in parallel. So pick enough partitions up front, such as 48 or 96, because adding them later moves which partition a given key lands on. Most of the pressure lands on the databases. Start with the cheap moves: index the columns your reads filter on, send status reads and history queries to read replicas, and archive transfers older than a year to cheaper storage. If the accounts database still can't keep up with writes, split accounts across several databases by account id.

Interviewers who ask "sharding versus partitioning" want this distinction. Partitioning splits one large table into pieces inside one database, for example the transfers table by month, so queries and archiving touch only the months they need. Sharding spreads the data across separate database servers, each owning a range or hash of account ids. Partitioning helps manage a big table. Sharding adds write capacity, and it costs you cross-shard transfers, which now need the saga even inside your own bank. For API latency, measure first. In a Spring service the usual suspects are too many database round trips (the N+1 problem in JPA) and synchronous calls that could be events. Undersized connection pools are the third. Moving the payment call off the request path, as the design above does, is the biggest latency win in this system.

How did you secure it?

A 2025 Pune round asked how the candidate ensured performance and security, and in a bank the security half is never a throwaway line. Cover the three layers in order. At the edge, the gateway validates an access token, usually a JWT from the bank's identity provider, and rate-limits each customer. Between services, use mutual TLS so a service only accepts calls from callers with a valid certificate. Then check authorization inside the service as well: the Transfer service confirms the customer owns the source account, instead of trusting whatever account number arrived.

Expect "JWT versus sessions". A JWT is a signed token any service can verify on its own with the issuer's public key, so there's no session store to look up on each call. The catch is revocation: a stolen token works until it expires, which is why access tokens live for minutes and get refreshed. A server-side session is easy to revoke but needs a shared store every request checks. Finish with data. Encrypt account data at rest and in transit, mask account numbers in logs, and keep the audit trail as its own append-only record that no service can edit.

The Citi angle
Citi is a regulated bank, so audit and access control are fair game even when the question started as performance. Have one concrete story ready from your own system: how you traced a production incident through logs, or who could read customer data and how anyone checked.

Practice the core in code

Kafka idempotency and dead letter queues came up together in a June 2026 Citi senior loop, and this problem is both ideas in a few dozen lines. The broker, the network and the database are gone. What's left is the rule that protects the money. Every event id is handled once, whatever the outcome. Only messages that can never be processed go to the dead letter list.

1

Idempotent transfer consumer with a dead letter list

Easy
Problem
A consumer reads transfer events from a message bus. The bus can deliver the same event more than once, and an event must never move money twice.

Write a class TransferConsumer. open_account(account, balance) creates an account and returns true, or returns false and changes nothing if it already exists. balance(account) returns the current balance, or null for an unknown account.

handle(event_id, from_account, to_account, amount) processes one event and returns a string. If this event_id was handled before, return "duplicate" and change nothing, whatever the first outcome was.

Otherwise, if either account is unknown or the amount is not positive, add the event id to the dead letter list and return "dead_letter". If the source balance is less than the amount, return "declined". Otherwise move the money and return "applied". dead_letters() returns the dead-lettered event ids in the order they arrived.

Input encoding. A test case is a JSON array of operations. The first entry is ["TransferConsumer", []] and each later entry is [method, [args]]. The expected array holds each operation's return, with null for the constructor.
  1. TransferConsumer()
  2. open_account("a", 100)→ true
  3. open_account("b", 0)→ true
  4. handle("e1", "a", "b", 30)→ "applied"
  5. handle("e1", "a", "b", 30)→ "duplicate"
  6. balance("a")→ 70
  7. balance("b")→ 30

The second delivery of e1 is a redelivery, so it returns "duplicate" and the money moves once.

How this uses the pattern

Keep a set of handled event ids, a map of balances and a list of dead letters. Check the set first, and add the id to it before deciding the outcome.

Write it here, or go full screen with the problem, hints and solution beside the editor.

Idempotent transfer consumer with a dead letter list

Loading...
Click "Run" to execute your code
The Citi angle
This is the processed-events table from the design, plus the line between a declined transfer and a poison message. Most bugs come from checking the duplicate rule only on success. A declined event that gets redelivered later would then go through, which is a transfer the customer was told had failed.
Take it further
Ask what happens if the process crashes between moving the money and recording the id. In the real system both writes sit in one database transaction. Then ask how long to keep handled ids: longer than the bus keeps messages, or an old redelivery slips through. A natural extension adds a retry count, so a transient error is retried a few times before it is dead-lettered.

What each level is expected to show

Citi engineers are graded on a C-scale with corporate titles on top, and the depth of this conversation tracks the grade. The bar isn't extreme. One SVP candidate in Pune (2024) described the design part as "system design (easy one)". What rises with the grade is how much of the system you own in your answer. C11 Officer and C12 AVP. Many C11 loops have no design at all. Where it does come up, mostly in India C11 and AVP loops, it's concept checks on your own project. Draw the services you worked on and how they talk. Then answer the Kafka, saga, dead letter and latency questions about code you wrote. Being clear about which parts were yours matters more than covering the whole system. C13 VP and senior developer roles in the US and Canada. A real design discussion is expected. Drive the walkthrough without prompting, bring up failure handling before you're asked, and give numbers. One March 2026 US senior candidate said the questions leaned toward distributed architecture. C14 SVP, lead and architect roles. You're expected to defend decisions at the level of the whole platform: why these service boundaries, what you'd change now, how it scales and what it costs to run. Expect resiliency and technology upgrades to come up as their own topic. Trade-offs you made and later regretted make for some of the strongest answers.

The bar: pick one system and draw it cleanly, in the order a request travels. Then answer each "what if this fails" question with what your system did, what it cost, and what you'd build differently.

Key Takeaways

  • ✓Prepare one real system you can draw in five minutes, following a request through it, and defend for forty.
  • ✓Make every hop idempotent: a key on the API, an event id record in each consumer, a reference on outside calls.
  • ✓For changes across services, use a saga with an outbox, timeouts and a sweeper, and skip it when one database is enough.
  • ✓Answer slowness with timeouts, backoff, circuit breakers and dead letters, and know the settings your own system used.
Citi interview guide

Know what Citi asks before you walk in.

26 coding · 6 system design · 20 behavioral questions

Get Premium$49 a year · Instant access
Or start freeNo card.

Get their questions first.

Citi System Design Interview QuestionsHad your Citi interview?How we research

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.