Club Zapateo

Ticket sales with Mercado Pago and access control at the door.

Live at clubzapateo.com · 252 tests

  • Online sales with Mercado Pago
  • Admin panel
  • QR access control

The code is private; I can walk you through it on a call.

The problem

Club Zapateo sells tickets through Mercado Pago and checks them at the door with a QR code. If a payment notification doesn't arrive, the buyer is left without a ticket. If two purchases arrive at the same time, tickets can be issued past capacity. If a QR code works at another event, someone without a valid ticket can get in.

Club Zapateo's admin dashboard with revenue, tickets issued and used, and tickets sold against capacity

Screens by role

Three interfaces on the same database: the public site with its checkout, the admin panel and the door app. The interface is in Spanish.

  1. Visitors and buyers

    The site loads events from the database. Buyers pay through Mercado Pago checkout, get an email with one QR code per ticket and can check their ticket's status on a public page. The 3D animation on the home page, made with Spline, has a lightweight mode for slow devices and for visitors who prefer reduced motion.

    Club Zapateo's public site with events on sale
  2. Administration

    It runs on its own subdomain, isolated by middleware. It has a dashboard with revenue, tickets issued and used, payments without a ticket and tickets sold against capacity; events with posters that can be created, published, paused and archived; Mercado Pago reconciliation, order search and manual ticket issuing.

    Club Zapateo's Mercado Pago reconciliation, with a dry run before changes are applied
  3. Door staff

    They sign in with a PIN and pick the active event, so a ticket can't be used at a different one. They scan the QR code with the camera or type in the code, and see live counters.

    Club Zapateo's door screen on a phone, showing a validated ticket

Architecture

Next.js 14 with Prisma on PostgreSQL (Neon); Mercado Pago notifies via webhook, ticket issuing runs in a transaction and Resend emails the tickets. The admin panel runs on a separate subdomain.

Technical decisions

How duplicate and over-capacity tickets are prevented, and how payments without a ticket are found.

  • Ticket issuing in a Serializable transaction

    Each ticket is issued in a Serializable transaction, with retries, that checks the event's capacity. A unique key on order plus ticket index means a duplicate notification never issues an extra ticket.

  • Verified webhook and idempotent payment preference

    Mercado Pago's notification is verified with HMAC and a constant-time comparison. The payment preference is created with an idempotency key, so a retry doesn't create a duplicate preference.

  • Reconciliation with a dry run first

    The admin panel matches orders against Mercado Pago and finds approved payments without a ticket, webhooks that never arrived, stuck payments and unsent emails. It shows what it's going to fix first, then applies the fixes.

  • Credentials, sessions and validation

    Passwords hashed with scrypt, sessions in signed httpOnly cookies with sameSite strict, and the door PIN compared in constant time. Input is validated with Zod.

Quality and evidence

What the repository shows: the tests and the CI that runs them.

  • Test coverage is measured in CI, in the same step that runs the tests.

252

tests with Vitest

Tech summary

My role
Full design and development
When
March 2026
Status
In production. The screenshots use demo data.
Components
Online sales with Mercado Pago · Admin panel · QR access control
Architecture
Next.js 14 with Prisma on PostgreSQL (Neon); Mercado Pago notifies via webhook, ticket issuing runs in a transaction and Resend emails the tickets. The admin panel runs on a separate subdomain.
Practices
  • CI on GitHub Actions: lint, type check, tests with coverage and build
  • Pre-commit hook
  • Validation with Zod
Focus areas
  • Payments: HMAC-verified webhook and reconciliation
  • Concurrency: Serializable, idempotent ticket issuing
Patterns
  • Idempotency (unique key on order and ticket index)
  • Serializable transaction with retries
  • HMAC with constant-time comparison
Stack
  • Next.js 14
  • TypeScript
  • Prisma
  • PostgreSQL (Neon)
  • Mercado Pago
  • Resend
  • Vercel Blob
  • Spline
  • Zod
  • Vitest