Start here
How the system fits together
Follow the boundaries that protect a ticket reservation, payment, and delivery.
Echo & Aura is an event ticketing application for one organizer. Buyers register for tickets and transfer money through bKash. An admin checks the payment statement before the application issues tickets and sends them by email.
The engineering problem is keeping the order consistent while those actions happen at different times. A reservation must survive a slow payment, two buyers must not claim the same last ticket, and an email failure must not undo an approved order.
For every service around the application, from Cloudflare to the backups, see the system at a glance.
New to a term such as paisa, hold or after-commit? The glossary defines each one and links to where it is explained.
Begin with the boundaries
ORDER REGISTRATION · EMAIL PATH
- BrowserChoose tickets
- ApplicationValidate and coordinate
- PostgresReserve, audit, commit
- Redis + BullMQQueue after commit
- WorkerRender, retry, deliver
The application receives a request and coordinates the work. A service defines the business operation; repositories perform its database reads and writes. Postgres owns durable state: orders, reservations, tickets, and audit history. Redis and BullMQ hold background jobs. The worker renders and delivers emails outside the buyer's request.
A database transaction groups related writes so they either all commit or all roll back. Registration reserves inventory, creates the order, and records the audit event in one transaction. The application queues the order-created email after that transaction commits.
Follow an order
- Register. The buyer chooses a ticket type and quantity. The server reads the price and calculates the total in integer paisa; 100 paisa equals ৳1.
- Reserve. A conditional database UPDATE holds available inventory for
20 minutes. If no row qualifies, the request is sold out. The order starts
as
pending_payment. - Submit payment. The buyer transfers money through bKash and submits the
transaction ID and sending phone number. The order becomes
pending_verification. The database enforces transaction ID uniqueness. - Verify and issue. The admin checks the statement and approves or rejects. Approval converts held inventory to sold and creates the tickets. A submitted payment awaits this decision; the unpaid-hold expiry does not expire an order awaiting verification.
- Deliver. After approval commits, the application queues delivery for the worker. A failed email can retry without repeating payment approval.
Manual bKash payment happens outside the application. The application records the buyer's claim and the admin's decision; it does not call a payment API.
Find the implementation and its evidence
| Question | Source | Test or decision |
|---|---|---|
| How does registration reserve stock? | Order service | Real-Postgres concurrency test |
| What prevents overselling? | Inventory repository | Atomic inventory decision |
| Who can approve and issue tickets? | Fulfilment service | Single fulfilment path |
These links use the source revision shown below the page. They let you read the implementation that corresponds to this docs build.
Read the code with a purpose
Reading the codebase
Where requests, services, repositories and background work live, and how to connect an explanation to its test.
Buy a ticket
The complete learning path: one order from registration to delivery.
Who gets the last ticket?
Two buyers, one ticket: the race the reservation query settles.
Order states
The status contract and its failure behavior.
Source revision: 4da5b5f · View this page's source