Skip to content
~/rafael-ferreira

B2B platform for ticket and course sales

Ticket and course sales for corporate training, with offline check-in and a company dashboard

private repository
  • Laravel
  • Vue 3
  • Inertia.js
  • TypeScript
  • Tailwind CSS
  • Filament
  • MySQL
  • Redis
  • Horizon
  • Reverb
  • AWS S3
  • Bunny Stream
  • Docker
  • Pest
Cover of the B2B platform for ticket and course sales project

I built a corporate training platform that sells tickets to in-person events and online courses. Learners buy, study and get a certificate. Company managers buy course licenses for their team and track each employee's progress. Event organizers validate tickets at the door and see who has arrived in real time. The internal team manages everything in Filament.

The hard problems sit behind the screens: inventory that must never oversell, payments that arrive by webhook out of order, check-in without internet, licenses shared across an entire company and video progress that cannot be gamed. The code is private and the product name is deliberately left out; here I explain how I solved each part.

Learner dashboard: resume the lesson where you left off and see the progress of each course

Overview

Payment is by PIX (Brazil's instant payment system), boleto (a Brazilian bank payment slip) or card (with tokenization and installments) through Asaas. Courses have modules with prerequisites and scheduled release, and lessons can be text, video on Bunny Stream, a live session, downloadable material or an interactive activity. Tickets and certificates are issued as PDFs.

Diagram: learner, company, check-in and admin dashboards on top of the domain contexts and integrations

Tickets without double selling

Each ticket type has batches with stock, sold and reserved counts. Only one batch is active per type, enforced by a unique index, and the switch to the next one happens by date, by quantity or manually. When a ticket goes into the cart, ReserveStockAction opens a transaction with a row lock and runs a conditional UPDATE that only succeeds if there is still stock left. The reservation lasts 10 minutes, freezes the price and returns to stock through an expiration command if payment does not come in.

Each payment webhook is stored with a unique key per provider and external identifier, so the same notification received twice never pays the order twice. Processing runs on its own queue, the order status is a state machine in an enum and a reconciliation command compares charges against the gateway to apply whatever the webhook missed.

Diagram: cart reservation, payment webhook, stock deduction, voucher and named ticket

Once the order is paid, the buyer receives vouchers, which become named tickets with the holder's name and CPF (the Brazilian taxpayer ID), filled in via a link, a CSV or by the attendee themselves. A unique index prevents the same CPF from appearing twice at an event.

Event page with ticket types, batch, venue, dates and cancellation policy

Check-in that works without internet

The QR code carries a payload signed with HMAC-SHA256, using a per-event derived key and constant-time verification. Check-in is a PWA with a camera scanner, manual search and an undo option. Before the event, the device stores the ticket database and an offline key for that event in IndexedDB; with no signal, scans are validated locally and go into a queue that syncs later.

Attendee search on a phone, with entry confirmation and a warning for people already checked in

The server remains the source of truth. QR scans, manual search and offline sync all go through the same PerformCheckInAction, and a unique index on the ticket prevents double entry. When two devices scan the same ticket offline, the earliest scan wins and the conflict goes to the audit log.

Diagram: signed QR, offline verification, single write path and real-time dashboard

The organizer dashboard is updated over WebSocket (Reverb, a private channel per event, with polling when the connection drops) and shows who is present and absent, attendance rate, entries by type and by hour, devices and conflicts. Door staff access can be limited to a single event and expires automatically.

Check-in dashboard with present and absent attendees, attendance by ticket type, arrivals per hour and devices

Company licenses and privacy

Companies buy a pack of licenses per course, with volume discounts, and distribute them through email invitations or CSV, with line-by-line error feedback. Assignment uses an atomic conditional UPDATE, so two people distributing licenses at the same time cannot exceed the pack. Revoking a license frees the seat and preserves the person's progress.

Diagram: pack purchase, license assignment, enrollment, progress and reports with privacy safeguards

Managers see each employee's progress, completion, certificates, last access and assessments, plus alerts for inactivity (14 days), unused licenses (21 days) and access about to expire (30 days). CSV exports are delivered through an expiring link. Since this is employee data, I added safeguards with LGPD (Brazil's data protection law) in mind:

  • for the diagnostic assessment, managers only see the score band, never the score itself;
  • breakdowns with fewer than 5 people are not shown;
  • practice quiz attempts are visible only to the learner.

Employee profile with courses, completions and passed assessments, and the privacy notice at the top

Video progress that resists shortcuts

Progress is a bitmap of 5-second blocks that the server merges under a row lock, and a video lesson only completes at 90% coverage. A time budget rejects progress faster than the clock, and each account can watch one lesson at a time. The Bunny embed is tokenized with an expiry, and materials live in a private S3 bucket, served through 2-minute signed URLs.

Personalized learning path

A diagnostic quiz measures mastery per knowledge area and waives the lessons the person already knows, but never the mandatory ones. Waived lessons remain accessible. Quizzes are always graded on the server, and assessments have a passing score (70% by default), an attempt limit and a cooldown between attempts. Badges with six types of criteria, study streaks and certificates with a verification code, a public validation page and a LinkedIn link round out engagement.

Learning path with mandatory lessons and lessons waived by the diagnostic, each with the reason

How the code is organized and tested

It is a monolith in Laravel 12 with Vue 3, Inertia and TypeScript, split into 9 domain contexts (Billing, Catalog, Corporate, Editorial, Identity, Learning, Ordering, Shared and Ticketing). Each use case is an Action, 112 in total, over 63 models. The frontend has 110 pages with routes typed by Wayfinder. Domain events are persisted and can be replayed, and Horizon queues are split by workload: payments, notifications, broadcasts, media and everything else.

  • 228 test files in Pest, covering unit, feature and concurrency tests.
  • A concurrency suite with 14 files; the stock test runs on real MySQL, because you cannot test row locks on SQLite.
  • Architecture tests that block dependencies crossing domain boundaries, raw SQL, business rules without tests, Filament resources without authorization and exposed ticket credentials.
  • CI on GitHub Actions with Pint, ESLint, Prettier, vue-tsc, tests and dependency auditing.

I also ran my own security audit against the OWASP Top 10 2025.

Further reading

Gallery

Other projects

Cover of the Markmedi project
markmedi.com · private ★ featured

Markmedi

My main project: scheduling, medical records, telemedicine, finance, CRM and marketing for clinics, in a modular Laravel and Vue monolith with queues, real-time updates and per-clinic encryption.

  • Laravel
  • Vue 3
  • Inertia.js
  • TypeScript
  • Tailwind CSS
Cover of the Evidens project
evidens-legal-ai-analysis · private ★ featured

Evidens

A Python pipeline that collects TJRJ appellate rulings with Playwright, stores every piece of evidence with a hash, extracts the text from the PDFs and has a language model read 1,048 full decisions, accepting only classifications supported by quotes verified on the cited page.

  • Python
  • Playwright
  • BeautifulSoup
  • PostgreSQL
  • psycopg 3