
🚆 Railways & Public Transport · C4 Architecture · Pro
A railway reservation system in the style of IRCTC: seat inventory per train and class, waitlists, Tatkal quota, payments and e-tickets.
C4 Architecture diagrams are part of Pro. Anyone can view this one; generating and editing it needs Pro.
Drawing diagram…
Train reservation system: passengers book on the web and mobile app through an API gateway with a queue for Tatkal rush. The availability service answers seat availability per train, date and class from a cache. The booking service locks berths in the seat inventory, creates the PNR, and calls the payment service. The waitlist service confirms waitlisted PNRs when cancellations happen. Tickets are sent by SMS and email, and the chart preparation service finalises berths before departure.
C4Container
title Train Reservation System
Person(pax, "Passenger", "Books and cancels tickets")
System_Boundary(rs, "Reservation System") {
Container(gw, "API Gateway and Queue", "NGINX + virtual waiting room", "Handles Tatkal rush")
Container(av, "Availability Service", "Java", "Seats per train, date, class")
Container(bk, "Booking Service", "Java", "PNR creation and berth locking")
Container(wl, "Waitlist Service", "Java", "Confirms on cancellation")
Container(chart, "Chart Preparation", "Batch job", "Final berth allocation")
ContainerDb(inv, "Seat Inventory", "Oracle", "Berths per coach")
ContainerDb(cache, "Availability Cache", "Redis", "Fast seat counts")
}
System_Ext(pg, "Payment Gateway", "UPI, cards, netbanking")
System_Ext(sms, "SMS and Email", "E-tickets")
Rel(pax, gw, "Books", "HTTPS")
Rel(gw, av, "Checks seats")
Rel(av, cache, "Reads")
Rel(gw, bk, "Books")
Rel(bk, inv, "Locks berths")
Rel(bk, pg, "Takes payment")
Rel(bk, sms, "Sends e-ticket")
Rel(wl, inv, "Reallocates berths")
Rel(chart, inv, "Finalises chart")The states of a train ticket from booking to journey, including RAC and waitlist confirmation and cancellation.
How a metro fare is charged with a smart card or bank card: tap in at the entry gate, tap out at the exit, fare by distance and balance update.
How a city bus app shows live bus positions and arrival times: GPS devices on buses, a prediction model and updates to apps and stop displays.
How a modern railway signalling network is connected: interlocking at stations, track circuits, train control radio and the central traffic control centre.
A journey planner that combines metro, bus, suburban train and last-mile options into one trip plan with a single ticket.
Tables for train operations: trains, routes, stations, scheduled stops, coaches and daily running with actual times.