lukasz-mical

$ cd .. — all case studies

Gdzie Transmisja icon

02 · case-studies/gdzie-transmisja.md

Gdzie Transmisja

A search engine for sports broadcasts: matches, channels, leagues and the venues where you can watch them.

role
Fullstack developer — architecture, frontend, API and deployment
period
2023 →
stack
Next.js · NestJS · Drizzle · PostgreSQL · Turborepo

# problem

Information about where to watch a match is scattered across many sources. A fan wants one answer: channel, time, place.

On the code side it is several applications at once — a site for fans, an editorial panel, an API and data import — that have to speak the same types.

# architecture

@gt/data

Scrapers and broadcast import from external sources.

@gt/api

NestJS, Drizzle, Zod and PostgreSQL. JWT auth, files, cron jobs.

@gt/web

The public Next.js site: broadcasts, venues, leagues.

@gt/admin

The editorial panel on react-admin and Vite.

Everything is tied together by the @gt/shared package: types, enums and tools used by every app. The monorepo runs on pnpm workspaces and Turborepo.

# key decisions

  1. Types from a single sourceThe Drizzle database schema yields Zod schemas, those yield OpenAPI, and from it the types and the route enum for the frontends are generated.
  2. Site addresses as a typePath types are derived from the Next.js directory structure, together with route translations into Polish and English.
  3. A component is just the viewA component file holds only JSX. Logic goes into a single hook next to it, and the page only fetches data and renders.
  4. One repo, separate deploymentsThe site and the panel deploy to Vercel, the API to Railway. The API runs its database migrations on start.

# what the product does

  • broadcast search
  • venues
  • leagues and teams
  • channels
  • articles
  • admin panel
  • automatic data import

# result

One search answers the question of channel, time and place, and broadcast data is fed by an automatic import.

Thanks to shared types, a change in the database schema shows up immediately in the API, the editorial panel and the site.

Magnoliowa Twin iconnext case studyMagnoliowa Twinread ->