PROJECT STUDY

Competition Management System

Every competition gets its own instance, rolled out from one form.

A football competition platform where every competition runs as its own branded instance on its own subdomain, created from one form by a resumable 16-step provisioner.

Explore the build
Illustration of the rollout: a five-step competition form on its review step, a provisioning panel with all sixteen steps ticked, and the new competition's site live on its own subdomain with a standings table.
Original interface illustration · Synthetic demo data.View larger

At a glance

Industry
Sports and competitions
Capabilities
9
Technologies
14
Year
2026
Under 2 min

From queued to live for a demo instance on the first live run, with the platform image already built

2 instances

Run side by side from one platform image, each with its own database, storage bucket, locale, colours and logo

SEO 100

Lighthouse SEO score on a match page, a news article and a second instance's home page

0 changes

Rows changed by the second run of a legacy-import rehearsal after the first imported 117, so the migration can be repeated safely

The challenge

School leagues, youth cups and regional tournaments all need the same machinery: team and player registration with documents, approvals, fixtures, match-day check-in at the gate, results, standings, suspensions and a public site.

Each competition also runs under its own name, colours and rules.

Building that machinery once is hard enough. Giving every new competition its own site, data, branding and rules without copying code or hand-building servers is where most setups break down. This platform also had to replace a legacy system of three separate applications, without breaking the scanners already used at the gates.

What we built

A competition management platform and a rollout system: one codebase serves every competition, and a provisioner turns a short form into a running, branded instance on its own subdomain.

Self-service rollout

On the main football platform, an organiser fills in a five-step form (competition, branding, season and categories, organiser, review and pay) and pays through Midtrans Snap. Operators can create the same instance from an internal console without payment, and both paths use one provisioner API

Self-service rollout

On the main football platform, an organiser fills in a five-step form (competition, branding, season and categories, organiser, review and pay) and pays through Midtrans Snap. Operators can create the same instance from an internal console without payment, and both paths use one provisioner API

A 16-step provisioner

A Go service creates the instance's private repository from a template, provisions its database, message broker, storage bucket and cache index, builds the pinned platform image, writes the configuration, migrates and seeds, starts the services, routes the subdomain, verifies the site from the public internet and emails the owner

Configuration as data

One competition.json carries the name, slug, locale, time zone, branding, 20 competition rules, 8 feature switches and an optional setup block of seasons, categories, groups, stadiums and official positions, which is seeded on first boot

Per-competition branding

Colours, a display font from five choices, a background pattern and the word used for categories (region, category, age group or division), with the logo, app icons and favicons generated from one uploaded image

Competition operations

Teams, players and officials with documents, bulk-approved registrations with QR codes, suspensions, a schedule generator for round robins and groups, knockout brackets, match events that recompute the score, standings with configurable tie-breaks, awards, tickets and volunteers

Match day

Scanner keys that keep the existing gate scanner apps working against the new API, attendee tickets, and a match-day page that refreshes every 30 seconds

A public site per competition

Matches, standings, statistics, news and registration forms, rendered on the server in the competition's own theme

Connected to the wider platform

Each instance registers with the platform's data hub, academy staff sign in through single sign-on, and entries, documents and results sync in the background

Exports

Fifteen kinds of Excel, PDF and ZIP exports, rendered by a worker and delivered through links that expire after a day

How it works

  1. Order the competition

    The organiser picks a slug, which is checked against the provisioner while they type, uploads a logo that is resized in the browser, and pays. The homepage server sets the price, so the amount never comes from the browser, and a status page polls the order every three seconds and shows the steps as they finish.

  2. Confirm the payment

    A signed Midtrans notification is checked again against Midtrans' status API before anything unlocks, and a payment whose amount does not match the order unlocks nothing. An unpaid order expires after an hour by default and cancels its instance.

  3. Queue and lease

    The paid order becomes a queued instance in the provisioner's PostgreSQL database, which doubles as the job queue. A runner claims one instance at a time with a lease, renews it while it works, and records each step's result before the next step starts.

  4. Build the instance

    The steps create the private repository from the template and commit the rendered configuration, then provision a database role, a broker vhost, a storage bucket and a cache index on shared services. They build the pinned platform image, write the instance files by atomic rename, run migrations and the seed, and start the API, worker and public site.

  5. Route, verify, hand over

    The provisioner installs an nginx server block for the subdomain, tests it and restores the previous file if the test fails. It then checks that the site answers through Cloudflare and that the hub accepts the instance's key, and emails the owner their links. A failed step retries after 30 seconds, 2 minutes and 8 minutes, then alerts an operator, who can resume the run from that step.

Engineering insights

The platform is one TypeScript monorepo built into one image. The provisioner is a small Go service that treats a rollout as a resumable state machine rather than a script.

Stack by layer

Frontend
  • React 19
  • TanStack Router
  • TanStack Query
  • TanStack Form
  • TanStack Table
  • Tailwind CSS v4
  • shadcn/ui
  • Radix UI
  • Astro
  • Remix
Backend
  • Node.js
  • Hono
  • oRPC
  • Effect
  • better-auth
  • Zod
  • Go
  • pgx
  • Fiber
  • pino
Data
  • PostgreSQL 17
  • Drizzle ORM
  • Redis
  • RabbitMQ
  • Garage S3 storage
  • MySQL
