A backend application for organizing events, managing ticket types, and handling ticket validation, built with Spring Boot and a modern Java stack.
This system enables event organizers to:
- Create and publish events
- Define and manage ticket types
- Allow users to purchase and access tickets
- Validate and cancel tickets
All features are exposed as a RESTful API with JSON payloads.
- Java 23: Main programming language
- Spring Boot: Application framework
- Spring Data JPA: ORM and database interaction
- Lombok: Reduces Java boilerplate
- ModelMapper: Object mapping between entities and DTOs
- PostgreSQL: Database
- Spring Security: Secures endpoints
- jwt: For authentication (see usage in controllers)
- ZXing: Google's library for QR code generation
- Maven: Build & dependency management
All libraries are defined in pom.xml.
controller/— REST API endpoint handlers (controllers)service/— Business logic, domain servicesrepository/— Data access interfacesentities/— JPA entities (database tables)payload/— DTO classes for API requests/responsesexceptions/— Custom exception handlingconfig/— App and security configurationutil/— Utility/helper classes
The API uses URI versioning with all endpoints prefixed with /api/v1/. This versioning strategy:
- Ensures backward compatibility when introducing new API versions
- Allows for clear distinction between different API iterations
- Provides explicit version information in the request path
Future API versions would be accessible via /api/v2/, /api/v3/, etc.
Base path: /api/v1/events
| HTTP Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/events |
List all events for organizer |
| POST | /api/v1/events |
Create a new event |
| GET | /api/v1/events/{id} |
Get event details |
| PUT | /api/v1/events/{id} |
Update event details |
| DELETE | /api/v1/events/{id} |
Delete an event |
Base path: /api/v1/published-events
| HTTP Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/published-events |
List all published events |
| GET | /api/v1/published-events/{eventId} |
Get published event details |
Base path: /api/v1/events/{eventId}/ticket-types
| HTTP Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/events/{eventId}/ticket-types/{ticketTypeId}/tickets |
Purchase ticket for event/type |
Base path: /api/v1/tickets
| HTTP Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/tickets |
List all tickets for the user |
| GET | /api/v1/tickets/{ticketId} |
Get ticket details |
| GET | /api/v1/tickets/{ticketId}/qr-codes |
Get ticket QR code (as an image) |
(Not all endpoints shown; see source for details)
| HTTP Method | Typical Endpoint | Description |
|---|---|---|
| POST | /api/v1/tickets/{ticketId}/validate |
Validate a ticket |
| POST | /api/v1/tickets/{ticketId}/cancel |
Cancel a ticket |
- Payloads are in the
payload.dtospackage. Major examples:CreateEventRequestDto,GetEventDetailsResponseDto,ListEventResponseDtoListPublishedEventResponseDtoListTicketResponseDto,GetTicketResponseDtoTicketValidationRequestDto(contains:id,method)
- Uses PostgreSQL as storage.
- All database configs are in
application.properties. - JPA entities auto-create tables.
Requirements:
- Java 23
- Maven
- PostgreSQL database
Steps:
-
Clone the repository.
-
Configure PostgreSQL connection in
application.properties. -
Build the backend:
./mvnw clean package
-
Run the backend:
./mvnw spring-boot:run
-
API is available at
http://localhost:8080/api/v1/
The system uses Google's ZXing ("Zebra Crossing") library for QR code generation:
- Tickets include QR codes for easy scanning at event entry
- QR codes contain encoded ticket information for validation
- Implementation is in the
QrCodeServicewith the following dependencies:com.google.zxing:core:3.5.1com.google.zxing:javase:3.5.1
Custom exceptions are handled globally for meaningful error messages. See exceptions/GlobalExceptionHandler.java.
- org.springframework.boot:spring-boot-starter-web
- org.springframework.boot:spring-boot-starter-data-jpa
- org.springframework.boot:spring-boot-starter-security
- org.postgresql:postgresql
- org.projectlombok:lombok
- org.modelmapper:modelmapper
- com.google.zxing:core
- com.google.zxing:javase
- (Test) org.springframework.boot:spring-boot-starter-test
See
pom.xmlfor exact versions and further dependencies.
Authentication is managed via JWT; endpoints utilize the Jwt principal. Ensure you setup authorization headers as required.
[License not specified — add details here]
Developed by Ritik.