Skip to content

MarkoG111/renegade_urban_winery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 

Repository files navigation

🍷 Renegade Urban Winery – Event Ticketing System

πŸ“‘ Table of Contents


πŸ“Œ Overview

Renegade Urban Winery is a production-ready event ticketing system built by extending WooCommerce into a fully functional event management platform.

Instead of building infrastructure from scratch, the system leverages WordPress for content and WooCommerce for payments, while introducing a custom backend layer for ticket generation, validation, and real-time event tracking.

The result is a system capable of handling real-world event logistics including secure ticket distribution, fraud prevention, and check-in management.


🎯 Problem

Traditional WooCommerce setups are not designed for:

  • Event-based seat allocation
  • Secure ticket validation
  • Preventing duplicate ticket usage
  • Real-time check-in tracking

This project solves those limitations by introducing a custom ticketing engine on top of WooCommerce.


πŸ’‘ Solution

A custom backend layer was introduced that handles:

  • Ticket generation
  • Seat allocation
  • QR validation
  • Check-in tracking

🧠 Architecture

The system is divided into 3 layers:

1. WordPress (Base Layer)

  • Content management (events)
  • Admin interface

2. WooCommerce (E-commerce Layer)

  • Payments via Stripe
  • Order lifecycle
  • Emails

3. Custom Backend (Core Logic)

  • Ticket generation
  • Seat allocation (transactions)
  • QR validation
  • REST API

πŸ›  Tech Stack

WordPress WooCommerce PHP MySQL JavaScript Elementor Stripe Dompdf html5-qrcode


πŸš€ Key Features

🎟 Automated Ticket Generation

  • Unique ticket ID generation (RW-XXXXXXX)
  • Automatic seat assignment per event
  • Ticket creation triggered on WooCommerce order completion
  • Multiple tickets per order supported

πŸ“„ PDF Ticket System

  • Dynamic PDF generation using Dompdf
  • Each ticket includes event details, seat number, and a unique QR code
  • Automatically attached to the confirmation email

πŸ“± QR Code Validation System

Each ticket contains a secure QR code encoding the ticket_id and a cryptographic HMAC hash.

Validation flow:

  1. Scan QR code
  2. Call REST API endpoint
  3. Verify hash integrity
  4. Check ticket status
  5. Mark ticket as used

Prevents duplicate entry and forged tickets.

πŸ” Secure Ticket Verification

  • Hash-based validation using hash_hmac
  • Prevents manual ticket ID manipulation
  • Stateless verification via REST API

πŸ—‚ Data Model

Custom database tables:

Table Purpose
event_tickets Stores all generated tickets and their status
event_checkins Records each check-in event
event_seat_counter Tracks seat allocation per event

Custom tables were chosen for better performance, transaction support, and relational structure.


βš™οΈ System Flow

1. User purchases ticket via WooCommerce
2. Order is completed
3. System generates:
   β”œβ”€β”€ Unique ticket ID  (RW-XXXXXXXX)
   β”œβ”€β”€ Seat number       (atomic allocation)
   β”œβ”€β”€ HMAC hash         (security layer)
   └── PDF Ticket
4. PDF ticket is emailed to the user
5. At the event:
   β”œβ”€β”€ QR code is scanned
   β”œβ”€β”€ REST API validates ticket + hash
   β”œβ”€β”€ Ticket is marked as used
   └── Check-in is recorded

🧩 Core Concepts

Ticket ID

Format:    RW-XXXXXXXX
Non-sequential, generated via wp_generate_password

Seat Allocation

Race conditions are prevented using database transactions with row locking:

SELECT ... FOR UPDATE

QR Security

Each QR code encodes:

ticket_id + HMAC hash
hash_hmac('sha256', ticket_id, secret)

Atomic Validation

Ticket consumption is a single atomic operation:

UPDATE tickets
SET status = 'used'
WHERE ticket_id = ? AND status = 'valid'

πŸ”Œ API Endpoints

Verify Ticket

GET /wp-json/rw-tickets/v1/verify
Param Type Description
ticket string The ticket ID
hash string HMAC hash from QR code

Response: valid / used / invalid

Event Stats

GET /wp-json/rw-tickets/v1/stats

Returns tickets sold, check-ins, and remaining capacity.


πŸ“Š Admin Panel

Custom admin panel for managing events and tickets:

  • Event overview with live statistics
  • Tracking: tickets sold, check-ins, remaining capacity
  • Manual ticket controls: cancel / reset / delete a ticket
  • QR Scanner built with html5-qrcode β€” works directly in browser, no external device required

πŸ”„ Real-Time Event Stats

  • Live ticket statistics via REST API
  • Auto-refresh every 3 seconds
  • Displays: total sold, checked-in users, remaining tickets

