Skip to content

Commit f26e76f

Browse files
committed
Update README and vitest configuration for YouTube app
- Enhanced the README to provide clearer descriptions of the channel dashboard, video scoring, and AI features, improving user understanding of the app's capabilities. - Updated the vitest configuration to adjust coverage thresholds for statements, branches, functions, and lines, ensuring more accurate test coverage reporting. Made-with: Cursor
1 parent 4279f04 commit f26e76f

4 files changed

Lines changed: 442 additions & 261 deletions

File tree

apps/imdb-best-season/README.md

Lines changed: 70 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,63 @@ A web application that ranks TV show seasons based on their episode ratings. Sea
44

55
## Features
66

7-
- Search for any TV series with autocomplete suggestions
8-
- Seasons ranked by median episode rating (combining IMDb and TMDB scores when available)
9-
- Episode-by-episode breakdown with IMDb links and dual-source ratings
10-
- Best season highlighted in the results table
11-
- Dark/light theme with system preference detection
12-
- Fully responsive layout
7+
- **Search with autocomplete** -- type a show name and get instant suggestions from OMDb. The home page includes quick-access links to popular shows (Breaking Bad, The Wire, The Office) to get started immediately.
8+
9+
- **Season ranking** -- every season is ranked by its median episode rating. When TMDB data is available, each episode's rating is the average of its IMDb and TMDB scores, combining two independent audiences. The median (rather than mean) is used so a single bad episode doesn't tank an otherwise great season.
10+
11+
- **Episode-by-episode breakdown** -- click any season to open a dialog showing every episode with its title, IMDb link, and ratings from both sources. Episodes missing a TMDB score display a tooltip explaining the fallback to IMDb-only data.
12+
13+
- **Best season highlight** -- the top-ranked season is visually highlighted in the table so it's immediately obvious which season comes out on top.
14+
15+
- **Show metadata** -- alongside the rankings, the app displays the show's poster, title, plot summary, total season count, and aggregate ratings from IMDb, Rotten Tomatoes, and TMDB (when available).
16+
17+
- **Dark/light theme** -- toggle between themes with system preference detection.
18+
19+
- **Responsive layout** -- works on desktop, tablet, and mobile.
1320

1421
### How Ranking Works
1522

16-
Each season's score is the **median** of its episode ratings. When TMDB data is available, episode ratings are averaged across both sources for more robust results. The median (rather than mean) reduces the impact of outlier episodes on a season's ranking.
23+
Each season's score is the **median** of its episode ratings:
24+
25+
1. Fetch all episode ratings from OMDb (IMDb scores)
26+
2. If TMDB is configured, fetch per-episode ratings from TMDB as well
27+
3. For each episode, compute the average across available sources
28+
4. Take the median of all episode averages within each season
29+
5. Rank seasons from highest to lowest median
30+
31+
The median was chosen over the mean because TV seasons often have one or two outlier episodes (a weak finale, a bottle episode) that would disproportionately drag down an otherwise strong season. The median gives a more representative picture of the typical episode quality.
1732

1833
### Data Sources
1934

20-
- **OMDb API** (required) -- primary source for show metadata, season info, and IMDb episode ratings
21-
- **TMDB API** (optional) -- when configured, adds per-episode ratings as a second data point, improving accuracy
35+
**OMDb API** (required) -- the primary source. Provides show metadata (title, year, poster, plot, ratings), season structure, and per-episode IMDb ratings. Free tier allows 1,000 requests/day.
36+
37+
**TMDB API** (optional) -- when a TMDB API key is configured, the app searches for the show on TMDB, fetches per-episode ratings from their community, and averages them with IMDb scores. This dual-source approach smooths out biases inherent in any single rating platform.
2238

23-
Both sources are cached in-memory (24h TTL, up to 1000 entries) and rate-limited (30 req/min for search, 60 req/min for suggestions).
39+
Both sources are cached in-memory with a 24-hour TTL and a max of 1,000 entries. Search and suggestion endpoints are rate-limited (30 req/min for search, 60 req/min for suggestions) using the shared rate limiter from `@data-projects/shared`.
2440

