Skip to content
RideneFirasPublic

About

Minimal Netflix-style movie browser powered by TMDB. Next.js, TypeScript, Tailwind.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

FirasTV

A minimal Netflix-style movie browser powered by TMDB. Built with Next.js (App Router), TypeScript and Tailwind CSS.

Setup

  1. Put your TMDB API Read Access Token (the long eyJ… token, not the short v3 API key) in .env.local:

    TMDB_API_KEY=eyJhbGciOi...
    

    api_TMDB=... also works for compatibility, but prefer TMDB_API_KEY. Never prefix it with NEXT_PUBLIC_. On Vercel, add the same variable under Project → Settings → Environment Variables.

  2. Run it:

    npm install
    npm run dev      # http://localhost:3000
    npm run build && npm start
    

Structure

app/
  page.tsx                          home: featured hero, continue watching, movie + show rows
  movies/, tv/                      section pages (rows + genre bar)
  genres/                           all movie and TV genres
  browse/[kind]/[id]/[[...page]]/   genre grid with numbered pagination (/browse/tv/18/3)
  movie/[id]/                       movie detail
  tv/[id]/[[...season]]/            show detail with season tabs + episodes (/tv/1399/2)
  search/                           movies + shows, filter tabs, pagination (client -> /api/q)
  api/q/route.ts                    search endpoint (rate limited, trimmed JSON)
  watch/[...slug]/route.ts          resolves the playback source server-side and redirects the player
components/                         UI (Player.tsx = player overlay, prev/next episode, resume)
lib/
  tmdb.ts          server-only data client (Bearer auth, retry, caching, trimming)
  media.ts         server-only playback source (change provider here)
  history.ts       "continue watching" — browser localStorage only
  paths.ts, images.ts, types.ts, format.ts
next.config.ts     /img/* image proxy rewrite, redirects

How the API key is kept off the client

  • Every TMDB request lives in lib/tmdb.ts, which starts with import "server-only". The build fails if a client component imports it.
  • The token is read from process.env at request time and sent as an Authorization: Bearer header. It never goes in a URL and is never bundled.
  • Pages are Server Components. The only data request the browser makes is GET /api/search on our own domain. It returns trimmed fields (id, title, posterPath, year, rating), not raw TMDB responses.
  • /api/search allows 40 requests per minute per IP and rejects queries over 100 characters. Upstream errors return a generic message.
  • productionBrowserSourceMaps: false and poweredByHeader: false are set in next.config.ts.

Honest caveats

  • Any JavaScript sent to the browser can be downloaded and read, even without source maps. What stays secret is what never leaves the server: the token, the TMDB endpoints and query shaping, and lib/*.
  • Poster images load directly from TMDB's public CDN, image.tmdb.org. That's expected, because those URLs aren't secret. A visitor can tell the images come from TMDB, but can't see the API or the key.
  • The rate limiter keeps its counts in memory, and each Vercel serverless instance has its own memory. It slows down casual abuse but isn't a global limit. For a hard limit, add a Vercel Firewall rate-limit rule or a Redis-backed limiter such as Upstash.

Playback

The playback source is built in lib/media.ts. The page only has /watch/movie/:id or /watch/tv/:id/:season/:episode links, and the server redirects those to the provider.

About

Minimal Netflix-style movie browser powered by TMDB. Next.js, TypeScript, Tailwind.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages