Desi System Design
Bunty Batao · System design

IRCTC Tatkal booking

Tatkal seats vanish in moments, yet one seat never goes to two people. How?

  1. 1

    Waiting room

    Everyone queues, a few are let in at a time.

  2. 2

    Cache

    Seat counts are answered from memory, not the database.

  3. 3

    Seat in segments

    Delhi to Kanpur and Kanpur to Howrah can be two passengers on one seat.

  4. 4

    Lock + unique rule

    The database itself refuses a double booking.

  5. 5

    Seat hold

    The seat waits for you during payment, and returns if payment fails.

  6. 6

    Idempotency key

    Tap Pay twice, get charged once.

Takeaway

A seat is free only if it is free on every segment of your journey.

Your turn

How should a waiting-list passenger get a cancelled seat?

The answer is in the PDF. Or tell Bunty in the reel's comments.

Simplified example, not IRCTC's actual architecture.

Desi System Design cover for IRCTC Tatkal booking