2541
## Tech Stack
2642

2743
| Layer | Technology |
2844
|-------|-----------|
29-
| Framework | Next.js 16 (App Router) |
45+
| Framework | Next.js 16 (App Router, Turbopack) |
3046
| Language | TypeScript 5 |
31-
| UI | shadcn/ui, Radix UI |
32-
| Styling | Tailwind CSS |
33-
| Data Fetching | TanStack Query |
34-
| Tables | TanStack Table |
35-
| Theme | next-themes |
36-
| Testing | Playwright (E2E) |
47+
| UI | shadcn/ui, Radix UI (Dialog, Tooltip) |
48+
| Styling | Tailwind CSS with gold accent theme |
49+
| Data Fetching | TanStack Query v5 |
50+
| Tables | TanStack Table v8 (sorting, pagination) |
51+
| Theme | next-themes (dark/light + system detection) |
52+
| Testing | Playwright (E2E tests) |
3753
| Analytics | PostHog |
38-
| Fonts | Libre Baskerville, JetBrains Mono |
54+
| Fonts | Libre Baskerville (serif headings), JetBrains Mono (data) |
55+
56+
## API Routes
57+
58+
| Method | Endpoint | Description |
59+
|--------|----------|-------------|
60+
| GET | `/api/search/[title]` | Search for a show, fetch all seasons and episodes, compute rankings. Combines OMDb + TMDB data. Cached 24h, rate-limited 30 req/min |
61+
| GET | `/api/suggest/[query]` | Autocomplete suggestions from OMDb series search. Cached 1h, rate-limited 60 req/min |
62+
63+
Both routes include CORS headers and input validation (title sanitization, length limits, allowed characters).
3964

4065
## Getting Started
4166

@@ -56,73 +81,69 @@ NEXT_PUBLIC_POSTHOG_KEY=your_posthog_key # optional, analytics
5681

