MovieDice is a mobile-first web app that helps friend groups collaboratively build a shared movie watchlist and — when nobody can agree on what to watch — randomly select one using an animated "Roll the Dice" mechanic. Groups join via a short invite code, add movies from a live TMDB search, and mark films as watched together. The app removes the friction of the "what should we watch?" problem by making both curation and random selection fast and fun.
A public landing page lets visitors try the dice mechanic against the TMDB database before signing up, lowering the barrier to entry. The landing page features a slot-machine-style reel animation on roll — distinct from the in-app scatter/eliminate animation — to create a visually striking first impression.
Primary: Friend groups, couples, roommates, or families who watch movies together and maintain an informal "we should watch this" list that currently lives in text threads or notes apps.
Secondary: Remote groups (long-distance friends, online communities) who watch movies synchronously or asynchronously and want a shared queue.
Key traits:
One shared list. One button to decide. No arguments.
MovieDice solves group decision paralysis by combining collaborative curation (everyone adds what they want to watch) with a delightful randomizer that removes the burden of choosing. The invite-code group model means zero signup friction while still keeping lists private to the group.
| Feature | Description | Priority |
|---|---|---|
| Landing page | Centered logo, splash text, slot-machine reel animation on Roll the Dice (3 reels spinning through ~20 automatically fetched posters from TMDB popular/top-rated, replaced on each periodic refresh), Genre Roll against TMDB (no login required), Login button, scrolling About section, 3-step how-it-works demo with alternating left-right-left alignment, TMDB attribution footer, privacy policy link. Roll result card emerges in the carousel center and stays settled until next user action. Result card has an "i" info button that opens a MoreInfoModal (plot, Add to list → /login, Watch Trailer). | Must Have |
| Anonymous auth via Supabase | User picks a display name and optional avatar color; account created via supabase.auth.signInAnonymously() which issues a JWT for RLS-compatible sessions; persisted on device via @supabase/ssr cookie-based session handling |
Must Have |
| Recovery code | A 24-character alphanumeric code (128-bit entropy) shown once after account creation that lets users reclaim their identity on a new device; hashed with Argon2id (memory=19456 KiB, iterations=2, parallelism=1, output=32 bytes) before storage; single-use (invalidated after successful claim); claim endpoint rate-limited (5 failed attempts per IP per 15-minute window) | Must Have |
| Group creation with invite code | Creator gets a short human-readable code in WORD-WORD format (e.g., WOLF-MOON; word list: 2,000+ words, 3-8 characters each, offensive/confusing terms filtered, uppercase display, case-insensitive comparison, collision check on generation) to share; creator becomes List Admin | Must Have |
| Group join via invite code | Enter code to join a group and access its shared list; regular member role assigned; join endpoint rate-limited (5-10 failed attempts per IP per 15-minute window); group join is a server-side operation via service role key (not client-side INSERT) | Must Have |
| List Admin permissions | Creator can rename the list, initiate list deletion or ownership transfer (on self-removal), remove members, and regenerate the invite code | Must Have |
| Regular user permissions | Members can add/remove movies, mark movies as watched, and leave the list | Must Have |
| Movie search (TMDB integration) | Search bar queries TMDB via server-side API proxy (/api/tmdb/*) with debounce (~300ms); all calls set include_adult=false; results show below a separator from in-list results |
Must Have |
| Add/remove movie | Tap a TMDB result to add it; poster, genres, title, year, and trailer URL auto-populate (trailer URL stored in DB and refreshed periodically); added-by attribution stored | Must Have |
| Poster-forward grid view | 2-column evenly-scaling grid; each card shows movie poster (full bleed, using TMDB native sized URLs) with title below and meaningful alt text; added-by avatar overlaid top-right; binoculars emoji overlaid top-left when watched; infinite scroll loading 12 movies initially |
Must Have |
| Expanded movie card (inline panel) | Tapping a poster expands a full-page-width panel downward, inserted below that row in the grid — not a modal or popup. Panel order (top to bottom): full-size poster → title → "Added by [username]" → genre tags → Watched It + Trailer (side by side) → Delete (centered below). Delete uses two-tap shake-and-confirm. Watched It toggles watched state. Trailer opens in new tab. Panel collapses on tap outside. | Must Have |
| Genre filter | Tapping a genre tag in the expanded panel filters the grid to that genre; announce filter state change via aria-live="polite" region |
Must Have |
| Roll the Dice | Large button pinned above the list; triggers an animated randomizer that lands on one unwatched movie from the group list; announce result via aria-live="polite" region |
Must Have |
| Re-roll | Tapping Roll again re-rolls from the same eligible pool | Must Have |
| Genre + Emotion Roll | Secondary button accepting comma-separated genres and/or emotion keywords; maps emotions to genre IDs, filters pool, then rolls | Must Have |
| Watched state (per group, toggle) | Marking a movie watched moves it to a collapsed "Watched" section; marking again moves it back. Binoculars overlay and button color update in real time across all members. Announce state change via aria-live="polite" region. |
Must Have |
| Real-time list sync | Add, remove, and watched-status changes appear live on all connected group members' screens (Supabase real-time); subscribe only to the currently-viewed list, unsubscribe on navigation away | Must Have |
| Logged-in home page | Upon login or return visit (stored user ID detected), user lands on a home page that mirrors the landing page layout but shows their lists as cards and replaces Login with Create List; Roll the Dice and Genre Roll roll across all user lists combined and display the result as a standalone teaser card on the home page (no navigation into a specific list) | Must Have |
| Multi-group support | A user can belong to more than one group; all their lists appear as cards on the home page | Should Have |
| Invite code rotation | List Admin can regenerate the invite code to revoke access for anyone with the old code | Should Have |
| Trailer URL periodic refresh | Background job via Node.js cron container on a bi-weekly cadence refreshes stored trailer URLs only for movies where trailer_url is currently null. Note: this behavior should be reassessed post-launch to also refresh stale URLs after a certain age. | Should Have |
| Master Admin panel | Site-owner-only admin page with TOTP 2FA; can search and delete any list or user (deletion must remove both public.users row and auth.users record via supabase.auth.admin.deleteUser()); credentials set via environment variables; session managed via iron-session v8 (HttpOnly, Secure, SameSite=Strict cookie, 8-hour expiry) |
Must Have |
1. Visitor lands on the root URL — no login required
NOTE: src/app/page.tsx was a duplicate stub that shadowed (public)/page.tsx; removed (2026-05-02).
The canonical landing is src/app/(public)/page.tsx; TMDBFooter is mounted in (public)/layout.tsx.
2. Centered "Movie Dice" header/logo displayed
3. Splash text describes the site briefly (1-2 sentences)
4. "Roll the Dice" button is visible — tapping it triggers the slot-machine reel animation:
a. Three side-by-side reels spin through poster images sourced from the landing_reel_posters table
(populated by seed.sql; cron refresh is a pending TODO — see 5.2).
The /api/tmdb/reel-posters route currently fetches TMDB live on each request and ignores the
table; PINNED_REEL_POSTERS constant always prepends hard-coded entries (e.g., tmdb_id 615).
Reel posters use aria-hidden (decorative during animation).
TWO DISTINCT POOLS — do not conflate:
- Carousel/reel posters: landing_reel_posters table + PINNED_REEL_POSTERS fallback (curated)
- Roll the Dice result: live /api/tmdb/popular?page=N, random page 1–50 (~1000-movie pool)
b. Reels decelerate and snap so the midpoint of a gap between two posters lands at viewport center.
Result is a single movie drawn from /api/tmdb/popular?page=N (random page 1–50; pool ~1000 movies).
The result is NOT constrained to the reel poster set.
KNOWN BUG (U9): modulo wrap missing in spinning branch causes scroll offset to drift on
repeated rolls; fix tracked in research/PHASE5_UI_FIXES_PLAN.md U9.
c. Result TeaserCard (~1.3x reel poster size) emerges with an animate-emerge keyframe
(scale 0 → 1.08 → 1, ~500ms, bouncy easing) in the carousel center — posters spread ±110px
at viewport center on settle. Card remains in settled state until the user re-rolls or refreshes
(no auto-resume timer). Card shows poster (with alt text), title, genres, and an "i" info button.
Respects prefers-reduced-motion: animation skipped, card appears instantly.
d. Tapping "i" opens <MoreInfoModal> (src/components/landing/more-info-modal.tsx):
- Side-by-side layout at sm+ (poster left, content right), stacks on mobile, max-w-5xl/lg:max-w-6xl
- Shows: title + year, genres, plot (movie.overview)
- "Add to list" button → navigates to /login (no save-intent flow; user adds manually post-auth)
- "Watch Trailer" button → lazy-fetches /api/tmdb/movie/[id]/videos, opens trailer
- a11y: ESC closes, click-outside closes, focus trap, focus restoration on close
- Uses createPortal to document.body to escape the animate-emerge transformed ancestor
NOTE: this is a LANDING-ONLY modal for unauthenticated visitors. It is separate from the
in-app "More Info" button (U5 in research/PHASE5_UI_FIXES_PLAN.md) which targets
src/components/movies/expanded-panel.tsx and is still TODO.
e. Animation is user-triggered only and completes within 5 seconds (WCAG 2.2.2)
5. "Genre Roll" button visible — accepts comma-separated genres/emotions, no reel animation;
result displayed as a static teaser card (poster with alt text, title, genres).
No link, no tap action.
6. "Login / Get Started" button below the roll buttons
7. User scrolls down to reveal:
a. About section — fuller description of how MovieDice works
b. 3-step how-it-works demo (Create a list → Add movies → Roll the dice)
- Step 1: left-aligned
- Step 2: right-aligned
- Step 3: left-aligned (zigzag visual rhythm)
8. Footer on all pages (mounted in (public)/layout.tsx): TMDB attribution (logo + link + disclaimer),
privacy policy link
1. User taps "Login / Get Started" on landing page
2. User enters display name, optionally picks an avatar color
3. Account created via Supabase Anonymous Sign-In (supabase.auth.signInAnonymously());
JWT issued and managed by Supabase GoTrue; session persisted via @supabase/ssr
cookie-based handling (createBrowserClient / createServerClient)
4. Recovery code (24 alphanumeric characters, 128-bit entropy) shown once — user prompted to save it
5. User selects: "Create a Group" or "Join with a Code"
A. Create → enter group name → group created, invite code shown (e.g., WOLF-MOON)
→ creator assigned List Admin role → lands on home page (with their new list card shown)
B. Join → enter invite code → validated (rate-limited, server-side via service role key)
→ member role assigned → lands on home page (with the joined list card shown)
1. App checks for valid Supabase Auth session
2. If valid session found → navigate directly to the home page (skip landing page)
3. If no session → show landing page (pre-login)
4. Home page layout mirrors the landing page layout, with these differences:
a. The Login button is replaced by a "Create List" button
b. The About / how-it-works section is replaced by the user's list cards
5. Each list card shows:
- List name (left-aligned)
- Number of movies with a film emoji (right-aligned)
- Below: "Created by: [username]"
6. Tapping a list card navigates into that list view
7. "Roll the Dice" and "Genre Roll" buttons at the top roll across ALL unwatched movies
from ALL of the user's lists combined (cross-list roll)
8. The roll result is displayed as a standalone teaser card directly on the home page.
The result does NOT navigate the user into any specific list.
9. If no session (new device) → prompt for recovery code or start fresh
1. User taps search bar at top of list view
2. User types a movie title; TMDB is queried via server-side proxy (/api/tmdb/search)
with ~300ms debounce; include_adult=false on all calls
3. Results appear in two sections:
- Top: movies already in the group's list (labeled "In Your List")
- Below separator: TMDB search results (server-side filtered by adult field)
4. User taps a TMDB result → movie inserted into DB with poster, genres, title, year,
trailer URL (fetched from TMDB via server proxy at add-time;
validated against allowlist: youtube.com, themoviedb.org, imdb.com),
and added-by attribution
5. All group members see the new movie appear in real time
1. Default view: 2-column evenly-scaling poster grid (3-4 columns on tablet/desktop)
2. Each card shows:
- Movie poster (full bleed, using TMDB native sized URL: w342 for mobile grid)
with meaningful alt text (e.g., "Movie Title (Year) poster")
- Movie title below the poster
- Added-by user avatar overlaid top-right corner
- Binoculars emoji overlaid top-left corner — only when movie is watched
3. Grid loads 12 movies initially; additional movies load automatically on scroll to bottom
4. No action buttons on collapsed grid cards — cards are tap-only
5. All poster images use native loading="lazy" attribute
1. User taps any movie poster in the grid
2. A full-page-width panel expands downward, inserted inline below that row in the grid
(mirrors Google Image Search inline expansion — not a modal, popup, or slide-up sheet)
3. Panel contents, top to bottom:
a. Full-size movie poster (TMDB native sized URL: w500) with alt text
b. Movie title
c. "Added by [username]"
d. Genre tags — tappable; each filters the grid to that genre
e. "Watched It" + "Trailer" buttons — displayed side by side
f. Delete button — centered below, separated to prevent accidental taps
4. Delete behavior:
- Tap 1: button shakes, text changes to "Click to confirm delete"
- Tap 2: movie removed from list for all group members in real time
- Tapping elsewhere after Tap 1 resets button to default state
5. Watched It (toggle):
- If unwatched: button color changes to watched state, binoculars overlay appears on grid
poster (top-left), movie moves to "Watched" section
- If watched: button color reverts, binoculars overlay removed, movie returns to main list
- Both indicators update simultaneously on all group members' screens
6. Trailer: opens stored trailer URL in a new tab (with rel="noopener noreferrer")
7. Tapping outside the panel or a close affordance collapses it
1. User taps "Roll the Dice!" (pinned above the movie grid or on the home page)
2. Animated randomizer plays — scatter/flip/spin elimination sequence, 2-3 seconds
(this is distinct from the landing page slot-machine reel animation)
Respects prefers-reduced-motion: if enabled, use a simple fade-in on the winner instead
3. Animation settles on one random unwatched movie from the eligible pool
- On a list page: pool is that list's unwatched movies
- On the home page: pool is all unwatched movies across all of the user's lists combined
4. On the home page, the result is shown as a standalone teaser card in place on the home page.
The user is NOT navigated into any specific list.
5. Result announced via aria-live="polite" region for screen readers
6. Tapping Roll again re-rolls from the same eligible pool
7. Tapping "Genre Roll!" opens a text input
8. User enters genres and/or emotions (e.g., "action, excited")
9. App normalizes input, maps emotion keywords to TMDB genre IDs, filters the unwatched pool
10. Same scatter/eliminate animation plays on filtered results
11. If no matches found: "No matches — showing full list" shown, roll proceeds unfiltered
12. On a list page, the result movie is displayed prominently; tapping it opens the inline
expanded panel
1. List Admin opens group settings (gear icon or settings menu)
2. Available actions:
- Rename the list
- Delete the list (see deletion flow below)
- View member list with option to remove individual members
- Regenerate invite code (revokes old code)
- Display current invite code with copy-to-clipboard
3. Regular members see a settings menu with only: "Leave this list" option
Admin Self-Removal / Ownership Transfer flow:
a. List Admin taps "Leave this list" (or equivalent self-removal action)
b. If other members exist:
- "Transfer Ownership" popup appears before the admin can leave
- Popup shows the current member list; admin selects one member to become the new admin
- "Cancel" button at the bottom dismisses the popup with no changes
- Once a new admin is selected and confirmed, ownership transfers and the original admin
is removed from the list (they leave; the list is NOT deleted)
c. If the admin is the last remaining member (no one else to transfer to):
- The list is deleted automatically (with a standard confirmation prompt)
- Confirmed deletion removes the list and all its movies permanently
List Deletion flow (separate from self-removal):
a. List Admin taps "Delete the list" in settings
b. Standard delete confirmation prompt shown
c. Confirmed deletion removes the list and all its movies permanently
d. This action does NOT trigger the Transfer Ownership popup
1. Master Admin navigates to /admin
2. Login prompt: username + TOTP authenticator code (no password-only fallback)
3. Credentials (username and TOTP secret) are set via environment variables — no first-run UI
4. On successful auth → iron-session v8 issues encrypted HttpOnly cookie (8-hour expiry)
→ Master Admin dashboard
5. Available tools:
- Search any list by name or ID → view details → delete (with confirmation)
- Search any user by display name or ID → view details → delete (with confirmation)
Deletion must remove both public.users row AND auth.users record
(via supabase.auth.admin.deleteUser() using service role key)
6. Master Admin session is separate from regular user sessions
7. All /admin routes redirect to login if no valid admin session
8. TOTP secret rotation requires redeployment (documented operational constraint)
aria-expanded on trigger and role="region" on panel.prefers-reduced-motion. Landing page reel: instant reveal or simple fade-in. In-app roll: fade to winner instead of scatter animation. Full animation remains the default.alt text on all poster images; aria-live="polite" regions for dynamic status messages (roll results, filter changes, watched state toggles, action confirmations)./api/tmdb/*) with include_adult=false. Cache recent search results via TanStack Query with explicit staleTime configuration.| Layer | Choice | Notes |
|---|---|---|
| Frontend | Next.js (React, App Router) | PWA support; output: 'standalone' for Docker |
| Styling | Tailwind CSS | Mobile-first, fast iteration |
| Backend / Database | Supabase (self-hosted) | Postgres + real-time subscriptions + GoTrue auth; full Docker stack |
| Auth | Supabase Anonymous Sign-In via @supabase/ssr |
signInAnonymously() — no email, instant account, JWT for RLS; cookie-based session via createBrowserClient/createServerClient |
| Movie Data | TMDB API | Posters, genres, metadata, trailer URLs; all calls via server-side proxy with include_adult=false |
| State Management | TanStack Query (React Query) | Server state sync, caching with explicit staleTime, loading states |
| Admin Sessions | iron-session v8 | Encrypted HttpOnly cookie for Master Admin TOTP sessions (use v8 README directly — v7 patterns are incompatible) |
| 2FA (Master Admin) | TOTP via otplib (or equivalent) | Authenticator-app compatible; TOTP secret never exposed client-side |
| PWA | @serwist/next | App Router compatible, Workbox 7; requires authoring app/sw.ts and tsconfig.worker.json |
| Image Optimization | sharp (local assets only) | TMDB posters use native sized URLs from TMDB CDN directly (not next/image) |
| Background Jobs | Node.js cron container (node:22-alpine + node-cron) |
Runs alongside app in docker-compose; writes to Postgres via service role key |
| Reverse Proxy | Caddy | HTTPS termination (required for PWA, wss://, secure cookies); persistent volume for TLS certificates |
| Linting / Formatting | ESLint + Prettier + TypeScript strict | next/core-web-vitals + next/typescript presets; husky + lint-staged pre-commit |
| Testing | Vitest (unit) + Playwright (E2E) | Unit tests for pure logic and Client Components only (Vitest cannot render RSC); Playwright runs against Docker production stack |
| Env Validation | t3-env (@t3-oss/env-nextjs) with zod |
Structural enforcement of server/client env var split at build time |
| Runtime | Node.js 22 LTS | node:22-slim Docker base image |
TMDB posters are served directly from TMDB's CDN using native sized URLs — not processed through next/image optimization (which would run sharp in-container and create CPU/memory pressure in Docker). Use these TMDB size variants:
w342 — grid thumbnails (mobile)w185 — reel animation postersw500 — expanded inline panelloading="lazy" attribute on all poster <img> tagsalt text on all poster images (e.g., "Movie Title (Year) poster"); spinning reel posters use aria-hidden (decorative)next/image for locally-served assets only (logo, icons)sharp as an explicit production dependency for local asset optimizationTMDB Terms of Service require visible attribution on every page: the TMDB logo, a link to themoviedb.org, and the disclaimer "This product uses the TMDB API but is not endorsed or certified by TMDB." Implement as a site-wide footer component. Non-compliance risks API key revocation.
All TMDB API calls must be routed through Next.js API Route Handlers (/api/tmdb/*). The TMDB_API_KEY environment variable must NEVER use the NEXT_PUBLIC_ prefix — it must remain server-side only. This is a TMDB Terms of Service requirement. The proxy also enables server-side response caching via Cache-Control headers. All calls must set include_adult=false and server-side filter results by the adult field as defense in depth.
users
signInAnonymously())groups
group_members
movies
landing_reel_posters
admin_sessions
RLS must be enabled on ALL tables with explicit policies — no permissive catch-all. Supabase's anon key is public by design; RLS is the authorization mechanism. Policies use auth.uid() from the JWT issued by Supabase Anonymous Sign-In. Define policies alongside the schema in Phase 1.2. Key rules:
WITH CHECK must enforce added_by = auth.uid() (prevent attribution spoofing); UPDATE must prevent changing added_bySupabase Realtime also respects RLS — subscriptions are authorized by the same policies.
Use supabase migration new via the Supabase CLI. All migrations stored in version control. Migrations must be the sole mechanism for schema changes — no ad-hoc SQL in production.
added_by FK uses ON DELETE SET NULL to prevent FK violations. Deletion wrapped in a transaction per user. Account deletion must also call supabase.auth.admin.deleteUser(userId) to remove the auth.users record. Users cannot be notified before deletion due to anonymous auth (no email). This is documented in the privacy policy.beforeSend callback to strip UUID path segments from error events; do not call Sentry.setUser() with user identifiers. Disclose Sentry as a third-party processor in the privacy policy.Configure HTTP security headers at the Caddy reverse proxy level (not in next.config.js):
Content-Security-Policy — restrict img-src to image.tmdb.org, connect-src to 'self' for API calls and wss://[deployment-domain] for Supabase Realtime WebSocket (not *.supabase.co — self-hosted routes through own domain)X-Frame-Options: DENYX-Content-Type-Options: nosniffReferrer-Policy: strict-origin-when-cross-originStrict-Transport-Security (HSTS) — configured in Caddyfile; start with short max-age (86400) during testing, increase to 2-year production value before launch; do not submit to HSTS preload list until confidentPermissions-PolicyContent-Security-Policy-Report-Only during development to identify violations without blockingnode:22-slim, output: 'standalone', non-root user, tini for PID 1 signal handling, .dockerignore; builder stage must install python3 make g++ for argon2 native build (alternative: @node-rs/argon2 with pre-compiled NAPI binaries eliminates node-gyp requirement)docker compose up. Defaults are published on GitHub — a default JWT_SECRET allows forging JWTs that bypass all RLS. Replace these as a lockstep set: JWT_SECRET → regenerate both ANON_KEY and SERVICE_ROLE_KEY (they derive from JWT_SECRET); also replace POSTGRES_PASSWORD, DASHBOARD_USERNAME, DASHBOARD_PASSWORD. Consider adding a startup check that refuses to start if default values are detected.GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=true (disabled by default — without it, signInAnonymously() returns 400); disable all other auth methods: GOTRUE_EXTERNAL_EMAIL_ENABLED=false, GOTRUE_EXTERNAL_PHONE_ENABLED=false, all OAuth providers disabled127.0.0.1:3000 or remove from production docker-compose; access via SSH tunnel only. Only Caddy is exposed to the internet.wss:// Supabase Realtime, and secure cookies); Caddy /data and /config directories must be mounted as persistent named Docker volumes (certificate loss + Let's Encrypt rate limits = up to 1 week downtime); use Let's Encrypt staging endpoint for initial testing/api/health endpoint checking Supabase connectivity; used by Docker HEALTHCHECKnode:22-alpine + node-cron) running alongside the app in docker-compose; connects to Postgres via SUPABASE_SERVICE_ROLE_KEY; handles landing reel refresh and trailer URL refreshpg_dump backup container in docker-compose running daily with 7-day retention; document restore procedure; test restore before launchmax-size: 10m, max-file: 5 to prevent disk exhaustion and bound GDPR log retentionTMDB_API_KEY (server-side only — never NEXT_PUBLIC_)NEXT_PUBLIC_SUPABASE_URL — the public Supabase URL (browser client uses this)NEXT_PUBLIC_SUPABASE_ANON_KEY — the public anon key (browser client uses this; public by design in Supabase's security model)SUPABASE_INTERNAL_URL — Docker internal Kong URL (e.g., http://supabase_kong:8000; server-side Next.js code uses this to avoid routing through Caddy)SUPABASE_SERVICE_ROLE_KEY (for server-side admin operations; never exposed client-side)MASTER_ADMIN_USERNAME — the master admin login usernameMASTER_ADMIN_TOTP_SECRET — the TOTP secret (base32); configure this in your authenticator app (e.g., Google Authenticator, Authy) before first useIRON_SESSION_SECRET — 32+ character secret for iron-session cookie encryptionGOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=true — required for anonymous sign-in@t3-oss/env-nextjs) with zod; server vars in server block, public vars in client block; missing or malformed variables produce a clear build/startup failureMVP Deadline: April 26, 2026 Full Feature Complete: July 5, 2026
output: 'standalone' in next.config.ts; configure TypeScript strict mode, ESLint (next/core-web-vitals + next/typescript), Prettier; set up husky + lint-staged (pre-commit: lint/format, pre-push: lint + typecheck + build); install sharp as production dependency; add Vitest for unit testing (scope: pure logic and Client Components only — Vitest cannot render RSC)docker compose up (JWT_SECRET → regenerate ANON_KEY + SERVICE_ROLE_KEY together; replace POSTGRES_PASSWORD, DASHBOARD_USERNAME, DASHBOARD_PASSWORD); configure GoTrue: set GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=true, disable email/phone/OAuth auth methods; create schema (users, groups, group_members, movies, landing_reel_posters tables) with CHECK constraints on display_name and group name; define and enable RLS policies on all tables with WITH CHECK clauses (see RLS section); initialize Supabase CLI migrations workflow — all schema changes via supabase migration new@supabase/ssr (createBrowserClient for browser, createServerClient for server-side with SUPABASE_INTERNAL_URL); implement env var validation at startup via t3-env (@t3-oss/env-nextjs) with zod — server vars in server block, client vars in client block; create TMDB API proxy route (/api/tmdb/*) to keep API key server-side; set include_adult=false on all TMDB callssupabase.auth.signInAnonymously(); display name input and optional avatar color picker; session managed by Supabase GoTrue via @supabase/ssr cookie-based handling (JWT issued automatically); verify GoTrue returns 200 (not 400) — confirm GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=true is setpython3 make g++ for argon2 native build), docker-compose.yml orchestrating Next.js app + self-hosted Supabase stack + Caddy reverse proxy + Node.js cron container + pg_dump backup container (daily, 7-day retention), .dockerignore, /api/health endpoint; network security: Kong/Postgres ports internal only, Studio restricted to 127.0.0.1; Caddy persistent volumes for /data and /config (TLS certificates); Docker log rotation on all containers (max-size: 10m, max-file: 5); use Let's Encrypt staging for initial testing; deploy and confirm Supabase connection works in productionbeforeSend to strip UUID path segments from error events; do not call Sentry.setUser() with user identifiers/api/tmdb/*): search endpoint with include_adult=false and server-side adult field filtering, poster URL construction using TMDB native sizes (w342 grid, w185 reel, w500 expanded), trailer URL fetch at add-time; implement TanStack Query caching with explicit staleTime configuration; document API routes in markdownloading="lazy" and meaningful alt text (e.g., "Movie Title (Year) poster"), title below, added-by avatar overlaid top-right, binoculars emoji overlaid top-left (watched only), no action buttons on cards, tap-only interactionaria-live="polite" regionaria-live="polite" regionaria-live="polite" regionprefers-reduced-motion (use simple fade-in on winner when enabled)filterByGenresAndEmotionsStructured (2026-04-14) — fixes genre-only rolls silently discarding the filter when movies.genres stores TMDB names, not numeric IDs.src/app/(public)/page.tsx + (public)/layout.tsx. Duplicate stub src/app/page.tsx removed so (public)/page.tsx is no longer shadowed.include_adult=false) and replaces the full set in the DB on each run. NOTE (2026-05-02): Table exists and is populated by seed.sql. PINNED_REEL_POSTERS constant in the API route always prepends hard-coded entries (e.g., tmdb_id 615 "The Passion of the Christ"). OUTSTANDING: cron/index.ts reel-refresh handler is still a TODO — the /api/tmdb/reel-posters route currently fetches TMDB live on each request and ignores the DB table. Cron wiring is the remaining gap for this task.aria-hidden on spinning posters), decelerate, and land on a single TMDB movie result with alt text (the final result is fetched live from TMDB via server proxy — not constrained to the reel poster set); animation is user-triggered only and completes within 5 seconds (WCAG 2.2.2); respect prefers-reduced-motion (instant reveal or simple fade-in when enabled). NOTE (2026-05-02): Continuous carousel and slot-machine spin on roll are implemented. KNOWN BUG (U9): modulo wrap missing in spinning branch causes scroll offset to drift on repeated rolls; fix tracked in research/PHASE5_UI_FIXES_PLAN.md. NOTE (2026-05-02 dea71d9/0061375): Roll result card now emerges inside the carousel center via animate-emerge keyframe (scale 0→1.08→1, ~500ms, bouncy, skipped under prefers-reduced-motion); snap math positions midpoint of a gap at viewport center so card sits in a symmetric slot; posters spread ±110px on settle. Card stays settled until user re-rolls or refreshes (RESUME_DELAY auto-resume timer removed). TeaserCard reduced to ~1.3x reel poster size. "i" info button on TeaserCard opens (src/components/landing/more-info-modal.tsx) with title+year, genres, plot, Add to list (→ /login, no save-intent), Watch Trailer (lazy-fetches /api/tmdb/movie/[id]/videos); mirrors GenreRollModal a11y pattern; uses createPortal to escape the transformed ancestor. IMPORTANT: this landing MoreInfoModal is distinct from the in-app U5 "More Info" button targeting src/components/movies/expanded-panel.tsx — U5 is still TODO.
/api/tmdb/popular?page=N (random page 1–50, pool ~1000 movies). Result displayed as a static teaser card (poster with alt text, title, genres) — no link, no tap action. NOTE: this is a distinct pool from the carousel reel — see Feature Flow section 5 for the two-pool distinction.supabase.auth.signOut() server-side (or via a dedicated API route), clear the session cookie, and redirect to the landing page. DECISIONS NEEDED: (a) where the sign-out control lives (header menu, settings page, or both); (b) whether to show a confirmation dialog warning that signing out of an anonymous account without a saved recovery code will orphan the account; (c) redirect target after sign-out (landing page assumed). Do not confuse with /api/admin/logout, which handles Master Admin TOTP sessions only.public.users row AND auth.users record (via supabase.auth.admin.deleteUser() using service role key)@serwist/next for home screen installation; requires authoring app/sw.ts, tsconfig.worker.json (WebWorker lib), and public/manifest.json with required fields and icon sizes (192x192, 512x512, maskable variants); budget a half-daypersistQueryClient (IndexedDB; requires @tanstack/react-query-persist-client, @tanstack/query-async-storage-persister, idb-keyval), disable write actions with message; do not queue offline writes; budget 2-4 hours including serialization testingaria-expanded on trigger, role="region" on panel); verify alt text and aria-live regions added in Phases 3-5 are correct@tanstack/react-virtual) if grid performance degrades with large lists/api/admin/logout; confirm any anonymous-account warning (if implemented per 5.9 decision) displays correctly before sign-out completesprefers-reduced-motion preferenceStatic mapping used by Genre Roll to translate emotion keywords into TMDB genre IDs. Implemented as a static TypeScript constant. Normalize input to lowercase and tokenize on spaces and commas before matching.
| Emotion Keywords | Primary Genres | Secondary Genres |
|---|---|---|
| happy, cheerful, upbeat, fun | Comedy, Animation, Family | Adventure, Musical |
| sad, emotional, cry, tearjerker | Drama, Romance | War, Biography |
| excited, hyped, energetic, pumped | Action, Adventure | Science Fiction, Thriller |
| scared, tense, nervous, creepy | Horror, Thriller | Mystery |
| calm, relaxed, chill, cozy | Documentary, Drama | Animation |
| romantic, lovey, date night | Romance, Comedy | Drama |
| thoughtful, reflective, deep | Documentary, Drama | History, Biography |
| funny, silly, goofy, laugh | Comedy, Animation | Family |
| dark, gritty, intense, serious | Crime, Thriller | Drama, War |
| nostalgic, classic, retro | (any genre, filtered to release year < 2000) |
Union all matched genre IDs from primary and secondary columns and filter the movie pool. If no tokens match any keyword, notify user with "No matches — showing full list" and proceed with the unfiltered pool.
Features added after initial scope. Complete current Implementation Plan progress before starting these.
| Feature | Description | Added On | Rationale |
|---|---|---|---|
| Compact list/grid toggle | Toggle between poster grid and a compact list layout (title, year, metadata per row) | 2026-04-05 | Deferred from MVP — user unfamiliar with it at scoping; low priority relative to core flows |
| Self-service account deletion | User-facing account deletion flow with cascading deletes (wrapped in transaction), ownership transfer for administered groups (auto-transfer to longest-tenured member), anonymization of added_by references (ON DELETE SET NULL), and removal of auth.users record via supabase.auth.admin.deleteUser() |
2026-04-06 | GDPR Article 17 (Right to Erasure); MVP relies on Master Admin deletion on request as interim |