A complete Event Management System Backend built with Spring Boot, Java, MySQL, Spring Data JPA, Spring Security, and Spring Mail.
This backend supports user registration, host registration, admin authentication, event creation, event booking, seat selection, MFA verification, dashboards, reviews, approval workflows, cancellation, and refund management.
The EMS Backend is the server-side application for an Event Management System. It provides REST APIs for clients, hosts, and admins.
Users can register, log in with MFA verification, browse events, book tickets, select seats, manage bookings, cancel bookings, and submit reviews.
Hosts can register, log in with MFA verification, create events, manage their hosted events, view bookings, cancel events, process refunds, and reply to reviews.
Admins can manage users, hosts, events, approvals, and overall platform statistics through admin dashboard APIs.
- User registration
- User login with MFA verification
- Host registration
- Host login with MFA verification
- Admin registration and login
- Admin MFA verification
- Event creation by hosts
- View all events
- View events by host
- View event details
- Event approval status workflow
- User approval workflow
- Host approval workflow
- Ticket booking
- Seat layout generation
- Selected seat booking
- Booking cancellation
- Refund status management
- Host dashboard statistics
- Admin dashboard statistics
- Event reviews
- Host replies to reviews
- Public review listing
- My events / user booking history
- Email-based MFA support
- Demo mode for MFA when mail is disabled
- MySQL database integration
- REST API architecture
- CORS support for frontend integration
- Java 17
- Spring Boot 3.5.4
- Spring Web
- Spring Data JPA
- Spring Security
- Spring Mail
- MySQL
- Hibernate
- Lombok
- Jakarta Persistence API
- Jakarta Validation API
- Maven
emsbackend/
├── .mvn/
├── sql/
│ └── seed_events_50.sql
│
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── sihe/
│ │ │ └── emsbackend/
│ │ │ ├── config/
│ │ │ │ ├── SecurityConfig.java
│ │ │ │ └── WebConfig.java
│ │ │ │
│ │ │ ├── controller/
│ │ │ │ ├── AdminAuthController.java
│ │ │ │ ├── AdminDashboardController.java
│ │ │ │ ├── AuthController.java
│ │ │ │ ├── BookingController.java
│ │ │ │ ├── EventController.java
│ │ │ │ ├── HostController.java
│ │ │ │ ├── HostDashboardController.java
│ │ │ │ ├── ReviewController.java
│ │ │ │ └── UserController.java
│ │ │ │
│ │ │ ├── dto/
│ │ │ │ ├── HostLoginRequest.java
│ │ │ │ ├── LoginRequest.java
│ │ │ │ ├── MfaChallengeResponse.java
│ │ │ │ └── MfaVerifyRequest.java
│ │ │ │
│ │ │ ├── exception/
│ │ │ │ ├── InvalidCredentialsException.java
│ │ │ │ └── UserNotFoundException.java
│ │ │ │
│ │ │ ├── model/
│ │ │ │ ├── Admin.java
│ │ │ │ ├── Booking.java
│ │ │ │ ├── Event.java
│ │ │ │ ├── Host.java
│ │ │ │ ├── MfaChallenge.java
│ │ │ │ ├── Review.java
│ │ │ │ └── User.java
│ │ │ │
│ │ │ ├── repository/
│ │ │ │ ├── AdminRepository.java
│ │ │ │ ├── BookingRepository.java
│ │ │ │ ├── EventRepository.java
│ │ │ │ ├── HostRepository.java
│ │ │ │ ├── MfaChallengeRepository.java
│ │ │ │ ├── ReviewRepository.java
│ │ │ │ └── UserRepository.java
│ │ │ │
│ │ │ ├── service/
│ │ │ │ ├── AdminService.java
│ │ │ │ ├── EventService.java
│ │ │ │ ├── HostService.java
│ │ │ │ ├── MfaDeliveryService.java
│ │ │ │ ├── MfaService.java
│ │ │ │ ├── NotificationService.java
│ │ │ │ ├── SeatLayoutService.java
│ │ │ │ └── UserService.java
│ │ │ │
│ │ │ └── EmsbackendApplication.java
│ │ │
│ │ └── resources/
│ │ └── application.properties
│ │
│ └── test/
│
├── .gitignore
├── mvnw
├── mvnw.cmd
├── pom.xml
└── README.mdThe user module handles customer-related operations.
Main features:
- User registration
- User login
- MFA verification
- User profile update
- Get user by ID
- User booking history
The host module handles event organiser functionality.
Main features:
- Host registration
- Host login
- MFA verification
- Host profile update
- Create events
- Manage hosted events
- View event bookings
- Cancel events
- Manage refunds
- Reply to reviews
The admin module handles platform management.
Main features:
- Admin registration
- Admin login
- MFA verification
- View platform dashboard
- View users, hosts, and events
- Approve or reject users
- Approve or reject hosts
- Approve or reject events
The event module handles event-related APIs.
Main features:
- Create event
- Get all events
- Get event by ID
- Get events by host
- Get event seat layout
- Cancel event
- Track event status
- Track approval status
The booking module handles ticket booking and cancellation.
Main features:
- Create booking
- Assign selected seats
- Validate ticket quantity
- Calculate total price on the backend
- Reduce ticket availability after booking
- View bookings by user
- View booking details
- Cancel booking
- Mark refund as pending
The review module handles customer feedback.
Main features:
- Create event review
- Validate rating from 1 to 5
- View reviews by event
- View reviews by host
- View public reviews
- Host reply to reviews
The MFA module adds an extra verification layer during login.
Main features:
- Generate verification code
- Store hashed MFA code
- Send code using email
- Demo mode when mail is disabled
- Verify MFA challenge
- Expire previous active challenges
- Prevent reused verification codes
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/users/register |
Register a new user |
PUT |
/api/users/{id} |
Update user details |
GET |
/api/users/{id} |
Get user by ID |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/login |
User login and MFA challenge creation |
POST |
/api/login/verify-mfa |
Verify user MFA code |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/hosts/register |
Register a new host |
POST |
/api/hosts/login |
Host login and MFA challenge creation |
POST |
/api/hosts/login/verify-mfa |
Verify host MFA code |
PUT |
/api/hosts/{id} |
Update host details |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/admin/register |
Register an admin |
POST |
/api/admin/login |
Admin login and MFA challenge creation |
POST |
/api/admin/login/verify-mfa |
Verify admin MFA code |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/admin/dashboard |
Get admin dashboard data |
PATCH |
/api/admin/dashboard/users/{id}/approval |
Update user approval status |
PATCH |
/api/admin/dashboard/hosts/{id}/approval |
Update host approval status |
PATCH |
/api/admin/dashboard/events/{id}/approval |
Update event approval status |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/events/create |
Create a new event |
GET |
/api/events/all |
Get all events |
GET |
/api/events/{id} |
Get event by ID |
GET |
/api/events/host/{hostId} |
Get events by host |
GET |
/api/events/{id}/seat-layout |
Get event seat layout |
DELETE |
/api/events/{eventId} |
Cancel an event |
GET |
/api/events/my-events?email=user@example.com |
Get bookings by user email |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/bookings |
Create a booking |
GET |
/api/bookings/user/{userId} |
Get bookings by user |
GET |
/api/bookings/layout/{eventId} |
Get event seat layout |
GET |
/api/bookings/{bookingId} |
Get booking details |
DELETE |
/api/bookings/{bookingId} |
Cancel booking |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/host-dashboard/{hostId} |
Get host dashboard data |
PUT |
/api/host-dashboard/events/{eventId} |
Update host event |
PATCH |
/api/host-dashboard/events/{eventId}/cancel |
Cancel host event |
PATCH |
/api/host-dashboard/bookings/{bookingId}/refund |
Update refund status |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/reviews/event/{eventId} |
Get reviews for an event |
GET |
/api/reviews/host/{hostId} |
Get reviews for a host |
GET |
/api/reviews/public |
Get public reviews |
POST |
/api/reviews |
Create a review |
PATCH |
/api/reviews/{reviewId}/reply |
Add host reply to review |
Stores customer account details.
Typical fields include:
- ID
- First name
- Last name
- Password
- Nickname
- Phone
- Gender
- Approval status
Stores event organiser account details.
Typical fields include:
- ID
- First name
- Last name
- Password
- Mobile number
- Date of birth
- Event category
- Approval status
Stores admin account details.
Typical fields include:
- ID
- Name
- Password
Stores event details.
Fields include:
- ID
- Image URL
- Title
- Category
- Date
- Location
- Description
- Ticket quantity
- Ticket price
- Status
- Approval status
- Created date
- Updated date
- Host
Stores customer booking details.
Typical fields include:
- Booking ID
- Event
- User
- Quantity
- Seat numbers
- Total price
- Booking status
- Refund status
- Refund amount
- Cancellation reason
- Notification message
- Cancelled date
- Refunded date
Stores customer event reviews.
Typical fields include:
- Review ID
- Event
- User
- Rating
- Comment
- Host reply
- Created date
- Replied date
Stores login verification sessions.
Typical fields include:
- Challenge ID
- Principal type
- Principal ID
- Hashed code
- Expiry time
- Consumed status
- Created date
User / Host / Admin submits login details
|
v
Backend validates credentials
|
v
MFA challenge is generated
|
v
Verification code is sent by email or shown in demo mode
|
v
User submits MFA code
|
v
Backend verifies code
|
v
Login is completedUser selects event
|
v
User selects quantity or seats
|
v
Backend validates event and user
|
v
Seat layout service assigns seats
|
v
Backend reduces available ticket quantity
|
v
Booking is saved
|
v
Booking confirmation is returnedUser or host cancels booking/event
|
v
Booking status changes to CANCELLED
|
v
Refund status changes to PENDING
|
v
Refund amount is recorded
|
v
Host updates refund status
|
v
Booking can be marked as REFUNDEDAdmins can approve, reject, or keep pending status for:
- Users
- Hosts
- Events
Supported approval statuses:
PENDING
APPROVED
REJECTEDCommon event statuses:
ACTIVE
CANCELLEDCommon booking statuses:
CONFIRMED
CANCELLED
REFUNDEDCommon refund statuses:
PENDING
REFUNDEDBefore running the project, make sure you have installed:
- Java 17 or higher
- Maven
- MySQL Server
- MySQL Workbench or another database client
- IntelliJ IDEA, VS Code, or another Java IDE
Create a MySQL database:
CREATE DATABASE ems_db;Optional: import seed data from:
sql/seed_events_50.sqlThe project currently uses application.properties.
Recommended configuration:
spring.datasource.url=jdbc:mysql://localhost:3306/ems_db
spring.datasource.username=${DB_USERNAME}
spring.datasource.password=${DB_PASSWORD}
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
server.port=8080
app.mail.enabled=false
app.mail.from=no-reply@ems-demo.local
app.mfa.code-length=6
app.mfa.expiry-minutes=10
spring.mail.host=${MAIL_HOST}
spring.mail.port=587
spring.mail.username=${MAIL_USERNAME}
spring.mail.password=${MAIL_PASSWORD}
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=trueImportant: do not commit real database passwords or email passwords to GitHub.
git clone https://github.com/DANUCKSAN/emsbackend.gitcd emsbackendCreate the database:
CREATE DATABASE ems_db;Update your database username and password in application.properties, or use environment variables.
Using Maven wrapper:
./mvnw spring-boot:runOn Windows:
mvnw.cmd spring-boot:runOr using Maven:
mvn spring-boot:runThe backend will run on:
http://localhost:8080The backend is configured for frontend requests from:
http://localhost:3000This is suitable for a React or Next.js frontend running locally.
./mvnw spring-boot:run./mvnw clean install./mvnw test./mvnw clean package{
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"password": "password123",
"nickname": "Johnny",
"phone": "+61400000000",
"gender": "Male"
}{
"email": "john@example.com",
"password": "password123"
}{
"challengeId": "generated-challenge-id",
"code": "123456"
}{
"firstName": "Sarah",
"lastName": "Smith",
"email": "sarah@example.com",
"password": "password123",
"mobileNumber": "+61400000000",
"eventCategory": "Music"
}{
"title": "Live Music Night",
"category": "Music",
"date": "2026-08-15",
"location": "Sydney",
"description": "A live music event with local artists.",
"ticketQuantity": 100,
"ticketPrice": 49.99,
"imageUrl": "https://example.com/event-image.jpg",
"host": {
"email": "sarah@example.com"
}
}{
"eventId": 1,
"userId": 1,
"quantity": 2,
"selectedSeats": ["A1", "A2"]
}{
"eventId": 1,
"userId": 1,
"rating": 5,
"comment": "Great event and smooth booking experience."
}{
"hostReply": "Thank you for your feedback. We are glad you enjoyed the event."
}{
"approvalStatus": "APPROVED"
}{
"reason": "Event cancelled due to unexpected circumstances."
}{
"refundStatus": "REFUNDED",
"refundAmount": 49.99
}This project includes Spring Security and password hashing support.
Recommended improvements before production:
- Add JWT-based authentication
- Add role-based authorization
- Protect admin and host dashboard APIs
- Move all secrets to environment variables
- Disable public admin registration
- Add request validation
- Add global exception handling
- Add rate limiting
- Add audit logging for admin actions
- Add HTTPS in production
- Add proper CORS configuration for production domains only
This project demonstrates practical backend development skills including:
- Building REST APIs with Spring Boot
- Structuring a layered backend project
- Using Spring Data JPA with MySQL
- Creating entity relationships
- Handling user, host, and admin workflows
- Implementing MFA login verification
- Managing event booking and seat selection
- Handling event cancellation and refund workflows
- Creating dashboard APIs
- Managing review and reply functionality
- Integrating backend APIs with a frontend application
- Add JWT authentication
- Add role-based API authorization
- Add Swagger/OpenAPI documentation
- Add DTO mapping for all request and response objects
- Add global exception handling
- Add validation annotations
- Add email templates for MFA and booking notifications
- Add payment gateway integration
- Add QR code tickets
- Add booking confirmation emails
- Add automated tests
- Add Docker support
- Add Docker Compose with MySQL
- Add CI/CD pipeline using GitHub Actions
- Add deployment documentation
- Add production-ready logging
Event Management System backend built with Spring Boot, MySQL, Spring Security, JPA, MFA login, event booking, host/admin dashboards, reviews, and refund management.
spring-boot
java
mysql
spring-data-jpa
spring-security
spring-mail
rest-api
backend
event-management-system
ems
event-booking
ticket-booking
mfa
admin-dashboard
host-dashboard
seat-booking
refund-management
reviews
lombok
mavenDanucksan Sathiyaraj
GitHub: DANUCKSAN
This project is open-source and available for learning, portfolio, and demonstration purposes.