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
- Organisations register with the system and receive an API key
- Organisations use their API key to manage events through the API
- Users log in through the frontend (Firebase authentication)
- Frontend communicates with the Java API for event data and bookings
- Event data is stored in JSON files on the server (planing to migrate to MongoDB)
- Currently uses JSON file-based storage
- Events stored in
events.jsonwith full event information - Planning to migrate to MongoDB
- 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
- 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
| 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 |
query: Text search across name, description, venuecategories: Comma separated list of event categoriesaddress: Location searchstartDate&endDate: Date range filteringtimeOfDay: Filter by part of day (morning, afternoon, evening)minPrice&maxPrice: Price range filteringavailable: Filter to only available eventsminAge&maxAge: Age restriction filteringstatus: Filter by event statusaccessible: Filter to accessible venues
- Authentication: Firebase handles user accounts and roles
- API Integration
- Protected Routes: Role-based access control
- Responsive Design: Tailwind CSS
- Deploy the Java application to a servlet container (Tomcat)
- Application runs on port 8080
- Endpoint base URL:
http://localhost:8080/Bookatripix/webresources/
- Install dependencies with
npm install - Configure Firebase credentials
- Run development server with
npm run dev - Access the application at http://localhost:3000