Skip to content

pnsw123/Khayal

Repository files navigation

KHAYAL · خيال

A Cinema Index — Database Systems Class Project

Live: movie-db-one-psi.vercel.app  |  Code: github.com/pnsw123/Movie-DB

Browse 7,400+ real films and 2,800+ TV series, rate them, write reviews, build watchlists, and run your own SQL queries against a live database.


Screenshots

Browse Search
Browse Search
Movie Detail Sign In
Detail Login

Tech Stack

Next.js TypeScript Tailwind CSS Supabase PostgreSQL Python TMDB Google Stitch GitHub Actions Vercel

Tool Role
Next.js 15 + TypeScript Frontend framework — server-rendered pages, App Router
Tailwind CSS Styling
Supabase (PostgreSQL) Database + authentication + Row-Level Security
TMDB API Source of all movie & TV data — posters, trailers, metadata
Google Stitch UI design & prototyping before any code was written
GitHub Actions Nightly cloud sync — fetches new movies every night at 3 AM UTC
Vercel Hosting — auto-deploys on every push to main
Python Data pipeline — seeds and syncs 10,000+ titles from TMDB

Where the Data Comes From

All titles, posters, backdrops, and trailers come from TMDB — the same API used by Plex and Letterboxd.

TMDB API → Python scripts → Supabase (PostgreSQL) → Next.js app

A Python script fetches movies and TV shows and loads them into the database. A GitHub Actions cron job runs this automatically every night at 3 AM UTC — no computer needed.


Project Structure

KHAYAL/
├── khayal/               ← Next.js frontend (everything users see)
│   └── src/
│       ├── app/          ← Pages: /browse  /search  /movies/[slug]  /profile…
│       ├── components/   ← movie-card, shelf, rate-widget, trailer, nav…
│       └── lib/          ← Supabase clients, auth helpers
│
├── scripts/              ← Python data pipeline
│   ├── daily_sync.py     ← Nightly sync (runs on GitHub Actions cloud)
│   ├── test_daily_sync.py← 54 automated tests
│   └── seed_tmdb.py      ← Initial bulk load from TMDB
│
├── supabase/migrations/  ← All SQL schema changes in order
└── .github/workflows/    ← daily-sync.yml — cloud cron job

Database — Supabase (PostgreSQL)

12 tables total.

Table Contents
movies 7,400+ films — title, poster, runtime, age rating, trailer
tv_series 2,800+ shows — same fields + status (ongoing / ended)
movie_ratings One rating (1–10) per user per movie
tv_series_ratings Same for TV series
movie_reviews User reviews for movies with spoiler toggle
tv_series_reviews Same for TV series
user_lists Watchlists — public or private
user_list_movies Movies inside each watchlist
user_list_tv_series TV series inside each watchlist
profiles One row per signed-in user
recommendations Pre-computed similar titles
saved_queries User's saved SQL queries from the explorer

Security: Row-Level Security (RLS) ensures users can only edit their own data. The SQL explorer tab only allows SELECT — no one can modify the database from the browser.


UI Design — Google Stitch

Google Stitch is a Google Labs AI design tool that generates full UI screens from text prompts — color systems, typography, layouts, and components in one shot.

KHAYAL designed in Google Stitch

The KHAYAL design system and landing page variations generated inside the Stitch canvas.


Cloud Automation — GitHub Actions

GitHub Actions

Every night GitHub's servers automatically:

  1. Fetch movies released in the last 2 days from TMDB
  2. Skip anything already in the database
  3. Insert new titles with posters and metadata
  4. Run 54 tests to confirm nothing broke

No local machine needed — fully independent of any computer.


KHAYAL uses the TMDB API but is not affiliated with TMDB.
خيال (khayāl) — Arabic for imagination

About

This entire project was made for CS436, it demonstrates a database schema that mimics IMDb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors