CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/Student Projects (College Reports)

πŸŽ“ Student Projects (College Reports) Β· Sequence

Railway Reservation System Sequence Diagram (Book a Ticket)

Booking a train ticket online, from the train search to the e-ticket by SMS and email, including the waiting list and failed payments.

More Student Projects (College Reports) templates

Opening a template is free and never counts toward your daily diagrams. Asking the AI to change it counts as one.

Drawing diagram…

What this diagram shows

  • Seats held while the passenger pays
  • Waiting-list number when the train is full
  • PNR sent by SMS and email

Prompt used

Sequence diagram for booking a train ticket online: the passenger searches trains between two stations for a date; the reservation system checks seat availability; the passenger enters passenger details and a class; the system holds the seats; the payment gateway charges the passenger; on success seats are allocated, a PNR is generated and the e-ticket is sent by SMS and email; if no seats are left the passenger gets a waiting-list number; on payment failure the hold is released.

Mermaid code
sequenceDiagram
    autonumber
    actor passenger as Passenger
    participant system as Reservation System
    participant gateway as Payment Gateway
    participant sms as SMS Service
    participant email as Email Service
    passenger->>system: GET /api/v1/trains/search?from=DEL&to=BOM&date=2026-12-20
    system-->>passenger: 200 OK {trains: [{trainNo: 12952, classes: [1A, 2A]}]}
    passenger->>system: POST /api/v1/bookings/hold {trainNo: 12952, class: 2A, passengerDetails}
    alt Seats available
        system-->>passenger: 201 Created {holdId: HLD987, expiresAt: 10m}
        passenger->>gateway: POST /v1/checkout {holdId: HLD987, amount: 1500}
        gateway-->>passenger: 200 OK {paymentToken: TOK_456}
        passenger->>gateway: POST /v1/payments/charge {paymentToken: TOK_456}
        alt Payment successful
            gateway-->>passenger: 200 OK {status: SUCCESS, txnId: TXN1001}
            gateway-)system: POST /webhooks/payments {holdId: HLD987, status: SUCCESS}
            Note over system: Allocate seats and generate 10-digit PNR
            system-)sms: POST /v1/sms/send {mobile: passenger mobile, text: PNR confirmed}
            system-)email: POST /v1/email/send {to: passenger email, attachment: e-ticket PDF}
            system-->>passenger: 200 OK {pnr: 8201928374, status: CONFIRMED}
        else Payment failed
            gateway-->>passenger: 402 Payment Required {status: FAILED, reason: Card declined}
            gateway-)system: POST /webhooks/payments {holdId: HLD987, status: FAILED}
            Note over system: Release seat hold back to inventory
            system-->>passenger: 400 Bad Request {status: FAILED, message: Payment failed, seats released}
        end
    else No seats available
        system-->>passenger: 200 OK {status: WAITING_LIST, wlNumber: WL-42}
    end

Inside this diagram

A sequence diagram with 5 participants and 16 messages, in the order they happen.

People

  • Passenger

Systems

  • Reservation System
  • Payment Gateway
  • SMS Service
  • Email Service

Steps in order

  • 1. Passenger β†’ Reservation System: GET /api/v1/trains/search?from=DEL&to=BOM&date=2026-12-20
  • 2. Reservation System β†’ Passenger: 200 OK {trains: [{trainNo: 12952, classes: [1A, 2A]}]} (reply)
  • 3. Passenger β†’ Reservation System: POST /api/v1/bookings/hold {trainNo: 12952, class: 2A, passengerDetails}
  • 4. Reservation System β†’ Passenger: 201 Created {holdId: HLD987, expiresAt: 10m} (reply)
  • 5. Passenger β†’ Payment Gateway: POST /v1/checkout {holdId: HLD987, amount: 1500}
  • 6. Payment Gateway β†’ Passenger: 200 OK {paymentToken: TOK_456} (reply)
  • 7. Passenger β†’ Payment Gateway: POST /v1/payments/charge {paymentToken: TOK_456}
  • 8. Payment Gateway β†’ Passenger: 200 OK {status: SUCCESS, txnId: TXN1001} (reply)
  • 9. Payment Gateway β†’ Reservation System: POST /webhooks/payments {holdId: HLD987, status: SUCCESS}
  • 10. Reservation System β†’ SMS Service: POST /v1/sms/send {mobile: passenger mobile, text: PNR confirmed}
  • 11. Reservation System β†’ Email Service: POST /v1/email/send {to: passenger email, attachment: e-ticket PDF}
  • 12. Reservation System β†’ Passenger: 200 OK {pnr: 8201928374, status: CONFIRMED} (reply)
  • 13. Payment Gateway β†’ Passenger: 402 Payment Required {status: FAILED, reason: Card declined} (reply)
  • 14. Payment Gateway β†’ Reservation System: POST /webhooks/payments {holdId: HLD987, status: FAILED}
  • 15. Reservation System β†’ Passenger: 400 Bad Request {status: FAILED, message: Payment failed, seats released} (reply)
  • 16. Reservation System β†’ Passenger: 200 OK {status: WAITING_LIST, wlNumber: WL-42} (reply)

Conditions and loops

  • If: Seats available
  • If: Payment successful
  • Otherwise: Payment failed
  • Otherwise: No seats available

Make your own diagram like this

Describe your own system in plain English and the AI sequence diagram generator draws it in seconds, in the same style as this template.

Related templates

Use CaseStudent Projects (College Reports)

Library Management System Use Case Diagram

Who uses a college library system and what each of them can do: members, the librarian and the system administrator.

Database ERDStudent Projects (College Reports)

Library Management System ER Diagram

The database of a library system: books and their copies, authors, members, loans, reservations and fines, with keys and cardinality.

Data FlowStudent Projects (College Reports)

Library Management System Data Flow Diagram (Level 1)

How data moves through a library system: members and the librarian, the main processes, and the data stores they read and write.

Class UMLStudent Projects (College Reports)

Library Management System Class Diagram

The main classes of a library system with attributes, methods and UML relationships.

SequenceStudent Projects (College Reports)

Library Management System Sequence Diagram (Issue a Book)

The steps when a member borrows a book: checks, loan record and the copy status update.

Use CaseStudent Projects (College Reports)

Online Examination System Use Case Diagram

What students, examiners and the administrator do in an online examination system.