πŸ“ Project Structure

```text
wp-content/
β”‚
β”œβ”€β”€ plugins/
β”‚   β”œβ”€β”€ rw-tickets/                  # CORE SYSTEM (ticket generation, validation, seat allocation, REST API)
β”‚   β”‚   └── tickets.php
β”‚   β”‚
β”‚   β”œβ”€β”€ my-events-plugin/            # AJAX filtering logic for events (category, status, pagination)
β”‚   β”‚   └── my-events-plugin.php
β”‚   β”‚   └── event-filter.js
β”‚   β”‚
β”‚   β”œβ”€β”€ advanced-custom-fields/      # Event metadata (date, location, product mapping)
β”‚   β”œβ”€β”€ woocommerce/                 # E-commerce engine (orders, checkout, cart)
β”‚   β”œβ”€β”€ woocommerce-gateway-stripe/  # Stripe payment integration
β”‚   β”œβ”€β”€ custom-post-type-ui/         # UI for registering Event CPT and taxonomies
β”‚   β”œβ”€β”€ updraftplus/                 # Backup and restore system for WordPress
β”‚   β”œβ”€β”€ wp-mail-smtp/                # SMTP email configuration (ensures ticket email delivery)
β”‚   β”œβ”€β”€ elementor/                   # Page builder used for layout and UI composition
β”‚
└── themes/
    └── blocksy-child/
        β”œβ”€β”€ functions.php            # Theme hooks, WooCommerce overrides, ticket system integration
        β”œβ”€β”€ archive-event.php        # Event listing page (uses filtering, pagination, event cards)
        β”œβ”€β”€ single-event.php         # Single event page (details, gallery, purchase entry point)
        β”œβ”€β”€ scanner.js               # QR scanner frontend logic (admin ticket validation)
        β”œβ”€β”€ event-gallery.js         # Gallery interactions (lightbox, navigation, animations)
        β”œβ”€β”€ css/
           β”œβ”€β”€ events/               # Event pages styling (cards, layout, filters)
           β”œβ”€β”€ woocommerce/          # Custom WooCommerce styling (checkout, cart, UI tweaks)
           β”œβ”€β”€ style.css             # Global theme styles
           └── tickets.css           # Ticket-related UI (scanner, validation states)
        β”œβ”€β”€ template-parts/
           β”œβ”€β”€ event-card.php        # Reusable event card component (used in listings) 
           └── event-gallery.php     # Dynamic gallery rendering + lightbox system 


βš™οΈ Setup Guide

Requirements

  • PHP 8+
  • MySQL
  • WordPress (local or server)
  • Composer (optional)

1. Install WordPress

Download WordPress and place the project inside wp-content/.

2. Activate Plugins

  • WooCommerce
  • Advanced Custom Fields
  • Custom Post Type UI (if used)
  • rw-tickets (custom)
  • my-events-plugin (custom)

3. Configure WooCommerce

Set up Stripe payments, create a ticket product, and enable stock management.

4. Create an Event (CPT)

Using ACF, fill in:

  • event_date
  • location
  • woo_product (links product β†’ event)

5. Enable Pretty Permalinks

Go to WordPress Settings β†’ Permalinks and set to /post-name/.

Required for the /verify-ticket/ route to work.

6. Run Database Setup

Tables are auto-created via register_activation_hook() on plugin activation:

  • event_tickets
  • event_checkins
  • event_seat_counter

πŸ“Έ System Preview

QR Validation

Valid ticket – marked and consumed:

Valid ticket scan

Used ticket – rejected:

Used ticket rejected

Admin Dashboard

Event overview and ticket statistics:

Admin dashboard stats

Manual ticket controls:

Admin manual controls

Email System

Automatic ticket delivery with PDF attachment:

Confirmation email PDF ticket with QR code

πŸŽ₯ Demo

🎬 Full System Overview https://www.youtube.com/watch?v=LSsF2rVEQ9k
πŸ›’ Ticket Purchase Flow https://www.youtube.com/watch?v=TJwqHD2TgBI
🌐 Live Demo https://renegade-winary.infinityfreeapp.com/
πŸ“„ PDF Documentation https://renegade-winary.infinityfreeapp.com/Dokumentacija.pdf

🧠 What This Project Demonstrates

  • Extending WordPress beyond a CMS into a custom application platform
  • Designing custom data models with transaction support
  • Building REST APIs inside WordPress
  • Handling real-world backend logic: tickets, validation, concurrency
  • Integrating multiple systems: payments, email, QR scanning, admin tools

About

Production-ready ticketing system built on WooCommerce with QR-based validation, HMAC security, and real-time check-in tracking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors