Author SHA1 Message Date
X4Lo a88423163e Merge pull request 'Update docs vault and README for recent features' (#8) from docs/update-vault into master
Reviewed-on: #8
2026-11-05 19:55:48 +00:00
X4Lo 229ecef902 Update docs vault and README for recent features
- New notes: History, Artwork
- Rewrite TMDB Integration: single detail request, entry mapper, rate
  limiter, refresh sync, stale-entry refresh, recommendations
- Update pages, routing, API reference, models, database migrations,
  services, components, hooks, API clients, settings, media system,
  library, Electron (Tauri in progress) and known issues
- Rewrite README for the current React/Express stack and setup
2026-11-05 19:55:04 +00:00
20 changed files with 479 additions and 162 deletions

No files matched your search

+66 -73
View File
@@ -1,116 +1,109 @@
# Showy - Movies & Series Library Tracker
# Showy — Movies & Series Library Tracker
**Showy** is a comprehensive application designed to help you manage your movies and series library. Built with **Angular 17**, **Node.js**, **Express**, and **MySQL**, and optionally packaged with **Electron**, Showy allows you to track your watch progress, manage your watchlist, view upcoming releases on a calendar, and organize official and custom collections. The app also features a dashboard for quick insights into your library. The entire application is **dockerized** for easy setup and deployment.
**Showy** is a personal, single-user app for tracking the movies and TV series you watch. It pulls metadata from **TMDB**, keeps your library, watch history and ratings in **MySQL**, and runs as a web app or a **desktop app** (Electron, with a Tauri version in progress).
---
## Features
- **Library Management**:
- Add movies and series to your library.
- Track watch progress for movies and episodes.
- Add movies and series to your watchlist.
- **Calendar**:
- View upcoming movies and episodes in a calendar view.
- Never miss a release date for your favorite shows or movies.
- **Collections**:
- Browse official collections (e.g., Marvel Cinematic Universe, Harry Potter series).
- Create and manage custom collections (e.g., "90s Classics", "Christmas Movies").
- **Dashboard**:
- Get an overview of your library stats.
- View recently added movies/series, upcoming releases, and watch progress.
- **Optional Desktop App**:
- Use Showy as a desktop application with Electron for a seamless experience.
- **Dockerized**:
- Easy setup and deployment using Docker and Docker Compose.
- **Library** — add movies and shows from TMDB; favorites, hidden entries, watchlist; filter by type, genre, rating and year
- **Entry pages** — full-bleed hero, trailer player, cast and crew, seasons (list or card view), where to watch, keywords, recommendations, budget/box office, certification and external links. Titles **not in your library** open on the same page from TMDB data, with *Add to Library*
- **Artwork** — every TMDB poster, backdrop and logo for a title, merged with your local media, with one-click *Add*
- **Watch tracking** — movies and episodes with exact/estimated/unknown dates, watch buddies, rewatches, season "mark all watched" (single date or spread over a range)
- **Season & episode pages** — progress, *Continue* to the next unwatched episode, directors/writers, guest stars
- **History** — everything you watched by year, as a list, a timeline, or a Spotify-style **Year in Review**
- **Calendar** — upcoming episodes
- **Collections** — TMDB collections and your own
- **People** — cast and crew pages with filmography split into "in your library" and "not in library"
- **Dashboard** — watch time, activity, genres, ratings and growth charts
- **Discovery Videos** — a personal video vault linked to library entries
- **In-app streaming** and a **command palette** (search, recently viewed, quick navigation)
- **Maintenance** — background **TMDB refresh** of stale entries (rate limited), orphan media/people cleanup, duplicate credits, watch-status fixes
---
## Technologies Used
## Tech Stack
- **Frontend**: Angular 17
- **Backend**: Node.js, Express
- **Database**: MySQL
- **Optional Desktop Integration**: Electron
- **Containerization**: Docker, Docker Compose
| Layer | Technologies |
|---|---|
| Frontend | React 19, TypeScript, Vite 8, Tailwind CSS 4, Base UI (shadcn-style components), TanStack Query 5, Zustand 5, React Router 7, Recharts |
| Backend | Node.js, Express 4, Sequelize 6, MySQL 8, Axios, Sharp, JWT auth |
| Data | [TMDB API v3](https://developer.themoviedb.org/) (rate limited, proxied by the backend) |
| Desktop | Electron 45 (`electron/`); Tauri v2 in progress on the `feat/tauri-app` branch |
---
## Project Structure
```
showy/
├── frontend/ # Angular 17 frontend
│ ├── src/
│ │ ├── app/ # Angular components, services, modules
│ │ ├── assets/ # Static assets (images, styles)
│ │ └── environments/ # Environment configurations
│ ├── Dockerfile # Dockerfile for the frontend
│ └── ...
├── backend/ # Node.js + Express backend
│ ├── config/ # Database and app configurations
│ ├── controllers/ # API controllers
│ ├── models/ # Database models
│ ├── routes/ # API routes
│ ├── Dockerfile # Dockerfile for the backend
│ └── ...
├── electron/ # Electron configuration (optional)
├── docker-compose.yml # Docker Compose configuration
└── README.md # This file
Showy/
├── backend/ # Express + Sequelize API (models, routes, controllers, services, mappers)
│ ├── config/ # DB connection, relations, startup migrations, data seeding
│ └── settings.json # Runtime settings (TMDB key, ports, auth) — copy from settings.json.example
├── react_frontend/ # React + Vite frontend (the current UI)
├── electron/ # Electron desktop shell
├── docs-vault/ # Project documentation (Obsidian vault) — start at Index.md
├── frontend/ # Legacy Angular frontend (still used by docker-compose)
└── docker-compose.yml
```
---
## Getting Started
### Prerequisites
- Docker
- Docker Compose
- Node.js 18+ and **pnpm**
- MySQL 8 with a database named `Showzy` (connection settings in `backend/config/database.js`)
- A TMDB API key
### Installation
1. **Clone the repository**:
### 1. Backend
```bash
git clone https://github.com/X4Lo/showy.git
cd showy
cd backend
pnpm install
cp settings.json.example settings.json # then set tmdbApiKey, userDataPath, authPassword, jwtSecret
pnpm dev # http://localhost:4000/api/v1
```
2. **Set up environment variables**:
- Create a `.env` file in the `backend` directory with the following variables:
On start the backend syncs the schema and runs `config/migrations.js`, which adds any new columns to an existing database (additive only).
### 2. Frontend
```bash
PORT=3000
DB_HOST=mysql
DB_USER=root
DB_PASSWORD=yourpassword
DB_NAME=showy
cd react_frontend
pnpm install
pnpm dev # http://localhost:4200
```
1. **Build and run the application with Docker Compose**:
The Vite dev server proxies `/api` to the backend; change the `proxy.target` in `vite.config.ts` to point at `http://localhost:4000` for local development.
### 3. Desktop app (optional)
```bash
docker-compose up --build
cd electron
pnpm install
pnpm build-front # builds the frontend into electron/frontend_build
pnpm start
```
4. **Access the app**:
- Frontend: Open your browser and navigate to `http://localhost:4200`.
- Backend API: Access the API at `http://localhost:3000`.
5. **(Optional) Run the app with Electron**:
- Follow the instructions in the `electron/README.md` to build and run the desktop app.
See [`docs-vault/Electron.md`](docs-vault/Electron.md) for packaging. The Tauri version lives in `tauri/` on the `feat/tauri-app` branch (see its `tauri/README.md`).
## Acknowledgments
### Docker
- Thanks to the Angular, Node.js, and Express communities for their amazing tools and libraries.
- Special thanks to (mention any libraries or tools you used, e.g., TMDB API for movie data).
`docker-compose up --build` starts MySQL, the backend (port 4000) and the **legacy Angular** frontend (port 3000). The React frontend isn't in Docker yet.
---
## Documentation
Detailed docs live in [`docs-vault/`](docs-vault/Index.md) — architecture, API reference, database models, TMDB integration, every page and feature, and known issues.
---
## Contact
For questions or feedback, feel free to reach out:
- **Mohammed Abad**: [mohammedabad.me@gmail.com](mailto:mohammedabad.me@gmail.com)
- **GitHub**: [X4Lo](https://github.com/X4Lo)
- **Mohammed Abad**: [mohammedabad.me@gmail.com](mailto:mohammedabad.me@gmail.com)
- **GitHub**: [X4Lo](https://github.com/X4Lo)
---
Enjoy managing your movies and series with **Showy**! 🎬🍿
Data provided by [TMDB](https://www.themoviedb.org/). This product uses the TMDB API but is not endorsed or certified by TMDB.
+12
View File
@@ -199,3 +199,15 @@ Response types:
- **Duplicate credits:** `{ groups: number, duplicates: number, deleted: number }`
- **Auto-fix watch statuses:** `{ completed: number, watching: number, planToWatch: number }`
- **Impossible seen dates:** Scan → `{ count: number }`, Fix → `{ count: number, added: number }`
## entries.ts — additions
`getRecommendations(id)`, `getTmdbRecommendations(type, tmdbId)`, `getArtwork(id)`, `getTmdbArtwork(type, tmdbId)`, `addArtwork(id, { type, file_path })`
## maintenance.ts — additions
`getStaleEntries(hours)`, `startStaleRefresh(hours)` (202 or 409), `cancelStaleRefresh()`
## history.ts
`historyApi.getYears()`, `historyApi.getYear(year)` — types `HistoryYear`, `HistoryEntry`, `HistoryEpisode`, `HistoryEvent`, `HistoryYearData`
+32 -2
View File
@@ -57,7 +57,10 @@ All endpoints are prefixed with `/api/v1`. See [[Backend]] for server setup.
| `DELETE` | `/entries/:id` | Delete entry and all related data |
| `GET` | `/entries/:id/seasons` | Get all seasons for a TV entry |
| `GET` | `/entries/:id/credits` | Get ALL credits (cast + crew) for an entry, with associated `person` populated. Used by [[Pages#EntryCastsPage\|EntryCastsPage]] |
| `PUT` | `/entries/:id/refresh` | Force refresh from TMDB |
| `GET` | `/entries/:id/recommendations` | Live TMDB recommendations for a library entry (not stored) |
| `GET` | `/entries/:id/artwork` | TMDB posters/backdrops/logos merged with the entry's media — see [[Artwork]] |
| `POST` | `/entries/:id/artwork` | Download a TMDB image into the media table: `{ type, file_path }` |
| `PUT` | `/entries/:id/refresh` | Force refresh from TMDB (details, ids, ratings, genres, networks, seasons, episodes, credits) |
| `PUT` | `/entries/:id/fetch-collection` | Fetch/create TMDB collection for entry |
| `GET` | `/entries/sync-series` | Batch refresh all non-ended TV series |
| `POST` | `/entries/:id/media` | Upload media (multipart — poster/backdrop/logo) |
@@ -73,7 +76,9 @@ All endpoints are prefixed with `/api/v1`. See [[Backend]] for server setup.
| `GET` | `/entries/tmdb/top-rated/:type` | Top-rated movies/tv |
| `GET` | `/entries/tmdb/upcoming/movie` | Upcoming movies |
| `GET` | `/entries/tmdb/search?query=&page=` | Multi-search |
| `GET` | `/entries/tmdb/preview/:type/:tmdbId` | Preview TMDB entry (movie/tv) before adding — returns local + TMDB data |
| `GET` | `/entries/tmdb/preview/:type/:tmdbId` | Preview a TMDB entry before adding. Includes `entry` (same shape as a library entry), `seasons` and `credits` (cast + directors) |
| `GET` | `/entries/tmdb/recommendations/:type/:tmdbId` | Recommendations by TMDB id (entries not in the library) |
| `GET` | `/entries/tmdb/artwork/:type/:tmdbId` | TMDB artwork by TMDB id (read-only) |
---
@@ -228,6 +233,19 @@ See [[Statistics]] for chart details.
---
## History
> [!info] File: `routes/history.routes.js` → `services/historyService.js`
See [[History]].
| Method | Path | Description |
|---|---|---|
| `GET` | `/history/years` | Years with watches, newest first: `[{ year, movies, episodes }]` |
| `GET` | `/history/:year` | Every movie/episode watch in a year, newest first: `{ year, entries: { [id]: entry }, events: [...] }` |
---
## Settings
> [!info] File: `routes/settings.routes.js` → `controllers/settingsController.js`
@@ -302,6 +320,18 @@ See [[Settings Page#Cleanup]] for the UI.
---
### Stale Entries Refresh
| Method | Path | Description |
|---|---|---|
| `GET` | `/maintenance/stale-entries?hours=24` | Count of entries not refreshed in the last `hours` + current job status |
| `POST` | `/maintenance/stale-entries/refresh?hours=24` | Start refreshing them in the background (`202`; `409` if already running) |
| `DELETE` | `/maintenance/stale-entries/refresh` | Cancel the running job |
Entries with auto sync off are skipped. TMDB requests go through the [[TMDB Integration#Rate Limiting|rate limiter]].
---
## Import
> [!info] File: `routes/import.routes.js` → `controllers/importController.js`
+48
View File
@@ -0,0 +1,48 @@
---
title: Artwork
tags:
- feature
- media
- tmdb
---
# Artwork
## Overview
The **Artwork** section at the bottom of [[Pages#EntryDetailsPage|EntryDetailsPage]] lists every TMDB poster, backdrop and logo for the title, merged with the entry's [[Media System|media table]].
## UI
- Tabs: **Posters / Backdrops / Logos** with counts
- **Two rows** shown per tab (columns follow the breakpoint); **Show more** adds two rows
- Language filter (no-text images first, then English, then the original language); **In library** toggle
- Badges: **In library** / **Selected**; language tag; TMDB vote average on hover
- Click an image to open it full size
- Library entries: **Add** downloads the original into the media table; titles not in the library are read-only
## Matching
Media rows record the TMDB `file_path` they were downloaded from in `media.tmdb_path` (`tmdbPath`). A TMDB image is **in library** when a media row of the same type has that path. Media without a path (custom uploads, images downloaded before the column existed) appear as local-only items first.
> [!warning] Older downloads
> Images downloaded before `tmdb_path` existed can't be matched, so the same TMDB image can be added again. See [[Known Issues]].
## Adding
`POST /entries/:id/artwork { type, file_path }`:
1. Validates the type (`poster` / `backdrop` / `logo`) and path
2. Returns the existing row if that image is already in the library
3. Downloads `https://image.tmdb.org/t/p/original{file_path}` into `images/entries/{type}s/`
4. Creates the media row — **selected** only if no image of that type is selected yet
5. Generates the preview file
## Implementation
| Layer | File |
|---|---|
| Service | `backend/services/artworkService.js` |
| Endpoints | `GET /entries/:id/artwork`, `POST /entries/:id/artwork`, `GET /entries/tmdb/artwork/:type/:tmdbId` |
| Hooks | `useArtwork`, `useAddArtwork` in `react_frontend/src/hooks/useEntries.ts` |
| Component | `react_frontend/src/components/entries/ArtworkSection.tsx` |
+20
View File
@@ -82,6 +82,26 @@ See [[Discovery Videos]].
| `VideoDropzone` | `discovery-videos/VideoDropzone.tsx` | Native HTML5 drag & drop zone (no dependency) |
| `EntryMultiSelect` | `discovery-videos/EntryMultiSelect.tsx` | Search-first library entry picker (debounced 250 ms) reading from [[Stores\|library store]] |
## Entry Detail Components
| Component | File | Purpose |
|---|---|---|
| `ArtworkSection` | `components/entries/ArtworkSection.tsx` | [[Artwork]] tabs, language filter, add to library |
| `WatchProvidersCard` | `components/entries/WatchProvidersCard.tsx` | Where to watch, per country |
| `TrailerDialog` | `components/entries/TrailerDialog.tsx` | In-app YouTube player for stored TMDB videos |
| `RecommendationsSection` | `components/entries/RecommendationsSection.tsx` | "More like this" by entry id or TMDB id |
| `SeasonsContainer` | `components/entries/SeasonsContainer.tsx` | Seasons with list/cards toggle; cards show a circular progress ring around the mark-watched button |
| `SeasonEpisodes`, `EpisodeViewToggle` | `components/entries/SeasonEpisodes.tsx` | Season page episodes in list or card view |
| `DetailHero` (+ `MetaItem`, `HeroChip`, `IconAction`, `IconLink`, `DetailSection`, `DetailCard`, `DetailRow`) | `components/entries/DetailHero.tsx` | Shared hero and building blocks for the season and episode pages |
## History Components
| Component | File | Purpose |
|---|---|---|
| `HistoryList` | `components/history/HistoryList.tsx` | Months → days → rows |
| `HistoryTimeline` | `components/history/HistoryTimeline.tsx` | Vertical timeline with month dividers |
| `YearInReview` | `components/history/YearInReview.tsx` | Wrapped-style stats |
## Skeletons
> [!info] File: `components/skeletons/PageSkeletons.tsx`
+2
View File
@@ -15,6 +15,7 @@ MySQL database named **Showzy**, managed by Sequelize 6 ORM.
- Connection: `localhost`, user `root`, password `password`
- Sync mode: `sequelize.sync({ alter: false })` — no auto-alter in production
- Migrations: `config/migrations.js` runs after sync on every start. It adds any column a model defines that the table lacks (additive only, nothing is dropped) and widens a few changed types (`certification`, `last_fetch`, `network_studio`, `networks.name`). New model attributes reach existing databases automatically on the next start.
- Logging: writes SQL to `sequelize.log`
- Genre seeding: 27 TMDB genres auto-seeded on startup
@@ -109,6 +110,7 @@ See [[Models]] for detailed field definitions of every model.
## Important Files
- `backend/config/database.js` — Sequelize connection
- `backend/config/migrations.js` — Startup column migrations
- `backend/config/relations.js` — All associations
- `backend/config/dataInitializer.js` — Genre seeding
- `backend/config/sequelizeHooks.js` — Collection order hooks
+3
View File
@@ -7,6 +7,9 @@ tags:
# Electron
> [!note] Tauri in progress
> A Tauri v2 version of the desktop app is being built in `tauri/` on the `feat/tauri-app` branch (not merged yet). Electron stays as is until it's ready. Dev mode works on Windows; the release build is blocked by the packaged backend resolving `settings.json` from inside pkg's read-only bundle. See `tauri/README.md` on that branch.
## Overview
Electron 34 wraps the Showy backend + React frontend into a standalone desktop application for Windows. The backend runs **in-process** (no child process spawn), and the app uses a custom frameless title bar with IPC-driven window controls.
+59
View File
@@ -0,0 +1,59 @@
---
title: History
tags:
- feature
- history
- watch-tracking
---
# History
## Overview
Everything you watched, by year, at `/history` (sidebar → History, or the command palette). Built from [[Watch Tracking|EntrySeen and EpisodeSeen]] records.
## Controls
- **Year picker** — only years with watches; previous / next arrows
- **Type filter** — All / Movies / TV
- Tab, year and filter are kept in the URL: `/history?tab=timeline&year=2024&type=tv`
## Tabs
### History
Months newest first, each with a sticky header (movies, episodes, watch time). Inside each month, watches are grouped by day. Each row shows the poster, title, episode, runtime and who you watched with.
### Timeline
A vertical line from the latest watch at the top down to January, with a divider per month. Poster cards alternate sides on wide screens; the dot colour marks movies (amber) or TV (blue).
### Year in Review
Wrapped-style stats: total hours (and full days), movies, episodes, shows, days watching, longest streak, busiest day, biggest binge, favourite weekday and month, top 5 shows, top genres by time, month-by-month and weekday charts, top-rated movies, rewatches, top networks, watch buddies, new shows started (first episode watched was S1E1), and the first and last watch of the year.
## Sessions
Episodes of the same show watched back to back on the same day are grouped into one **session** (e.g. "S1 E1–E5 · 5 episodes"). Lists and the timeline show sessions; the review counts individual watches.
## Unknown Dates
Watches with `accuracy = UNKNOWN` (bulk imports) are badged "Date unknown". The Year in Review leaves them out by default because they distort streaks, busiest days and monthly charts; a checkbox includes them.
## Implementation
| Layer | File |
|---|---|
| Endpoints | `backend/routes/history.routes.js` — `GET /history/years`, `GET /history/:year` |
| Service | `backend/services/historyService.js` |
| API client / hooks | `react_frontend/src/api/history.ts`, `react_frontend/src/hooks/useHistory.ts` |
| Grouping & stats | `react_frontend/src/lib/history.ts` — `buildSessions`, `groupByMonth`, `computeReview` |
| Page | `react_frontend/src/pages/HistoryPage.tsx` |
| Tabs | `react_frontend/src/components/history/` — `HistoryList`, `HistoryTimeline`, `YearInReview` |
`GET /history/:year` returns each title once in `entries` (poster, runtime, genres, networks, rating) and references it from every watch in `events`. A busy year (~1,650 watches) is about 530 KB.
## See Also
- [[Watch Tracking]]
- [[Statistics]] — all-time charts on the dashboard
+13
View File
@@ -140,6 +140,19 @@ See [[Discovery Videos]].
| `useUpdateVideo()` | Mutation | `PUT /discovery-videos/:id` |
| `useDeleteVideo()` | Mutation | `DELETE /discovery-videos/:id` |
## useEntries — TMDB data additions
- `useEntryRecommendations(id)` / `useTmdbRecommendations(tmdbId, type)` — "More like this"
- `useArtwork({ entryId } | { tmdbId, type })` / `useAddArtwork(entryId)` — [[Artwork]]
- `useTmdbPreview(tmdbId, type)` — also returns the entry-shaped `entry` used by the unified details page
## useHistory
> [!info] File: `hooks/useHistory.ts`
- `useHistoryYears()` — `GET /history/years`
- `useHistoryYear(year)` — `GET /history/:year`
## useDebounce
> [!info] File: `hooks/useDebounce.ts`
+4 -2
View File
@@ -23,7 +23,7 @@ aliases:
- [[Tech Stack]] — All technologies and versions
- [[Deployment]] — Docker Compose setup
- [[Env]] — Environment variables and configuration
- [[Electron]] — Desktop wrapper details
- [[Electron]] — Desktop wrapper details (a Tauri version is in progress)
## Backend
@@ -35,12 +35,13 @@ aliases:
- [[Error Handling]] — Custom error classes and middleware
- [[TMDB Integration]] — External API proxy and data fetching
- [[Media System]] — Image storage, download, optimization, previews
- [[Artwork]] — TMDB posters/backdrops/logos merged with the media table
- [[Import System]] — Bulk import flows
## Frontend
- [[Frontend]] — React app structure, patterns, conventions
- [[Routing]] — All 17 routes with lazy loading
- [[Routing]] — All routes with lazy loading
- [[Pages]] — Every page component
- [[Components]] — All UI components by category
- [[Hooks]] — Custom hooks (queries, mutations, utilities)
@@ -55,6 +56,7 @@ aliases:
- [[Library]] — Entry management, watchlist, favorites
- [[Collections]] — TMDB and user collections
- [[Watch Tracking]] — EntrySeen, EpisodeSeen, accuracy system
- [[History]] — History list, timeline and year in review
- [[Streaming]] — In-app streaming system with 4 providers (8 servers)
- [[Calendar]] — Upcoming episodes view
- [[Discovery Videos]] — Personal video vault (upload + link to library entries)
+26 -3
View File
@@ -49,6 +49,12 @@ Tracked bugs and technical debt items.
- **Impact:** DoS risk if backend is exposed
- **Fix:** Gate behind dev-mode check
### Packaged Backend Can't Find settings.json
- **Issue:** `configService` resolves `settings.json` from `__dirname`, which points inside pkg's read-only snapshot in `backend.exe`
- **Impact:** Blocks the Tauri release build (sidecar backend); see [[Electron]]
- **Fix:** Resolve settings next to the executable (`process.execPath`) or a user data folder when running under pkg
## Frontend
### Implicit `any` Types in SeasonPage
@@ -71,6 +77,23 @@ Tracked bugs and technical debt items.
- **Impact:** [[Normalizers]] layer exists to handle this, but it's fragile
- **Fix:** Standardize backend response format (ideally all snake_case)
### Web Build Fails Type Checking
- **Issue:** `tsc -b` (and so `pnpm build`) reports ~41 existing errors, mostly `asChild` on Base UI components and `string | null` select values (LibraryPage, WatchlistPage, several dialogs)
- **Impact:** The plain web build fails; Vite dev, Electron and Tauri dev still run
- **Fix:** Replace `asChild` with `render` props and narrow select values
### Old Media Not Matched in Artwork
- **Issue:** Images downloaded before `media.tmdb_path` existed have no TMDB path
- **Impact:** They show as local-only in [[Artwork]], and the same TMDB image can be added again as a duplicate
- **Fix:** Backfill by re-downloading, or compare image hashes
### Unknown-Date Watches
- **Issue:** ~311 imported movie watches have `accuracy = UNKNOWN`
- **Impact:** Badged in [[History]] and excluded from the Year in Review by default (toggle to include)
## Database
### Franchise Model Unused
@@ -82,9 +105,9 @@ Tracked bugs and technical debt items.
### No Database Migrations
- **Issue:** Schema changes rely on `sequelize.sync({ alter })` which is disabled (`doUpdate = false`)
- **Impact:** Manual schema management required for changes
- **Fix:** Implement proper Sequelize migrations
- **Issue:** `sequelize.sync({ alter })` is disabled; `config/migrations.js` only adds missing columns and widens a fixed list of types
- **Impact:** Renames, drops and index changes still need manual SQL
- **Fix:** Adopt versioned Sequelize migrations if the schema starts changing in non-additive ways
## Docker
+3 -2
View File
@@ -51,9 +51,10 @@ All entries are held in [[Stores|useLibraryStore]] as a `Map<number, Entry>` for
## Pages
- [[Pages#LibraryPage|LibraryPage]] — Grid of all library entries
- [[Pages#LibraryPage|LibraryPage]] — Grid of all library entries (All / Movies / TV tabs + Favorites and Hidden toggles)
- [[Pages#WatchlistPage|WatchlistPage]] — Grid of watchlist entries
- [[Pages#EntryDetailsPage|EntryDetailsPage]] — Entry detail view
- [[Pages#EntryDetailsPage|EntryDetailsPage]] — Entry detail view (also used for titles not in the library)
- [[History]] — Everything watched, by year
## Related
+5
View File
@@ -66,6 +66,7 @@ Key fields:
- `path` — UUID filename on disk
- `isSelected` — the "active" image displayed in UI
- `isCustom` — user-uploaded (vs TMDB-downloaded)
- `tmdbPath` — TMDB `file_path` the image came from; recorded on every TMDB download so [[Artwork]] can mark images already in the library
## Serving URLs
@@ -96,6 +97,10 @@ See [[Media Utilities]] for how the frontend resolves which image to display:
1. Local selected media → 2. TMDB fallback → 3. Default placeholder
## Artwork
Entry pages list every TMDB poster, backdrop and logo merged with the media table, and can download any of them into it. See [[Artwork]].
## Maintenance
See [[Settings Page#Cleanup]] for orphan file/record detection and removal.
+41 -5
View File
@@ -34,8 +34,8 @@ The core model — represents a movie or TV series.
| `tagline` | STRING(200) | |
| `storyline` | STRING(3000) | |
| `country` | STRING(30) | |
| `certification` | INTEGER | |
| `network_studio` | STRING(40) | |
| `certification` | STRING(20) | e.g. `R`, `TV-14` (US first, then origin country) |
| `network_studio` | STRING(100) | First network, else first production company |
| `collection_id` | INTEGER | TMDB collection ID |
| `max_cast` | INTEGER | Default `10` |
| `credit_fetched` | BOOLEAN | Default `false` |
@@ -51,8 +51,28 @@ The core model — represents a movie or TV series.
| `banner_path` | STRING(200) | TMDB backdrop path |
| `date_first_seen` | DATEONLY | |
| `date_last_seen` | DATEONLY | |
| `last_fetch` | DATEONLY | Used by [[Services#Lazy Refresh\|lazy refresh]] |
| `last_fetch` | DATE | Last TMDB refresh (date + time); used by the [[API Reference#Stale Entries Refresh\|stale refresh]] |
| `entry_sync_status` | STRING(50) | Nullable. e.g. `"RequireCreditsSync"` |
| `adult` | BOOLEAN | |
| `tmdb_popularity` | FLOAT | |
| `original_language` | STRING(10) | |
| `origin_country` | JSON | `string[]` |
| `homepage` | STRING(500) | |
| `budget` / `revenue` | BIGINT | Movies only |
| `tv_type` | STRING(30) | TV only, e.g. `Scripted` |
| `number_of_seasons` / `number_of_episodes` | INTEGER | TV only |
| `last_air_date` | DATEONLY | TV only |
| `in_production` | BOOLEAN | TV only |
| `spoken_languages`, `production_countries`, `production_companies` | JSON | Detail page only* |
| `keywords` | JSON | `string[]`, up to 30* |
| `tmdb_videos` | JSON | YouTube trailers/teasers, up to 12* (not `videos`: that name is the Discovery Videos association) |
| `watch_providers` | JSON | Per-country stream/rent/buy providers* |
| `alternative_titles` | JSON | * |
| `created_by`, `next_episode_to_air`, `last_episode_to_air` | JSON | TV only* |
\* Listed in `Entry.DETAIL_ONLY_ATTRIBUTES` and excluded from the library list query (`GET /entries`) to keep it small.
All TMDB fields are filled by `mappers/entryMapper.js` — see [[TMDB Integration#Entry Mapper]].
**Has:** [[#EntryId]] (1:1), [[#EntryRating]] (1:1), [[#EntrySeen]] (1:N), [[#Season]] (1:N), [[#Credit]] (1:N), Genres (M:N), Networks (M:N), Collections (M:N), Media (polymorphic)
@@ -67,6 +87,7 @@ The core model — represents a movie or TV series.
| `id` | INTEGER PK AUTO | |
| `tmdb_id` | STRING(30) | |
| `imdb_id` | STRING(30) | |
| `tvdb_id` | STRING(30) | From the season's `external_ids` |
| `entry_id` | INTEGER FK | → Entry |
| `name` | STRING(500) | |
| `overview` | STRING(3000) | |
@@ -105,6 +126,10 @@ The core model — represents a movie or TV series.
| `air_date` | DATE | |
| `user_rating` | FLOAT | |
| `tmdb_rating` | FLOAT | |
| `tmdb_vote_count` | INTEGER | |
| `production_code` | STRING(50) | |
| `crew` | JSON | Directors + writers (`{ id, name, job, department, profile_path }`) |
| `guest_stars` | JSON | Up to 25 (`{ id, name, character, profile_path, order }`) |
| `still_path` | STRING(200) | |
| `date_first_seen` | DATEONLY | |
| `date_last_seen` | DATEONLY | |
@@ -163,6 +188,7 @@ Polymorphic image record. See [[Media System]].
| `mediaableId` | INTEGER | Polymorphic FK |
| `type` | STRING(50) | `'poster'`, `'backdrop'`, `'logo'`, `'still'`, `'profile'` |
| `path` | STRING(200) | UUID filename on disk |
| `tmdbPath` | STRING(200) | `tmdb_path` — TMDB `file_path` the image was downloaded from; null for custom uploads and images downloaded before it existed. Used by [[Artwork]] |
| `isLocal` | BOOLEAN | |
| `isSelected` | BOOLEAN | Default `false` — the "active" media |
| `isCustom` | BOOLEAN | Default `false` — user-uploaded |
@@ -245,6 +271,7 @@ See [[People]].
| `id` | INTEGER PK AUTO | |
| `tmdb_id` | STRING(100) | |
| `name` | STRING(100) | |
| `original_name` | STRING(200) | |
| `birthday` | DATEONLY | |
| `deathday` | DATEONLY | Nullable |
| `gender` | INTEGER | TMDB gender codes |
@@ -277,6 +304,12 @@ External ID storage (1:1 with Entry).
| `tmdb_id` | STRING(30) |
| `imdb_id` | STRING(30) |
| `tvdb_id` | STRING(30) |
| `wikidata_id` | STRING(30) |
| `facebook_id` | STRING(100) |
| `instagram_id` | STRING(100) |
| `twitter_id` | STRING(100) |
All filled from TMDB `external_ids` (TV series only have their IMDb id there).
**No timestamps.**
@@ -294,6 +327,7 @@ Multi-source ratings (1:1 with Entry).
| `entry_id` | INTEGER FK → Entry |
| `user_rating` | FLOAT |
| `tmdb_rating` | FLOAT |
| `tmdb_vote_count` | INTEGER |
| `imdb_rating` | FLOAT |
| `rotten_tomatoes_rating` | FLOAT |
@@ -324,7 +358,7 @@ Join table: Entry ↔ Network. Composite PK: `(network_id, entry_id)`. Has `orde
| Field | Type | Notes |
|---|---|---|
| `id` | INTEGER PK | TMDB genre ID (not auto-increment) |
| `name` | STRING(30) | |
| `name` | STRING(100) | |
**No timestamps.** Seeded with 27 TMDB genres on startup.
@@ -337,13 +371,15 @@ Join table: Entry ↔ Network. Composite PK: `(network_id, entry_id)`. Has `orde
| Field | Type |
|---|---|
| `id` | INTEGER PK (TMDB ID) |
| `name` | STRING(30) |
| `name` | STRING(100) |
| `originCountry` | STRING(100) |
| `homepage` | STRING(100) |
| `logoPath` | STRING(200) |
| `posterPath` | STRING(200) |
| `backdropPath` | STRING(200) |
`originCountry` and `logoPath` are filled from TMDB's `origin_country` / `logo_path` and refreshed with the entry.
**No timestamps.**
---
+36 -27
View File
@@ -30,6 +30,10 @@ Charts: `WatchActivityChart`, `WatchTimeChart`, `CouchDayChart`, `LibraryGrowthC
Entry grid showing all non-watchlist, non-hidden entries from [[Stores|library store]]. See [[Library]].
- Type tabs: **All / Movies / TV**
- **Favorites** and **Hidden** are independent toggle buttons that combine with the type tab (e.g. TV + Favorites = favorite shows). Hidden mode shows only hidden entries (watchlist included).
- Filter state lives in `useLibraryFiltersStore` (`favoritesOnly`, `hiddenOnly`)
## DiscoverPage
TMDB browse by category: popular, trending, top-rated, upcoming. Uses `useTmdb` infinite queries.
@@ -69,16 +73,17 @@ Monthly [[Calendar]] view showing upcoming episode air dates. Uses `episodesApi.
## EntryDetailsPage
The main entry detail view. Width constrained to `max-w-4xl`.
One page for both cases (`pages/EntryDetailsPage.tsx`):
Sections:
- `/entry/:id` — a library entry, loaded from the local DB
- `/entry/tmdb/:type/:tmdbId` — not in the library; renders the TMDB preview (`GET /entries/tmdb/preview/:type/:tmdbId` returns an `entry` object in the same shape as a library entry). Library-only actions are hidden and **Add to Library** replaces them. If the title is already in the library, the page redirects to `/entry/:id`.
- Backdrop + poster + title + metadata
- Actions: watchlist, favorite, refresh, settings, rating
- Watch history (movies) → [[Watch Tracking]]
- Seasons list (TV) → links to SeasonPage
- Cast list → links to PersonDetailsPage; shows episode count for TV; "All Cast & Crew" link → EntryCastsPage
- Media gallery → [[Media System]]
Layout (`max-w-6xl`):
- **Hero** — full-bleed backdrop fading into the page, large poster (click → full-size popup), type/certification/status chips, title (selectable), tagline, year · runtime/seasons · "Created by" (TV) · "Directed by"
- **Action bar** — Watch (streaming), Trailer (in-app player from stored TMDB videos, YouTube search fallback), mark watched, rate, favorite, add to collection, ⋯ menu (watch history / status, hide, refresh, manage media, settings, delete)
- **Main column** — Overview, Keywords, Cast ([[Components#Entry Components|CastList]]), Seasons ([[Components#Entry Components|SeasonsContainer]] with list/cards toggle), In Collections, More like this (live TMDB recommendations), [[Artwork]]
- **Sidebar** — IMDb / TMDB (+ vote count) / your rating tiles, Details card (release, runtime, episodes, last aired, next episode, network logos, type, language, budget, box office, studio, country, watched), external links (TMDB, IMDb, website, Wikidata, Instagram, X, Facebook), **Where to watch** card (per-country providers, defaults to the browser's region)
## EntryCastsPage
@@ -95,26 +100,22 @@ Full cast & crew grid for an entry. Route: `/entry/:id/cast`. Width: `max-w-4xl`
## SeasonPage
Season detail with episode list. Width: `max-w-4xl`.
Season detail (`max-w-6xl`), same visual language as the entry page.
- Breadcrumb: `Title / Season x` (see [[Navigation]])
- Episode progress bar
- **Mark Season Watched** button (always visible) → opens [[Components#Dialogs|MarkSeasonWatchedDialog]]
- **Single Date mode**: marks all unwatched episodes on one date
- **Scatter Mode**: distributes episodes evenly across a date range (start → end)
- Episode list with watch status
- Links to EpisodePage
- **Hero** — show backdrop, season poster, "← Back to {show}" button, show and season chips, "Completed" badge, year · episodes · total runtime · air-date range
- Rating chip (opens SeasonRatingDialog), TMDB rating, progress bar
- **Start / Continue: E#** — plays the first aired, unwatched episode
- Mark season watched → [[Components#Dialogs|MarkSeasonWatchedDialog]] (single date or scatter mode), rate, ⋯ (refresh season)
- **Episodes** with a **List / Cards** toggle (remembered per browser): stills (click to play), air date, runtime, TMDB rating, seen dates, finale / mid-season / upcoming badges, mark-watched button
## EpisodePage
Episode detail with watch history. Width: `max-w-4xl`.
Episode detail (`max-w-6xl`).
- Breadcrumb: `Title / Season x / Episode x` (see [[Navigation]])
- Episode thumbnail (TMDB still)
- `S##E##` display using `season.season_number` (not DB id)
- Prev/next episode navigation
- Watch history management
- Cast list
- **Hero** — episode still as backdrop, show / season chips, `S##E##`, finale / upcoming / watched badges, title, air date · runtime · TMDB rating + votes
- Actions: **Watch episode**, **Mark as watched / Watch again**, previous / next episode
- Main column: overview with "Directed by" / "Written by" (stored episode crew), Guest Stars (stored, linked by TMDB id), watch history (edit / delete), previous / next cards
- Sidebar: details card (aired, runtime, TMDB, production code, watched) and the season's episode list with the current one highlighted
## PeoplePage
@@ -122,15 +123,23 @@ Browse and search people (actors, directors). Both local DB and TMDB search.
## PersonDetailsPage
Person profile with biography, filmography. Uses lazy-fetch via [[Services#PeopleManager]].
One page for both cases (`pages/PersonDetailsPage.tsx`):
## PersonTmdbRedirectPage
- `/people/:id` — person in the local DB (favorite toggle; filmography from TMDB via the local id)
- `/people/tmdb/:tmdbId` — not in the DB; everything from the TMDB preview, with **Add to Library**. If TMDB reports a local id, redirects to `/people/:id`.
Takes a TMDB person ID, fetches/creates the local person record, redirects to `PersonDetailsPage`.
Both render one header (photo, name, department, born / died with age tooltip, place of birth, TMDB link, biography) and one filmography split into **In your library** and **Not in library**.
## HistoryPage
Watch history at `/history`. See [[History]].
- Year picker (only years with watches) and All / Movies / TV filter; tab, year and filter live in the URL (`?tab=&year=&type=`)
- Tabs: **History** (by month and day), **Timeline** (latest → January, month dividers, stacked binge sessions), **Year in Review** (wrapped-style stats)
## SettingsPage
App configuration + maintenance. See [[Settings Page]].
- General settings (TMDB API key, backend port)
- Cleanup section (orphan files, orphan media records)
- Maintenance: **TMDB Refresh** (stale entries job), media cleanup, watch statuses, duplicate credits, missing directors, impossible seen dates
+7 -1
View File
@@ -24,17 +24,23 @@ Every page uses `React.lazy()` with a custom `<Suspense>` skeleton fallback.
| `/library` | `LibraryPage` | `LibrarySkeleton` | [[Library]] grid/list |
| `/discover/:category` | `DiscoverPage` | `HomeSkeleton` | TMDB browse (popular, trending, top-rated, upcoming) |
| `/watchlist` | `WatchlistPage` | `WatchlistSkeleton` | Watchlist entries |
| `/history` | `HistoryPage` | `WatchlistSkeleton` | [[History]] — list, timeline, year in review |
| `/collections` | `CollectionsPage` | `CollectionsSkeleton` | [[Collections]] overview |
| `/collections/:id` | `CollectionDetailsPage` | `CollectionDetailsSkeleton` | Collection with entries |
| `/media` | `MediaPage` | `MediaSkeleton` | Media management |
| `/discovery-videos` | `DiscoveryVideosPage` | `DiscoveryVideosSkeleton` | Personal video vault — see [[Discovery Videos]] |
| `/calendar` | `CalendarPage` | `CalendarSkeleton` | [[Calendar]] upcoming episodes |
| `/entry/tmdb/:type/:tmdbId` | `EntryDetailsPage` | `EntryDetailsSkeleton` | Entry not in the library (TMDB preview, same page) |
| `/entry/tmdb/:type/:tmdbId/cast` | `TmdbCastsPage` | `PeopleSkeleton` | Full cast of a TMDB-only entry |
| `/entry/:id` | `EntryDetailsPage` | `EntryDetailsSkeleton` | Entry details, seasons, cast |
| `/entry/:id/cast` | `EntryCastsPage` | `EntryDetailsSkeleton` | Full cast & crew |
| `/entry/:entryId/season/:seasonId` | `SeasonPage` | `SeasonSkeleton` | Season episodes |
| `/entry/:entryId/season/:seasonId/episode/:episodeId` | `EpisodePage` | `EpisodeSkeleton` | Episode details |
| `/people` | `PeoplePage` | `PeopleSkeleton` | [[People]] browse |
| `/people/:id` | `PersonDetailsPage` | `PersonDetailsSkeleton` | Person profile + filmography |
| `/people/tmdb/:tmdbId` | `PersonTmdbRedirectPage` | `PersonDetailsSkeleton` | TMDB person → local redirect |
| `/people/tmdb/:tmdbId` | `PersonDetailsPage` | `PersonDetailsSkeleton` | Person not in the DB (TMDB data, same page) |
| `/watch-buddies` | `WatchBuddiesPage` | `PeopleSkeleton` | Watch buddies |
| `/watch-buddies/:id` | `WatchBuddyProfilePage` | `PeopleSkeleton` | Buddy profile |
| `/settings` | `SettingsPage` | `SettingsSkeleton` | [[Settings Page]] |
## Layout
+26 -6
View File
@@ -172,9 +172,9 @@ CRUD for [[Collections]]. Handles `UserCollectionEntry` join records.
See [[TMDB Integration]].
14 methods wrapping TMDB API v3 calls:
Every request goes through `tmdbGet(path, params)` — a rate-limited queue (20 req/s, 8 concurrent) with retries on 429 / 5xx / network errors. The API key is never logged.
`fetchEntryData`, `fetchSeasonData`, `fetchEntryMedia`, `fetchCollectionData`, `fetchEntryCredits`, `fetchPersonDetails`, `fetchPersonCombinedCredits`, `fetchTrending`, `fetchPopular`, `fetchTopRated`, `fetchUpcoming`, `searchMulti`, `searchPeople`, `fetchPopularPeople`
Methods: `fetchEntryData` (details + appended blocks), `fetchSeasonData`, `fetchEntryMedia`, `fetchEntryRecommendations`, `fetchCollectionData`, `fetchEntryCredits`, `fetchPersonDetails`, `fetchPersonCombinedCredits`, `fetchTrending`, `fetchPopular`, `fetchTopRated`, `fetchUpcoming`, `searchMulti`, `searchPeople`, `fetchPopularPeople`
### configService
@@ -218,11 +218,31 @@ See [[Import System]].
> [!info] File: `backend/services/maintenanceService.js`
See [[Settings Page#Cleanup]].
See [[Settings Page]].
- `deleteOrphanFiles(dry)` — Files on disk without DB records
- `deleteOrphanMediaRecords(dry)` — DB records without files on disk
- Both return `{ posters, logos, backdrops, stills }` counts
- `deleteOrphanFiles(dry)` / `deleteOrphanMediaRecords(dry)` — return `{ posters, logos, backdrops, stills }` counts
- `deleteOrphanPeople`, `fixMissingDirectors`, `cleanDuplicateCredits`, `autoFixWatchStatuses`, `fixImpossibleSeenDates`
- `getStaleEntries(hours)` — entries never fetched or fetched more than `hours` ago (auto sync on)
- `startStaleRefresh(hours)` / `getStaleRefreshStatus()` / `cancelStaleRefresh()` — background job that refreshes stale entries one at a time via `entryManager.refrechEntryById`
### artworkService
> [!info] File: `backend/services/artworkService.js`
See [[Artwork]].
- `getEntryArtwork(entryId)` — TMDB images merged with the entry's media rows (`in_library`, `media_id`, `is_selected`)
- `getTmdbArtwork(type, tmdbId)` — TMDB images only
- `addEntryArtwork(entryId, { type, file_path })` — downloads the original into the media table (deduplicated by `tmdbPath`; selected if none of that type is)
### historyService
> [!info] File: `backend/services/historyService.js`
See [[History]].
- `getYears()` — years with watches and their movie/episode counts
- `getYear(year)` — every watch in a year with entries listed once
### logService
+10 -1
View File
@@ -10,7 +10,7 @@ tags:
## Overview
App configuration and maintenance tools at `/settings`. Contains two card sections.
App configuration and maintenance tools at `/settings`, in two tabs: **General** and **Maintenance**.
## General Settings
@@ -23,6 +23,15 @@ Form using react-hook-form + zod validation.
Saved via `PUT /api/v1/settings`.
## TMDB Refresh
First card on the Maintenance tab. Refreshes entries whose `last_fetch` is older than N hours (default 24) — details, ids, ratings, genres, networks, seasons, episodes and credits.
- Shows how many entries are due; **Refresh stale entries** starts a background job, **Cancel** stops it
- Live progress (polled every 2s while running): done/total, ok, failed, current title; failures listed when finished
- Rate limited, so a large library takes a while; entries with auto sync off are skipped
- Endpoints: [[API Reference#Stale Entries Refresh]]
## Cleanup
Maintenance tools for cleaning up orphaned data. Uses backend maintenance endpoints.
+1 -1
View File
@@ -65,7 +65,7 @@ useStreamingStore (Zustand)
## Data Flow
1. User clicks "Watch Now" / "Continue Watching" on [[Entry Details Page|EntryDetailsPage]]
1. User clicks "Watch Now" / "Continue Watching" on [[Pages#EntryDetailsPage|EntryDetailsPage]]
2. `StreamingSection` determines the request (movie or TV + season/episode)
3. `useStreamingStore.play()` builds a URL via the active server's provider adapter
4. `StreamingPlayer` renders an iframe with the embed URL
+65 -39
View File
@@ -10,33 +10,47 @@ tags:
## Overview
Showy uses **TMDB API v3** as its primary source for movie and TV metadata. All TMDB calls are proxied through the backend — the frontend never contacts TMDB directly.
Showy uses **TMDB API v3** as its source for movie, TV and people metadata. All TMDB calls go through the backend — the frontend never talks to TMDB directly, so the API key stays server-side.
## Configuration
- API base URL: `https://api.themoviedb.org/3`
- API key stored in `settings.json` → `tmdbApiKey`
- Managed by `configService`
- API base URL: `settings.json` → `tmdbApiUrl` (e.g. `https://api.themoviedb.org/3/`)
- API key: `settings.json` → `tmdbApiKey`
- Read by `configService`
## Rate Limiting
> [!info] File: `backend/services/tmdbService.js` → `tmdbGet(path, params)`
Every TMDB request goes through one queue so bulk jobs (like the [[API Reference#Stale Entries Refresh|stale entries refresh]]) never get the IP blocked:
- **20 requests per second**, **8 in flight** at once (TMDB allows ~50/s)
- **429** → waits for `Retry-After`, then retries; **5xx / network errors** → exponential backoff
- Up to 4 attempts per request
- Requests are logged as `TMDB GET <path>?<params>` **without** the API key
Measured: 45 requests went out at 20 / 20 / 5 per second, all succeeded.
The legacy [[Import System]] keeps its own extra throttle (35 requests per 10 s) on top.
## tmdbService
> [!info] File: `backend/services/tmdbService.js`
### Entry Data
| Method | TMDB Endpoint | Returns |
| Method | TMDB Endpoint | Notes |
|---|---|---|
| `fetchEntryData(tmdbId, isTV)` | `/movie/{id}` or `/tv/{id}` | Full entry metadata |
| `fetchSeasonData(tmdbId, seasonNum)` | `/tv/{id}/season/{num}` | Season with episodes |
| `fetchEntryMedia(tmdbId, isTV)` | `/movie/{id}/images` or `/tv/{id}/images` | Posters, backdrops, logos |
| `fetchEntryCredits(tmdbId, isTV)` | `/movie/{id}/credits` or `/tv/{id}/credits` | Cast and crew |
| `fetchCollectionData(collectionId)` | `/collection/{id}` | Collection with parts |
| `fetchEntryData(tmdbId, isTV)` | `/movie/{id}` or `/tv/{id}` | Appends `external_ids`, `release_dates` (movie) / `content_ratings` (TV), `keywords`, `videos`, `watch/providers`, `alternative_titles` in the same request |
| `fetchSeasonData(tmdbId, seasonNum)` | `/tv/{id}/season/{num}` | Appends `external_ids`; episodes include `crew` and `guest_stars` |
| `fetchEntryMedia(tmdbId, isTV)` | `/{type}/{id}/images` | All languages (no `language` param) |
| `fetchEntryCredits(tmdbId, isTV)` | `/movie/{id}/credits` or `/tv/{id}/aggregate_credits` | |
| `fetchEntryRecommendations(tmdbId, isTV, page)` | `/{type}/{id}/recommendations` | Live, never stored |
| `fetchCollectionData(collectionId)` | `/collection/{id}` | |
### Person Data
| Method | TMDB Endpoint |
|---|---|
| `fetchPersonDetails(tmdbId)` | `/person/{id}` |
| `fetchPersonDetails(tmdbId)` | `/person/{id}` (+ `external_ids`) |
| `fetchPersonCombinedCredits(tmdbId)` | `/person/{id}/combined_credits` |
### Browse & Search
@@ -51,41 +65,53 @@ Showy uses **TMDB API v3** as its primary source for movie and TV metadata. All
| `searchPeople(query)` | `/search/person` |
| `fetchPopularPeople()` | `/person/popular` |
## Frontend TMDB Proxy
All methods return `null` on failure (after retries) and log the error.
The frontend accesses TMDB data through backend proxy endpoints (see [[API Reference#TMDB Proxy]]):
## Entry Mapper
> [!info] File: `backend/mappers/entryMapper.js`
One place that turns TMDB responses into column values. Used by entry creation (`entryService.createEntry`), the refresh (`entryManager.refrechEntryById`), the season refresh (`seasonController.refreshSeason`), the legacy importer (`models-services/entryService.saveEntry`) and the TMDB preview endpoint.
| Function | Fills |
|---|---|
| `mapEntryFields(data)` | Entry columns — title, dates, runtime (TV falls back to `episode_run_time` then the last episode's runtime), certification (US → GB → origin country; theatrical first for movies), network/studio, budget/revenue, languages, countries, companies, homepage, keywords, trimmed videos and watch providers, alternative titles, TV type/creators/season & episode counts/last air date/next & last episode |
| `mapEntryIds(data)` | IMDb (from `external_ids` for TV), TVDB, Wikidata, Facebook, Instagram, X |
| `mapEntryRatings(data)` | `tmdb_rating`, `tmdb_vote_count` |
| `mapSeasonFields(seasonData)` | Season columns incl. `tvdb_id` |
| `mapEpisodeFields(episode)` | Episode columns incl. vote count, production code, directors/writers, guest stars |
See [[Models#Entry]] for every stored field.
## Refresh
`PUT /entries/:id/refresh` (and the stale job) re-fetches and updates:
- Entry, ids and ratings via the mapper
- Genres and networks — **synced both ways** (added and removed); network name, country and logo refreshed
- Seasons and episodes (matched by TMDB id)
- Credits and people
### Stale Entries Refresh
`POST /maintenance/stale-entries/refresh?hours=24` refreshes, one at a time, every entry whose `last_fetch` is older than `hours` (or never set), skipping entries with auto sync off. Progress is available from `GET /maintenance/stale-entries`; the UI is the TMDB Refresh card in [[Settings Page#TMDB Refresh]].
## Frontend TMDB Proxy
```
Frontend → /api/v1/entries/tmdb/trending/movie → Backend → TMDB API → Response
```
This keeps the API key server-side.
See [[API Reference#TMDB Proxy]]. The preview endpoint (`/entries/tmdb/preview/:type/:tmdbId`) returns an `entry` object in the same shape as a library entry, so [[Pages#EntryDetailsPage|EntryDetailsPage]] renders titles that aren't in the library.
## Image URLs
TMDB image base URL: `https://image.tmdb.org/t/p/`
Common sizes used:
- Posters: `w185`, `w342`, `w500`
- Backdrops: `w780`, `w1280`, `original`
- Stills: `w300`, `w780`, `original`
- Profiles: `w185`, `w300`
- Logos / providers: `w92`, `w500`
- Posters: `w342`, `w500`, `w780`
- Backdrops: `w780`, `w1280`
- Stills: `w300`, `w1280`
- Profiles: `w185`
See [[Media Utilities]] for frontend URL resolution and [[Media System]] for local image caching.
## Lazy Refresh Pattern
Used by [[Services#EntryManager]] and [[Services#PeopleManager]]:
1. Check `last_fetch` or `fully_fetched` field
2. If stale (>24h) or never fetched → call TMDB
3. Update local data + set `last_fetch` to today
4. TV series with `status = "Ended"` skip refresh
## Rate Limiting
The [[Import System]] self-throttles to stay under TMDB limits:
- Max 35 requests per 10 seconds
- 500ms delay between individual requests
See [[Media Utilities]] for frontend URL resolution, [[Media System]] for local caching and [[Artwork]] for browsing and adding TMDB images.