How I built the recommendation engine behind CineHindi
CineHindi is a movie and TV discovery app I built with Next.js and the TMDB API. It covers Bollywood, South Indian cinema, Hollywood, K-dramas, anime and Indian web series — 28 curated categories in total — and the part I spent the most time on is the bit that decides what to show you next: the recommendation engine.
The problem: a catalogue is not a recommendation
TMDB gives you metadata: titles, posters, genres, ratings, cast. What it does not give you is a reason to pick one row over another. A grid of posters is a catalogue, not a guide. I wanted the home page to feel like it knew what I had been watching, so I built a small scoring engine that runs over the user's own history and re-ranks everything into personal rows: "For You" and "Because You Watched …".
How the scoring works
Every movie or show you open, like, or add to your watchlist feeds the engine. The score for a candidate title comes from three signals:
- Genre affinity. Genres you keep watching score higher. If you finish three South Indian action films in a row, the next row leans that way. Genres you skip or abandon decay instead of sticking around forever.
- Recency decay. Something you watched last week counts more than something you watched two months ago. Taste moves, so the engine forgets gradually instead of freezing your first week of behaviour into a permanent profile.
- Language preference. The app covers Hindi, South Indian languages, English, Korean and Japanese content. Language is a first-class signal, not a filter you have to set by hand — if you keep watching K-dramas, more K-dramas surface.
The engine lives in a single module (lib/recommend.ts) and is shared by the browse UI and the API routes, so the rows you see on the home page and the rows the API returns are always scored the same way.
Guest-first: recommendations without an account
Most apps make you sign up before they personalise anything. CineHindi does it the other way round. There is no signup wall — your watch history, likes and watchlist are saved in localStorage, and the recommendation engine runs entirely off that local store. The profile page and the personal rows work for a guest exactly as they do for a signed-in user.
Signing in is optional, and when you do, your guest library merges into your account. The rule is simple: existing cloud rows win, everything else carries over. Cloud writes are fire-and-forget, so browsing never waits on the network, and every table is locked down with row-level security so a user can only ever read their own rows.
Resume, categories and deep links
TV shows remember the last season and episode you opened and jump straight back to it. Playback runs through third-party iframe servers, so resume is tracked at the episode level rather than to the exact second — the schema is ready for position-based resume the moment a player exposes playback events.
The 28 categories are curated, not auto-generated, and every one of them is shareable: a link like /browse?category=anime&type=all opens exactly that shelf. The discovery UI is ranked rows, carousels, genre pages and live search with filters — all fed by the same scoring.
What I would do differently
Two things. First, I would add position-based resume from the start — episode-level resume is fine, but second-level resume is what people actually expect. Second, I would put the scoring behind a small test suite earlier. The engine is one module with clear inputs and outputs, which is exactly the kind of code that is easy to test and easy to let drift.
The repo is open source: github.com/akyourowngames/Movix. If you build something similar, I would love to hear how you score — did you weight recency, or genres, or something else entirely?
— Krish Verma
