Skip to content

← Back to the Labs

L3:ticket-marketplace-backend · Software Wing · Hero

Event Ticket Marketplace Backend

Auctions, resale, a wallet ledger and partner settlement for a live ticket marketplace.

Client
TEMMPAT
Role
Lead backend engineer (freelance) for the v2 refactor
Period
Nov 2025 to Feb 2026

Results

  • 61%

    Of all repository commits authored by me (162 of 267)

    Counted from the client repository's git history (my commits Nov 2025 to Feb 2026)

    Verified
  • 2 → 1

    Primary databases after retiring MongoDB (PostgreSQL, with Redis as cache)

    Verified from commit history and the data models

    Verified
  • 3 roles

    Admin, client and partner access separated across the API

    Verified from route middleware and commit history

    Verified

Problem

TEMMPAT lets fans buy, resell and auction concert and event tickets. The v1 backend split data across MongoDB and PostgreSQL and had no clear layering, while the business needed escrow-style payments, refunds and partner payouts that buyers, sellers and partners could all trust.

What I did

  • Moved the Express API to Bun with a repository pattern, retired MongoDB so PostgreSQL is the single source of truth, and added Redis caching with explicit invalidation.
  • Rewrote checkout and auction orders as database transactions with row locks and stock reservation, so one ticket cannot be sold twice.
  • Built the money flow: wallets with a transaction ledger, a multi-component platform fee, signature-checked payment callbacks, refunds, withdrawals and partner share settlement when an order completes.
  • Added buyer-seller chatrooms over Socket.IO that open automatically after payment, and an admin review step for ticket files and signatures.
  • Separated admin, client and partner roles, added security logging, and set up Prometheus and Grafana with blackbox and PostgreSQL exporters.

Architecture

  1. ClientWeb and mobile clientsBuyers and sellers
  2. ClientAdmin and partner panelReviews, refunds, payouts
  3. ServiceExpress API on BunOrders, auctions, wallet ledger
  4. ServiceSocket.IO chatOpens after payment
  5. DataPostgreSQLSingle source of truth
  6. DataRedisCache and rate limits
  7. ExternaliPaymuPayment gateway
  8. ExternalAWS S3Ticket files, presigned uploads

Data flow

  • Web and mobile clients to Express API on Bun (REST)
  • Web and mobile clients to Socket.IO chat (WebSocket)
  • Admin and partner panel to Express API on Bun (review, payouts)
  • Express API on Bun to PostgreSQL (transactions)
  • Express API on Bun to Redis (cache)
  • Socket.IO chat to PostgreSQL (messages)
  • Express API on Bun to iPaymu (payments)
  • iPaymu sends asynchronously to Express API on Bun (callbacks)
  • Express API on Bun to AWS S3 (ticket files)

Stack

  • Bun
  • Node.js
  • Express
  • PostgreSQL
  • Sequelize
  • Redis
  • Socket.IO
  • JWT
  • iPaymu
  • AWS S3
  • Brevo
  • Docker
  • nginx
  • Prometheus
  • Grafana
  • Jest

L2 · On the journeyLead Backend Engineer (freelance) · TEMMPAT