Welcome to the Ticket Booking API! 🚀 This API allows users to book and manage event tickets securely using JWT authentication and is built using Spring Boot with MongoDB as the database.
🔹 Admin Features:
- 🛠️ Create, update, delete, and view events.
- 📊 View all customer bookings.
- 👤 View all registered users.
🔹 User Features:
- 🎫 Book and cancel tickets.
- 💰 Add and remove balance from the wallet.
- 🔍 Filter events by various criteria (date, category, rating, etc.).
- 🔐 Secure authentication with JWT.
- ⏳ Rate limiting to prevent abuse.
The API is deployed on Koyeb and can be accessed at:
👉 Live API
Swagger UI is enabled for API testing and documentation.
- Spring Boot (Backend framework)
- MongoDB (NoSQL Database)
- Spring Security (JWT-based authentication)
- Stripe API (For payment processing)
- SpringDoc OpenAPI (For API documentation)
$ git clone https://github.com/Progambler227788/TicketManagement-SpringBoot.git
$ cd TicketManagement-SpringBoot
Create a .env
file in the root directory and set the required values:
SERVER_PORT=8080
MONGO_URI=mongodb+srv://your-username:[email protected]/ticketdb
SECRET_KEY=your-secret-key
STRIPE_SECRET=your-stripe-secret-key
STRIPE_API=your-stripe-api-key
$ mvn clean install
$ mvn spring-boot:run
The API will be accessible at http://localhost:8080
Method | Endpoint | Description |
---|---|---|
POST |
/api/auth/signup |
Register a new user |
POST |
/api/auth/login |
Authenticate and get JWT token |
PUT |
/api/auth/updateProfile |
Update user profile |
Method | Endpoint | Description |
---|---|---|
POST |
/api/admin/events/addEvent |
Add a new event |
GET |
/api/admin/events/getAllEvents |
Get all events |
GET |
/api/admin/users/getAllUsers |
Get all registered users |
GET |
/api/admin/users/getAllBookings |
Get all bookings |
DELETE |
/api/admin/events/{id} |
Delete an event by ID |
DELETE |
/api/admin/events/deleteAllEvents |
Delete all events |
Method | Endpoint | Description |
---|---|---|
POST |
/api/user/profile/bookTicket |
Book a ticket |
DELETE |
/api/user/profile/cancelTicket |
Cancel a ticket |
GET |
/api/user/profile/getBookings |
Get user bookings |
POST |
/api/user/profile/wallet/addBalance |
Add balance to wallet |
POST |
/api/user/profile/wallet/deductBalance |
Deduct balance from wallet |
GET |
/api/user/profile/wallet/getUserBalance |
Get wallet balance |
GET |
/api/user/profile/events/searchByCategory |
Search events by category |
GET |
/api/user/profile/events/searchByDateRange |
Search events by date range |
GET |
/api/user/profile/events/searchByLocation |
Search events by location |
GET |
/api/user/profile/events/searchByTitleOrDescription |
Search events by title or description |
- JWT Authentication: Secure endpoints require a valid JWT token.
- Role-Based Access Control (RBAC): Users must have
ROLE_USER
orROLE_ADMIN
to access specific endpoints. - Rate Limiting: Protects against abuse by limiting API requests.
Sign up at Koyeb
- Connect your GitHub repository
- Select the appropriate branch
- Configure environment variables
Koyeb will automatically build and deploy your application
Feel free to fork this project, create a feature branch, and submit a pull request. Contributions are always welcome!
Happy Coding! 🚀