Skip to content

Siddharthpratapsingh/eventHub-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Hub

A Spring Boot GraphQL API for event management, allowing users to create events, manage venues, and purchase tickets.

Tech Stack

  • Java 21
  • Spring Boot 4.0.2
  • Spring GraphQL
  • Spring Data JPA
  • PostgreSQL 15
  • Flyway (database migrations)
  • Lombok
  • Maven

Features

  • 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

Prerequisites

  • Java 21
  • Maven
  • PostgreSQL 15 (or Docker)

Getting Started

1. Start PostgreSQL

Using Docker:

docker run -d --name postgres -e POSTGRES_PASSWORD=password -p 5432:5432 postgres:15

2. Configure Database

The 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

3. Run the Application

./mvnw spring-boot:run

The application starts on http://localhost:8080.

GraphQL API

GraphiQL Playground

Access the interactive GraphQL playground at: http://localhost:8080/graphiql

Example Queries

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
  }
}

Project Structure

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

Database Schema

  • user - User accounts
  • venue - Event venues with location details
  • events - Events with dates, types, and venue references
  • ticket - Tickets linking users to events

License

MIT

About

Application created using springboot and graphql

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages