Overview
Connect World leverages The Movie Database (TMDB) API to provide a rich catalog of movies and TV series. The platform fetches trending content, now playing movies, and top-rated series with localized Spanish content.Trending Content
Discover what’s popular daily and weekly
Now Playing
Current movies in theaters
Top Rated
Highest rated TV series
TMDB Service
The TMDB integration is centralized in thetmdbService.ts file, providing a clean API for content fetching.
Configuration
src/infrastructure/external/tmdbService.ts:3-27
The service is configured with
language: "es-ES" to provide Spanish-localized content including titles, descriptions, and metadata.Data Models
TMDB Movie Interface
src/infrastructure/external/tmdbService.ts:6-18
Field Descriptions
Field Descriptions
- id: Unique TMDB identifier
- title: Movie title (for movies)
- name: Series name (for TV shows)
- poster_path: Poster image path (can be null)
- backdrop_path: Backdrop/banner image path (can be null)
- overview: Content description/synopsis
- vote_average: Rating score (0-10)
- release_date: Movie release date
- first_air_date: TV series first air date
- genre_ids: Array of genre identifiers
- media_type: Content type (movie/tv)
TMDB Response Interface
src/infrastructure/external/tmdbService.ts:20-22
Content Fetching Functions
- Trending Content
- Now Playing Movies
- Top Rated Series
Get Trending Content
Fetch trending movies and TV shows for a specified time window:src/infrastructure/external/tmdbService.ts:29-32Parameters:timeWindow: Either “day” or “week” (default: “week”)
- Top 10 trending items (movies and TV shows combined)
The function automatically limits results to 10 items for performance and UI consistency.
Image Handling
Poster URL Generation
Convert TMDB image paths to full URLs:src/infrastructure/external/tmdbService.ts:44-47
Parameters:
path: The poster_path or backdrop_path from TMDBsize: Image size (default: “w500”)
- Poster sizes:
w92,w154,w185,w342,w500,w780,original - Backdrop sizes:
w300,w780,w1280,original
Usage Example
Content Display Patterns
- Movie Title
- Release Date
- Rating Display
title and TV shows use name, always check both fields.Environment Configuration
Get your TMDB API key by creating a free account at https://www.themoviedb.org/ and requesting an API key from your account settings.
API Endpoints Used
Trending
GET /trending/all/{time_window}Returns trending movies and TV showsNow Playing
GET /movie/now_playingReturns current theatrical releasesTop Rated TV
GET /tv/top_ratedReturns highest-rated TV seriesImages
GET https://image.tmdb.org/t/p/{size}{path}Returns poster and backdrop imagesBest Practices
- Always check for null images - Use the
getPosterUrlhelper to handle null paths - Handle both movies and TV shows - Check both
title/nameandrelease_date/first_air_date - Limit results - The service already limits to 5-10 items per request
- Use appropriate image sizes - Choose based on display context to optimize bandwidth
- Cache responses - Consider caching TMDB responses to reduce API calls
- Localization - The service is configured for Spanish (
es-ES) content - Error handling - Implement try-catch blocks when calling these functions
Content Categories
The TMDB service provides three main content categories:Content Strategy
Content Strategy
Trending (Weekly/Daily)
- Most popular content across movies and TV
- Updated regularly by TMDB’s algorithm
- Mix of new releases and popular classics
- Limited to 10 items for homepage display
- Current theatrical releases
- Updated as movies enter/leave theaters
- Relevant for time-sensitive promotions
- Limited to 10 items
- Highest user-rated series
- More stable than trending content
- Great for showcasing quality content
- Limited to 5 items for curated selection
