A scalable and reliable microservice app for ticket transaction.
Each service can be deployed independently, and all other services will not be affected if any of them crashes.
Services communicate each other asynchronously using event broker.
This project uses common library @twtix/common to share code between services for consistency and conventions accross services and common middlewares, such as:
- Event message subjects and data structures
- Base listener and base publisher
- Checking current user from JWT and resource authorization
- Request validation
- Error definition and handling
Service that handles user signup, signin, signout, and get user info.
Worker service that handles ticket order expiration timer.
This service will start to run whenever a new order is created, and will cancel the order when the timer finish counting.
Service that handles order for ticket.
Order is created whenever user attempts to buy a ticket.
Once a ticket is ordered by User A, it will be locked to allow User A to finish his transaction. User B cannot order the same ticket while User A's order is not expired. Ticket will be unlocked once User A failed to finish his transaction within the expiration time.
Authenticated user can see their order history.
Service that handles user payment given a valid order and user. This service will update the order status whenever payment is failed or succeeds.
Service that handles tickets resource, handles ticket creation and editing.
List of tickets for sale can be shown to all visitors.
Ticket can only be created and ordered by authenticated user.
Ordered ticket will be locked for an interval to allow user finish the transaction.
Ticket can be edited whenever it is not locked.
Once a ticket is successfully ordered and transactioned, it will no longer appear in index page.
-
Orders: PaymentCreatedListener will publish OrderCompleted event with the order ticket id Payments: OrderCompletedListener will update order status to be 'completed' in db
-
Added logic to in Payments to reject payments from cancelled/completed order.
- add minimal 50 jpy for stripe
- use kafka