Build Movie Details
10 min read
Load the Movie Detail Data
Load the Movie Detail Data
Expand the TMDB client so the detail page receives everything it needs in one application-shaped object.
Step 1 — Request the movie with credits
In lib/tmdb.ts, add getMovieDetail and ask TMDB for the movie endpoint with append_to_response=credits.
const data = await tmdbFetch(`/movie/${id}`, { append_to_response: "credits" });
Step 2 — Identify the director
Search the returned crew for the person whose job is Director.
const director = (data.credits?.crew || []).find((c: any) => c.job === "Director");
Step 3 — Extend the summary
Build the detail object by spreading the existing summary transformation and then adding the detail-specific fields.
return {
...toSummary(data),
tagline: data.tagline || "",
overview: data.overview || "No synopsis available.",
Continue with runtime, director, genres, backdrop URL, and release date using the same image helpers and defensive fallbacks from the final application.
Checkpoint
The detail request now returns a MovieDetail object with both card-level information and the additional information required by the detail page.