projects2026 · Full-stack · Live
CTR Sports
Championship Portal and CMS
ctrsports.in is the source of truth for a national racing championship: the newsroom, the calendar and its countdown, results and standings for seven classes, drivers, teams, tickets and a fan zone. The CMS that keeps it right lives on its own hostname in the same deployment, with roles, a standings engine and an audit trail.

- Role
- Design, full-stack, CMS
- Stack
- Next.js 15 · Drizzle · Neon · Tailwind v4
- Shape
- npm workspaces: site, db, ui, email
- Status
- Live for the 2026 season
- Latest
- Schedule
- Results
- Standings
- Drivers
- Teams
- Tickets
- Video
- Fan zone
- One deployment, two hostnames
- Recompute on publish
- 58
- Tables in the Drizzle schema
- 9
- Admin roles
- 7
- Race classes, one weekend
- 106
- Pages across site and CMS
01 · Overview
Built to be the record.
A championship portal is not a brochure. It updates every session of every race weekend, its standings must be right, its calendar must be unambiguous, and its ticket path has to work for someone standing at a circuit gate on a phone. The design borrows from broadcast timing graphics so it reads like a championship, not a startup.
The primary navigation is the championship itself: Latest, Schedule, Results, Standings, Drivers, Teams, Tickets. A ticker across every page shows the current round, the session and a countdown, so the site always knows where the season is. Seven classes race on shared weekends, so results and standings are per category, and the model was generalised into championships, seasons, rounds and sessions so a future series is just another row.
The CMS is the other half of the same build. Nine roles cover the newsroom, the race editors, team and driver managers, media, pages and the fan zone; every server action re-checks its permission and writes an audit row. Publishing a session's classification recomputes the standings snapshot from the stored points, deterministically, and the site's cached reads are invalidated by tag in the same process.
- A newsroom that leads
- A magazine Latest page: a breaking lead, secondary features, venue guides and class explainers rather than a hero and a scroll.
- Live season state
- The ticker reads the next round and session from the same data the schedule page renders, with a countdown.
- Standings engine
- Points systems live per championship season; publishing results recomputes overall, team and sub-classification tables.
- Roles and audit
- Nine roles, 29 permissions, every mutation checked on the server and logged with who, what and when.
- Word import
- Drop a .docx into the article editor: mammoth converts it, sharp resizes every embedded image into the media library, sanitised HTML lands in TipTap.
- Fan zone
- Accounts, predictions, polls, favourites, RSVPs and a double-opt-in newsletter, with web push and email reminders on a cron.
02 · Two hostnames
Front of house, race control.
One Next.js app, one process, one database. The middleware reads the Host header: the admin hostname is rewritten onto the CMS routes and the public hostname refuses them, so the CMS is unreachable through the site's domain and its cookies never cross over.
ctrsports.in
The portal
Dark-first, in the manner of a timing screen: warm off-white plates on carbon, a single signal yellow, Exo 2 for type and a monospaced face for every number.
- Cached reads under tags, invalidated on every CMS write
- Per-class results, standings and driver entries
- Fan accounts with their own session cookie
- PWA shell, web push, sitemap and OG from SITE_URL
admin.ctrsports.in
The CMS
Everything on the site has a screen: articles, race weekends, results entry, standings, teams and cars, drivers, media, pages, polls, newsletter, members, admins, settings and the audit log.
- Server actions re-check permissions on every call
- revalidateTag straight into the site's cache, no HTTP bridge
- A members' portal for team staff at /m
- Responses carry X-Robots-Tag: noindex
Shared by both
- one Next.js build
- packages/db · Drizzle schema
- packages/ui · tokens and chamfers
- packages/email · Brevo templates
- Neon Postgres, pooled and direct
- Neon object storage
- ADMIN_URL and SITE_URL only
- vercel.json crons
03 · Roles
Who may touch what.
| Role | Scope | Manages |
|---|---|---|
| Super Admin | everything | Admin users, site settings and every module |
| Manager | everything but accounts | All modules except admins and settings |
| News Editor | newsroom | Articles, categories, tags and the media picker |
| Race Editor | racing | Race weekends, circuits, results entry, standings recalc |
| Team Manager | entries | Teams, season entries and cars |
| Driver Manager | entries | Drivers and their season entries |
| Media Manager | assets | Media library, videos and galleries |
| Page Editor | content | CMS pages, blocks and sponsors |
| Fan Zone Editor | audience | Polls and predictions, fan list, newsletter |
04 · Under the hood
Three things that must not be wrong.
Results, standings and what the fan sees next. Each is a short chain, and each ends in the same place: the public page is right the moment the editor presses publish.
Results to standingsFrom a classification sheet to the tableshowhide
- 01Pick the session. A round has sessions per class: practice, qualifying, Race 1, Race 2. Each carries its own grid and its own points scheme.
- 02Enter the classification. Positions, times, laps, status and fastest lap per entry, with the signed official declaration PDF attached to the session.
- 03Publish. The action re-checks the race-editor permission, writes the results, and writes an audit row.
- 04Recompute the snapshot. computeStandings reads the season's points system and rebuilds overall, team and sub-classification tables from session_results.points, deterministically.
- 05Invalidate by tag. The standings, results and round pages drop their cached reads in the same process; the ticker moves on to the next session.
Pieces
- championshipSeasons.pointsSystem
- raceSessions.sequence
- session_results
- computeStandings()
- standingsType: overall · team · rookie
- revalidateTag
- declarationMediaId
Word to webAn article from a .docx in one stepshowhide
- 01Import the document. mammoth converts the Word file to HTML, keeping headings, quotes, lists and tables.
- 02Lift the pictures. Every embedded image goes through sharp into hero, card and thumb WebP variants under media/yyyy/mm in the bucket, and into the media library.
- 03Sanitise and load. The HTML is sanitised and loaded into TipTap, where the editor keeps writing with the same toolbar as a fresh article.
- 04Publish and notify. Category, tags and a slug from github-slugger; the Latest page, the home lead and the newsletter digest pick it up on their own.
Pieces
- mammoth
- sharp
- sanitize-html
- @tiptap/react
- github-slugger
- media/{yyyy}/{mm}
- unstable_cache tags
Fan zoneWhat a fan gets between weekendsshowhide
- 01Register. Fan accounts have their own session secret and cookie, separate from admins and members, and never collide across hostnames.
- 02Predict, vote, follow. Predictions on a round, polls, favourite drivers and teams, saved articles and RSVPs to rounds.
- 03Opt in. The newsletter is double opt-in; confirm and unsubscribe links are tokenised pages on the site.
- 04Get reminded. A daily cron sends round reminders by web push and email; a weekly one sends the digest, with body images fitted to the reader's screen.
Pieces
- FAN_SESSION_SECRET
- web-push · VAPID
- Brevo via packages/email
- /api/cron/round-reminders
- /api/cron/newsletter-digest
- consent only for embedded video
05 · Key screens
From the lead story to the last row.
The front page
A ticker with the current round, session and countdown, then a magazine: one lead, a grid of features, venue guides and explainers, the next round, the standings at a glance and the partners' marks in white.
- Round ticker on every page
- Lead story with class badges
- Partner logos as white marks, no plates
Standings
Drivers' and teams' tables per class, with points, wins and podiums, recomputed the moment a session is published. Position numbers and points sit in the monospaced timing face.
- Per-class tabs
- Overall, team and sub-classification tables
- Same data the CMS standings screen shows
A race weekend
Every session of every class across the weekend, with the circuit, its turns and direction, the countdown to the next session, and the results once they are in.
- Sessions grouped by day and class
- Circuit facts from the circuits module
- RSVP for signed-in fans
Results entry
The CMS screen a race editor lives in on a Sunday: one session, every entry, positions, times and status, the declaration PDF, and a publish that recomputes the standings.
- Permission re-checked on the server
- Audit row per publish
- Standings snapshot rebuilt from stored points
The article editor
TipTap with tables, links and images from the media library; import a .docx and keep editing. Category, tags, hero image and scheduling on the side.
- Import .docx
- Media picker with WebP variants
- Preview links built from SITE_URL
The audit log
Every write, by whom, on what, when. Roles are enforced in the action itself, not only in the navigation, so the log is complete by construction.
- Nine roles, many per admin
- Denied screen for out-of-scope routes
- Settings edit the theme at runtime
06 · At the gate
On a phone, at the circuit.
07 · Stack and rules
What keeps it on schedule.
Model
- championships → seasons → rounds → sessions, with sequence for Race 1 and 2
- Points systems as JSON per season; standings types per season
- Race categories per championship; entries carry a classification
- Standings snapshots, never live sums
- Media by key, URLs built from the current bucket
Boundaries
- Admin, fan and member cookies have distinct names and secrets
- /admin/* is a 404 on the public host
- Server actions check permissions, then write the audit row
- Client-side image compression keeps uploads under the function limit
- No domain in the source: SITE_URL and ADMIN_URL only
Stack
- Next.js 15
- React 19
- TypeScript
- Tailwind CSS v4
- Drizzle ORM
- Neon Postgres
- @neondatabase/serverless
- Neon object storage
- sharp
- mammoth
- TipTap
- TanStack Table
- zod
- bcryptjs
- web-push
- Brevo
- date-fns
- npm workspaces
- Vercel crons
Operations
- 19 Drizzle migrations against the direct connection
- Seed is idempotent: racing data rebuilt, content kept
- db:copy and storage:copy move a whole deployment
- Fetch-data pulls the latest results into JSON snapshots
- GitHub Actions runs the cron jobs off-platform too
08 · More screens
The rest of the grid.
Open any screen to see it full size.

