Performance Guide

Where Streamix spends time, what is already optimised, and what to tune as your catalogue and audience grow.

What is already in place

Area Behaviour
First paint Browse pages, the title modal deep link, the player source and the first page of admin lists are rendered on the server with data, so nothing waits on a client fetch after hydration.
Rows The first rows of a browse page are server-rendered; the rest load in batches while scrolling (/api/v1/browse/rows?cursor=).
Title modal Details are prefetched when a card is hovered.
Trailers Loaded on intent (hover or billboard), muted, paused off-screen.
Media delivery Video, HLS segments, artwork and subtitles are fetched by the browser directly from the bucket/CDN; the app server never proxies media bytes.
Adaptive streaming Transcoded titles play an HLS ladder (240p up to the source height, capped by plan) with 6-second segments.
Heavy work off the request path Top 10, recommendations (title_similar), digests and lifecycle emails run in the hourly cron; transcoding runs in a separate worker.
Schema checks ensure*Schema() runs once per process; DB_SCHEMA_READY=1 skips it entirely.
Search Indexed exact matching first; pg_trgm similarity only when nothing matches exactly.
Icons optimizePackageImports keeps icon libraries tree-shaken.

Database

  • Use the pooled connection on Neon (-pooler host) for the app. Keep the database in the same region as the app (regions in vercel.json).
  • Key indexes already exist: titles by type/status/published date, popularity and availability; playback_progress by profile and recency and by title; live playback_sessions (partial index on unended sessions); browse rows and billboards by page; transcode queue (partial index).
  • Enable pg_trgm (the app tries CREATE EXTENSION IF NOT EXISTS pg_trgm); if your role can't, ask your provider to enable it.
  • Set DB_SCHEMA_READY=1 in production once the schema is provisioned to cut cold-start queries.
  • Watch table growth: playback_sessions (one row per play), search_log, member_message_log and profile_notifications grow steadily. Archive or prune old rows if they become large.

Video

  • Transcode everything you publish. HLS lets the player adapt to bandwidth and applies the plan's resolution cap. A plain MP4 is a single rendition at full bitrate.
  • Give the worker enough CPU; a feature film can take many minutes per rung. Scale by running more worker instances (jobs are claimed with SKIP LOCKED).
  • Serve the bucket through a CDN or custom domain with long cache lifetimes. HLS outputs live in versioned folders (ott/hls/<asset>/<version>/), so they are safe to cache aggressively.
  • Keep source uploads under the 2 GB presigned-upload limit, or host larger masters elsewhere and paste the URL.

Images

  • Upload artwork at sensible sizes (backdrop 1920×1080, card art 16:9, poster 2:3). ImageUpload converts to WebP in the browser and can resize.
  • Next image optimisation is on by default; set DISABLE_IMAGE_OPT=1 only if your host can't run it.

Application server

  • On Vercel, the default function limits are fine; the cron route allows 60 s and each task is bounded (batches of 100 members, 5 translated posts per run).
  • On a VM, run next start behind a reverse proxy with HTTP/2 and compression. Use more than one instance behind a load balancer for availability; note that rate limiting is per instance.
  • Keep the transcode worker off the web server if both compete for CPU.

Front end

  • Rows show 6/5/4/3/2 cards per breakpoint; each card uses the right artwork shape to avoid oversized images.
  • Hover preview delay (Settings → Streaming) defaults to 500 ms so scanning a row doesn't start many trailers.
  • prefers-reduced-motion tones down animations; the profile's "autoplay previews" setting turns off background trailers.

Known gaps

  • Rows are not virtualised; very long rows render all their cards.
  • Artwork is served as uploaded; there is no automatic responsive srcset for every card yet.
  • Hours viewed in analytics are approximate (per-row totals, not a per-day log).

Measuring

  • Browser devtools (Network, Performance) on /browse and /watch/....
  • Admin → Analytics shows plays, concurrent streams and completion, which help size capacity.
  • Your host's function or process metrics for API latency; the database provider's slow-query log for SQL.

© CreativeCape Solutions · creative-cape.com · support@creative-cape.com