5782
| Variable | Required | Description |
5883
|----------|----------|-------------|
59-
| `OMDB_API_KEY` | Yes | Get a free key at [omdbapi.com](https://www.omdbapi.com/apikey.aspx) (1,000 req/day) |
60-
| `TMDB_API_KEY` | No | Get a key at [themoviedb.org](https://www.themoviedb.org/settings/api). Adds a second rating source |
61-
| `NEXT_PUBLIC_POSTHOG_KEY` | No | PostHog project key (client-side, write-only) |
84+
| `OMDB_API_KEY` | Yes | Get a free key at [omdbapi.com](https://www.omdbapi.com/apikey.aspx). Free tier: 1,000 req/day |
85+
| `TMDB_API_KEY` | No | Get a key at [themoviedb.org](https://www.themoviedb.org/settings/api). When set, adds a second rating source for more robust rankings |
86+
| `NEXT_PUBLIC_POSTHOG_KEY` | No | PostHog project API key (client-side, write-only -- safe to expose) |
6287

6388
### Installation
6489

6590
From the monorepo root:
6691

6792
```bash
6893
pnpm install
69-
pnpm dev --filter imdb-best-season
70-
```
71-
72-
Or from this directory:
73-
74-
```bash
75-
pnpm dev # starts on port 3001
94+
pnpm dev --filter imdb-best-season # starts on port 3001
7695
```
7796

7897
### Running Tests
7998

99+
Playwright E2E tests cover the home page, search flow, theme toggling, show results, and accessibility:
100+
80101
```bash
81-
pnpm test # run Playwright E2E tests (headless)
102+
pnpm test # run all E2E tests (headless Chromium)
82103
pnpm test:headed # run tests with browser visible
83-
pnpm test:ui # open Playwright UI mode
84-
pnpm test:debug # run tests with Playwright inspector
85-
pnpm test:report # view test report
104+
pnpm test:ui # open Playwright's interactive UI mode
105+
pnpm test:debug # run tests with the Playwright inspector attached
106+
pnpm test:report # open the HTML test report
86107
```
87108

88109
## Project Structure
89110

90111
```
91112
src/
92113
├── app/
93-
│ ├── page.tsx # Home (search, suggestion links, theme toggle)
94-
│ ├── layout.tsx # Root layout (fonts, providers, metadata)
95-
│ ├── [title]/page.tsx # Show results (header, info, seasons table)
96-
│ ├── not-found.tsx # 404 page
97-
│ ├── globals.css # Global styles (gold accent, gradient bg)
114+
│ ├── page.tsx # Home (search input, suggestion links, theme toggle)
115+
│ ├── layout.tsx # Root layout (Libre Baskerville + JetBrains Mono, providers)
116+
│ ├── [title]/page.tsx # Show results (ShowInfo, SeasonsTable, loading/error states)
117+
│ ├── not-found.tsx # 404 page with navigation back to search
118+
│ ├── globals.css # Gold accent, gradient background, custom scrollbar
98119
│ └── api/
99120
│ ├── search/[title]/ # Show search + season ranking (OMDb + TMDB)
100121
│ └── suggest/[query]/ # Autocomplete suggestions (OMDb)
101122
├── components/
102-
│ ├── show-header.tsx # Navbar with logo, search, theme toggle
103-
│ ├── show-info.tsx # Poster, title, plot, multi-source ratings
123+
│ ├── show-header.tsx # Navbar with logo, search autocomplete, theme toggle
124+
│ ├── show-info.tsx # Show poster, title, plot, IMDb/RT/TMDB ratings
104125
│ ├── seasons-table.tsx # Ranked seasons table (best season highlighted)
105-
│ ├── episode-dialog.tsx # Episode list dialog with dual ratings
106-
│ ├── search-title.tsx # Search autocomplete
107-
│ └── loading-skeleton.tsx # Loading states
126+
│ ├── episode-dialog.tsx # Episode list dialog (IMDb + TMDB ratings, N/A tooltips)
127+
│ ├── search-title.tsx # Search autocomplete powered by OMDb suggestions
128+
│ └── loading-skeleton.tsx # Loading states (home skeleton, results skeleton)
108129
├── services/
109130
│ └── show.ts # API client (fetchShowSearch, fetchShowSuggestions)
110131
├── hooks/
111132
│ ├── use-show-search.ts # TanStack Query hook for show data
112-
│ └── use-show-suggestions.ts # Autocomplete suggestions hook
133+
│ └── use-show-suggestions.ts # Autocomplete suggestions hook (via createSuggestionsHook)
113134
├── lib/
114-
│ ├── cache.ts # In-memory cache (24h TTL, 1000 entries)
115-
│ ├── validation.ts # Title sanitization and validation
116-
│ └── rate-limit.ts # Rate limiting config
135+
│ ├── cache.ts # In-memory LRU cache (24h TTL, 1000 entries)
136+
│ ├── validation.ts # Title sanitization (max 200 chars, allowed characters)
137+
│ └── rate-limit.ts # Rate limiting config (search: 30/min, suggest: 60/min)
117138
├── types/
118-
│ └── omdb.ts # OMDb/TMDB type definitions
139+
│ └── omdb.ts # OMDb/TMDB type definitions (Show, RankedSeason, EpisodeRating, etc.)
119140
└── e2e/
120-
└── home.spec.ts # Playwright E2E tests
141+
└── home.spec.ts # Playwright E2E tests (search, navigation, theme, a11y)
121142
```
122143

123144
## Deployment
124145

125-
Configured for Vercel with `npx turbo-ignore` for smart builds. API routes include CORS headers for cross-origin access.
146+
Configured for Vercel with `npx turbo-ignore` for smart builds -- only rebuilds when files in this app or its shared dependencies change. API routes include CORS headers (`Access-Control-Allow-Origin: *`) and `X-Content-Type-Options: nosniff`.
126147

127148
## License
128149

0 commit comments

Comments
 (0)