A Spring Boot GraphQL API for event management, allowing users to create events, manage venues, and purchase tickets.
- Java 21
- Spring Boot 4.0.2
- Spring GraphQL
- Spring Data JPA
- PostgreSQL 15
- Flyway (database migrations)
- Lombok
- Maven
- Users: Create, update, delete, and query users
- Venues: Manage venue information with address and seating capacity
- Events: Create events at venues with start/end dates and event types
- Tickets: Purchase and cancel tickets for events
- Java 21
- Maven
- PostgreSQL 15 (or Docker)
Using Docker:
docker run -d --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 postgres:15The application will automatically create the event-hub database on startup.
Update src/main/resources/application.properties if your database credentials differ:
spring.datasource.url=jdbc:postgresql://localhost:5432/event-hub
spring.datasource.username=postgres
spring.datasource.password=password./mvnw spring-boot:runThe application starts on http://localhost:8080.
Access the interactive GraphQL playground at: http://localhost:8080/graphiql
Get all users:
query {
getAllUsers {
id
name
email
}
}Create a user:
mutation {
createUser(input: {
name: "John Doe"
email: "john@example.com"
password: "secret123"
phoneNumber: "1234567890"
}) {
id
name
email
}
}Create a venue:
mutation {
createVenue(input: {
name: "Convention Center"
addressLine1: "123 Main St"
addressLine2: "Suite 100"
city: "New York"
state: "NY"
zipCode: "10001"
country: "USA"
totalSeatingCapacity: 5000
venueType: "INDOOR"
}) {
id
name
}
}Create an event:
mutation {
createEvent(input: {
name: "Tech Conference 2026"
description: "Annual technology conference"
eventStartDate: "2026-03-15T09:00:00"
eventEndDate: "2026-03-15T18:00:00"
eventType: "CONFERENCE"
venueId: 1
}) {
id
name
venue {
name
}
}
}Buy a ticket:
mutation {
buyTicket(input: {
userId: 1
eventId: 1
ticketType: "VIP"
price: 150.00
quantity: 2
}) {
id
ticketType
price
}
}src/main/java/com/eventHub/dev/
├── config/ # Configuration classes
├── controller/ # GraphQL controllers
├── DTO/ # Data Transfer Objects
├── enums/ # Enum types (EventType, VenueType, TicketType)
├── model/ # JPA entities
├── repository/ # Spring Data repositories
└── service/ # Business logic
src/main/resources/
├── graphql/ # GraphQL schema files
├── db/migrations/ # Flyway migration scripts
└── application.properties
- user - User accounts
- venue - Event venues with location details
- events - Events with dates, types, and venue references
- ticket - Tickets linking users to events
MIT