Skip to content

negrahodzic/Bookatripix

Repository files navigation

BookATripix - Event Booking System

System Architecture

BookATripix implements a service-oriented architecture separating the concerns between:

  • Java Backend API: Handles core business logic, event data, and booking management (might be reconsidered)
  • Next.js Frontend: Provides the user interface and handles user authentication
  • Firebase: Stores user account data for the frontend

Data Flow

  1. Organisations register with the system and receive an API key
  2. Organisations use their API key to manage events through the API
  3. Users log in through the frontend (Firebase authentication)
  4. Frontend communicates with the Java API for event data and bookings
  5. Event data is stored in JSON files on the server (planing to migrate to MongoDB)

API Implementation Details

Data Storage

  • Currently uses JSON file-based storage
  • Events stored in events.json with full event information
  • Planning to migrate to MongoDB

Security & Filtering

  • API Key Authentication: Most routes protected with API key verification
  • Admin Authentication: Admin-only routes use a separate admin key
  • CORS Implementation:
    • Custom filter handles cross-origin requests
    • Validates origins against organisation allowed origins
  • Request Filtering: Routes filtered based on auth requirements

Advanced Search Implementation

  • Text Search Engine: Custom search across multiple fields
  • Ranking Algorithm: Scores results based on match quality
    • Higher weight for title matches (10 points)
    • Medium weight for description matches (5 points)
    • Lower weight for venue matches (3 points)
    • Bonus points (15) for matching all search terms
  • Fuzzy Matching: Uses Levenshtein distance algorithm
  • Stop Word Filtering: Ignores common words
  • Multiple Field Search: Searches across title, description, venue
  • Filtering System

API Endpoints

Method Endpoint Description Auth Required
GET /events List all events API Key
GET /events/{eventId} Get event details API Key
GET /events/search Search events with filters API Key
POST /events/{eventId}/book Book tickets for event API Key
POST /events Create new event API Key
PUT /events/{eventId} Update event API Key
GET /organisations List all organizations Admin Key
POST /organisations/register Register new organization No
POST /organisations/{orgId}/regenerate-key Regenerate API key API Key

Search Parameters

  • query: Text search across name, description, venue
  • categories: Comma separated list of event categories
  • address: Location search
  • startDate & endDate: Date range filtering
  • timeOfDay: Filter by part of day (morning, afternoon, evening)
  • minPrice & maxPrice: Price range filtering
  • available: Filter to only available events
  • minAge & maxAge: Age restriction filtering
  • status: Filter by event status
  • accessible: Filter to accessible venues

Frontend Implementation

  • Authentication: Firebase handles user accounts and roles
  • API Integration
  • Protected Routes: Role-based access control
  • Responsive Design: Tailwind CSS

Setup Instructions

Backend:

  • Deploy the Java application to a servlet container (Tomcat)
  • Application runs on port 8080
  • Endpoint base URL: http://localhost:8080/Bookatripix/webresources/

Frontend:

  • Install dependencies with npm install
  • Configure Firebase credentials
  • Run development server with npm run dev
  • Access the application at http://localhost:3000

About

Implemented a complete event booking platform using Service-Oriented Architecture with Java microservices, Next.js frontend, and advanced search capabilities featuring fuzzy matching algorithms and multi-tenant API key authentication.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages