- Document various invoice generation approaches (PDF, HTML-to-PDF, Stripe) - Compare Stripe Payment Intents vs Invoicing vs Checkout Sessions - Provide complete code implementation with models, controllers, services - Include phase-by-phase implementation strategy for current use case - Add testing, security, and deployment guidelines - Recommend hybrid approach: keep current checkout + post-payment invoices 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Aperonight - Event Booking Platform
🌃 Overview
Aperonight is a comprehensive ticket selling system that connects event-goers with event organizers. The platform provides a complete solution for event booking, payment processing, and ticket management.
🎯 Key Features
For Event-Goers
✅ User Dashboard - Personalized metrics showing booked events, upcoming events, and event statistics ✅ Event Discovery - Browse upcoming events with detailed information and venue details ✅ Secure Booking - Multiple ticket types per event with quantity selection ✅ Stripe Integration - Secure payment processing with credit/debit cards ✅ PDF Tickets - Automatically generated tickets with unique QR codes for each purchase ✅ Download System - Instant PDF ticket downloads after successful payment
For Event Organizers
✅ Event Management - Create and manage events with detailed information ✅ Ticket Type Configuration - Set up multiple ticket types with different pricing ✅ Sales Tracking - Monitor ticket sales and availability ✅ User Authentication - Secure user registration and login system
Technical Implementation
✅ Payment Processing - Full Stripe Checkout integration with session management ✅ PDF Generation - Custom PDF tickets with QR codes using Prawn library ✅ Responsive Design - Mobile-friendly interface with Tailwind CSS ✅ Database Relations - Proper user-event-ticket relationships
🛠 Technical Stack
Backend
- Ruby on Rails 8.0+ with Hotwire for reactive UI
- MySQL database with comprehensive migrations
- Devise for user authentication and session management
- Kaminari for pagination
Frontend
- Hotwire (Turbo + Stimulus) for interactive JavaScript behavior
- Tailwind CSS for responsive styling and modern UI
- JavaScript Controllers for cart management and checkout flow
Key Integrations
- Stripe for secure payment processing and checkout sessions
- Prawn & Prawn-QRCode for PDF ticket generation
- RQRCode for unique QR code generation per ticket
📊 Database Schema
erDiagram
USER ||--o{ EVENT : creates
USER ||--o{ TICKET : purchases
USER {
integer id
string email
string encrypted_password
string first_name
string last_name
}
EVENT ||--o{ TICKET_TYPE : has
EVENT {
integer id
integer user_id
string name
string slug
text description
string venue_name
string venue_address
decimal latitude
decimal longitude
datetime start_time
datetime end_time
string state
boolean featured
string image
}
TICKET_TYPE ||--o{ TICKET : defines
TICKET_TYPE {
integer id
integer event_id
string name
text description
integer price_cents
integer quantity
datetime sale_start_at
datetime sale_end_at
boolean requires_id
integer minimum_age
}
TICKET {
integer id
integer user_id
integer ticket_type_id
string qr_code
integer price_cents
string status
}
🚀 Getting Started
Prerequisites
- Ruby 3.4+
- Rails 8.0+
- MySQL/MariaDB
- Node.js 18+ (for asset compilation)
- Stripe account (for payment processing)
Installation
- Clone the repository
git clone https://github.com/yourusername/aperonight.git
cd aperonight
- Install dependencies
bundle install
npm install
- Database setup
rails db:create
rails db:migrate
rails db:seed
- Configure environment variables
Create a
.envfile or configure Rails credentials:
# Stripe configuration
STRIPE_PUBLISHABLE_KEY=pk_test_your_key_here
STRIPE_SECRET_KEY=sk_test_your_key_here
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
# Database configuration (if not using defaults)
DATABASE_URL=mysql2://username:password@localhost/aperonight_development
- Start the development server
rails server
Visit http://localhost:3000 to see the application running.
💳 Payment Configuration
Setting up Stripe
- Create a Stripe account at stripe.com
- Get your API keys from the Stripe Dashboard
- Add your keys to the Rails credentials or environment variables
- Configure webhook endpoints for payment confirmations:
- Endpoint URL:
your-domain.com/stripe/webhooks - Events:
checkout.session.completed,payment_intent.succeeded
- Endpoint URL:
🎫 Core Functionality
User Flow
- Registration/Login - Users create accounts or sign in
- Event Discovery - Browse events from the homepage or events page
- Ticket Selection - Choose ticket types and quantities
- Checkout - Secure payment through Stripe Checkout
- Ticket Generation - Automatic PDF ticket generation with QR codes
- Download - Instant ticket download after payment
Event Management
- Event Creation - Create events with full details and images
- Ticket Types - Configure multiple ticket types with pricing
- Sales Tracking - Monitor ticket sales through the dashboard
Dashboard Features
- Personal Metrics - View booked events and upcoming events
- Event Sections - Today's events, tomorrow's events, and upcoming events
- Quick Actions - Easy navigation to event discovery and booking
🔧 Development
Key Files Structure
app/
├── controllers/
│ ├── events_controller.rb # Event listing, booking, checkout
│ └── pages_controller.rb # Dashboard and static pages
├── models/
│ ├── user.rb # User authentication with Devise
│ ├── event.rb # Event management and states
│ ├── ticket_type.rb # Ticket configuration
│ └── ticket.rb # Ticket generation with QR codes
├── services/
│ └── ticket_pdf_generator.rb # PDF ticket generation service
└── views/
├── events/
│ ├── show.html.erb # Event details and booking
│ └── payment_success.html.erb # Post-purchase confirmation
└── pages/
└── dashboard.html.erb # User dashboard with metrics
Key Routes
GET /- HomepageGET /dashboard- User dashboard (authenticated)GET /events- Event listingsGET /events/:slug.:id- Event details and bookingPOST /events/:slug.:id/checkout- Stripe checkout initiationGET /payment/success- Payment confirmationGET /tickets/:ticket_id/download- PDF ticket download
