This project is a full-stack ticket booking system with an integrated wallet and admin dashboard. It enables users to reserve and book event seats while ensuring data consistency, concurrency safety, and transactional integrity.
- User registration & login (JWT-based authentication)
- Add money to the wallet
- View wallet balance & transaction history
- Browse events
- View seat availability
- Reserve seats (with 5-minute expiry)
- Book seats using your wallet
- View booking history
- Admin authentication
- Create/update/delete events
- Bulk create and manage seats
- Monitor bookings
- View wallet transactions
- Cancel bookings
- Process refunds
- RESTful APIs
- Business logic implementation
- Concurrency handling
- Transaction management
- Idempotency handling
- User interface for booking
- Wallet dashboard
- Admin panel
-
MongoDB (NoSQL)
-
Optimized schema design for:
- Users
- Wallet transactions
- Events
- Seats
- Bookings
- Node.js
- Express.js
- TypeScript
- Next.js (Recommended)
- Tailwind CSS
- ShadCN UI
- Redux (State management)
- MongoDB (with Mongoose)
- User signup & login
- Admin login
- JWT-based authentication
- Password hashing (bcrypt)
- Token expiration & refresh strategy
- Role-based access control (User/Admin)
- Credit (Add money)
- Debit (Booking payment)
- Transaction history
- Optional: Wallet transfer
- β No negative balance
- β Use integer values (paise/cents)
- β Maintain transaction ledger
{
userId: ObjectId,
balance: number,
transactions: [
{
type: "credit" | "debit",
amount: number,
status: "success" | "failed",
referenceId: string
}
]
}- List events
- View seat availability
- Reserve seats
- Book seats
AVAILABLE β RESERVED β BOOKED
- Seats are locked for 5 minutes
- Expired reservations are auto-released
- Reserve seats
- Validate reservation
- Deduct wallet balance
- Confirm booking
- Atomic operations (all-or-nothing)
- No double booking
- No double spending
- Booking history
- Wallet transaction history
- Create/update/delete events
- Bulk seat creation
- View seat states
-
View all bookings
-
Filter by:
- User
- Event
- Status
- View all transactions
- Cancel booking
- Refund wallet
- Prevent double booking
- Prevent race conditions in wallet deduction
- APIs must be retry-safe
- Prevent duplicate booking/payment
- Reservation timeout (5 minutes)
- Auto-release seats
- Booking + payment must succeed or fail together
- Parallel booking requests for the same seat
- Wallet race conditions
- Expired reservations during payment
- Duplicate API requests
- Partial failures in booking flow
Clone Repository
mkdir project
git clone <repo-url>
cd projectInstall node modules
npm installStart the app locally in your system (http://localhost:3000)
npm run devCreate a build of the application
npm run buildTo deploy this project, run
npm run start- MongoDB Transactions for atomic booking & payment
- Optimistic/Pessimistic locking for seat reservation
- Separate Wallet Ledger for auditability
- Reservation expiry via TTL / cron job
- Idempotency keys for payment APIs
- Payment gateway integration
- WebSockets for real-time seat updates