Infrastructure
  • Docker
  • Docker Compose
  • nginx
  • Cloudflare
  • GitHub REST API
  • Midtrans Snap
  • Resend
  • moon
  • pnpm
  • Biome
  • Vitest
  • Playwright
  • OpenTelemetry
  1. Idempotent steps, recorded state

    Each of the 16 steps converges when it runs again: an existing repository is adopted only if its competition.json carries this instance's id, secrets are generated only when missing, and resources are created only if they do not exist. Because every step result is stored, a crash or a redeploy resumes at the step that was running instead of starting over

  2. One lease per instance

    The runner claims work with a compare-and-set lease that expires after 90 seconds and is renewed every 30, and losing it cancels the step, so two workers never touch the same instance. On shutdown a running step gets 20 seconds, then is reset and handed back

  3. A narrow door to the host

    The provisioner never drives Docker or the shared databases directly. It connects over SSH with a pinned host key and runs one root-owned helper through a sudo rule that allows nothing else; the helper validates every argument, takes a lock per resource, and receives secrets only on standard input, never in arguments or logs

  4. Secrets that never reach Git

    Instance secrets are generated on the server, encrypted at rest with AES-256-GCM bound to the instance and the secret's name, and written only to the host's environment file with owner-only permissions. The generated repository holds configuration, never credentials

  5. Least privilege per instance

    Each competition gets its own PostgreSQL role and database without superuser rights, its own broker vhost and its own storage key, and its service ports are bound to the Docker bridge address rather than every interface

  6. Locked to the edge

    Every instance's server block admits only Cloudflare's address ranges, loopback and the Docker network, so a request that bypasses Cloudflare gets a 403, and the client's address is taken from Cloudflare's header only when the request comes from Cloudflare

  7. Tenant data by column, guarded on every call

    Inside the platform every competition-owned row carries a competition id and every procedure runs behind session, permission and competition guards. Architecture and migration rules are checked at build time and refuse unsafe statements such as dropping or renaming a column

  8. Tested without the network

    The provisioner's 78 tests run all 16 steps through fakes for GitHub, the host helper, Midtrans and email, including a full run that checks no secret is ever stored in plain text. The platform carries 529 unit-test files, plus API and browser end-to-end suites for its platform modules

Design system

Two surfaces share one brand system: a dark-first admin for the people running a competition, and a public site that takes each competition's own colours, display font and pattern.

Colour palette

  • Admin green#47a03bPrimary actions and focus rings in the operator admin
  • Competition green#52b245Default primary colour of a new competition and the browser theme colour
  • Accent green#60bc54Default accent for highlights, active states and charts
  • Pitch black#141a14Default secondary colour, mixed into backgrounds, borders and muted text
  • Night surface#0e1014Background of the dark admin theme, which is the default
  • Chalk#eceef3Text on the dark admin theme
  • Red card#c2362bDestructive actions and errors in the admin
  • Live red#d6463bLive match indicator on the public site
  • Colour

    The admin uses a pitch-green primary on a near-black theme by default, with an accent green and a deep secondary mixed into backgrounds, borders and muted text. Each competition's own primary, secondary and accent override these at runtime, and text on a brand colour switches between near-black and white so it stays readable

  • Typography

    Inter Display sets the admin headings and Archivo the public site's body text, while each competition picks its display face from Anton, Bebas Neue, Oswald, Archivo Black or the system font, set in capitals

  • Components

    shadcn/ui primitives on Radix with Tailwind CSS v4 make up the admin, including data tables that turn into cards on narrow screens. The public site is built with Astro and receives its theme as a stylesheet, because its content security policy allows no inline styles

  • Accessibility

    The public site has skip links; focus outlines are visible, invalid fields are marked, motion honours the reduced-motion setting, and text on brand colours is chosen for contrast. The admin defaults to Indonesian with an English toggle, while public pages and emails follow each competition's locale

What comes next

The first live run proved the rollout path from order to owner email. These are the next steps we have designed but not built yet, listed here so the boundary between shipped and planned stays clear.

Continue reading
  • Rolling upgrades with release channels. Today an instance keeps the platform commit it was created with. Next, the platform's release workflow, which already classifies each release as instance-affecting or not, feeds a rollout that upgrades a canary group first, watches readiness and errors, then promotes or rolls back to the previous image
  • Teardown and compensation as steps. Removing an instance is an operator command on the host today. Next is a teardown API that reverses each step in order, frees the slug and records the result, and a failed run that undoes what it created instead of waiting for a retry
  • Open registration everywhere. The hub change that opens a new competition to every academy on the platform is built and tested. Until it is deployed, the provisioner detects the older hub and an operator opens the competition with one command
  • Custom domains. The configuration already reserves domain aliases. Next is letting an organiser bring their own domain, with certificates issued automatically at the edge
  • Stronger isolation. A Docker network and cache credentials per instance, instead of one shared network with per-instance database, broker and storage credentials
  • Fleet metrics and CI. Queue depth, step durations and failure rates exported as metrics and wired to the alerts the platform already defines, plus CI that runs the provisioner's tests and lints the host helper on every change
  • Backups and restore drills. Scheduled database dumps and write-ahead-log archiving into each instance's own bucket, with a restore drill that measures how long recovery takes
  • More than one host. Capacity-aware placement across several servers, or a dedicated server for a large competition, which is the model the platform's architecture document already describes

Where this fits

Any product sold as a dedicated, branded instance per customer, such as leagues, schools, clinics, franchise outlets or events, can use the same pattern: a configuration contract, a template repository and a resumable provisioner that turns an order into a running system. Explore our business systems and IT consulting work, or talk to us about your rollout.

talk to us about your rollout

Let’s connect the dots

Let's put these ideas to work.

Share a process, product, or problem you want to improve. We will work through the possibilities together.

Discuss your project