A modern web application to explore popular movies, search for detailed information, and discover new titles. CineDB utilizes The Movie Database (TMDB) API to provide a complete cinematic browsing experience with real-time updated data.
π Migration Completed: This project was successfully migrated from IMDB web scraping to TMDB API (January 2026).
- π Top 20 Popular Movies: View the most popular movies of the moment according to TMDB.
- π¬ Discovery Categories:
- Top Rated: Top movies with the highest rating on TMDB.
- Now Playing: Movies currently in theaters.
- Upcoming: Future releases.
- π Genre Filters: Discover movies by categories (Action, Comedy, Drama, Horror, Sci-Fi, Romance, Thriller).
- π Instant Search: Search for movies by title with real-time results.
- π Detailed Information: Access comprehensive info including:
- Synopsis and ratings (TMDB ratings).
- Director, writers, and full cast.
- Duration, release year, and genres.
- Integrated YouTube trailers.
- User vote count.
- Recommended movies based on the current title.
- Similar movies with a horizontal carousel.
- π± Responsive Design: Optimized for mobile, tablet, and desktop devices.
- π¨ Modern Interface:
- Dark design with amber/gold gradient accents.
- glassmorphism Navbar with backdrop-blur.
- Horizontal carousels with smooth scroll.
- Optimized skeleton loaders during loading.
- Elegant custom scrollbar.
- Sticky footer.
- Hover effects with smooth transitions.
- β‘ Optimized Performance: Built with Next.js 16 and Turbopack.
- π Content in Spanish: Data automatically translated by TMDB.
- Next.js 16.1.1 - React Framework with App Router.
- React 19.2.3 - UI Library.
- TypeScript 5.9.3 - Static typing for JavaScript.
- Tailwind CSS 4.1.18 - Utility-first CSS framework with custom gradients.
- Lucide React - Modern and accessible icons.
- Next.js API Routes - Server-side endpoints as a proxy.
- TMDB API (v3) - Official Movie Database API.
- Fetch API - Native HTTP requests (no external libraries).
- ESLint 9 - Code linting.
- pnpm 10.13.1 - Fast and efficient package manager.
- Turbopack - Next-generation bundler.
- Node.js 20+ installed (Download here)
- pnpm installed globally:
npm install -g pnpm
- TMDB Account (free) to obtain an API Key.
-
Create an account on TMDB (if you don't have one):
- Go to https://www.themoviedb.org/signup
- Complete the registration (avoid using a Gmail account if possible to prevent 403 errors).
-
Request API Access:
- Log in to TMDB.
- Go to your profile β Settings β API.
- Click on "Create" or "Request an API Key".
- Select "Developer" (non-commercial).
- Complete the basic form.
- Accept the terms of use.
-
Copy the Read Access Token (v4):
- Once approved, you will see two tokens.
- Important: Copy the "API Read Access Token (v4 auth)".
- This is a long Bearer token (starts with
eyJ...). - DO NOT use the "API Key (v3 auth)".
# 1. Clone the repository
git clone https://github.com/YeralAndre/cine-db.git
cd cine-db
# 2. Install dependencies
pnpm install
# 3. Create environment variables file
cp .env.example .env.localOpen the .env.local file and add your API Key:
# .env.local
TMDB_API_KEY=your_complete_bearer_token_here
β οΈ Important: NEVER share your API Key publicly or upload it to GitHub. The.env.localfile is already in.gitignore.
# Development mode
pnpm devOpen http://localhost:3000 in your browser.
- β Server-side API Key: The TMDB key is only used in API Routes (server-side).
- β No client exposure: Browser JavaScript never sees the API key.
- β Rate limiting: TMDB allows 1,000,000 requests/month on the free plan.
- β HTTPS: Vercel provides automatic SSL.
cine-db/
βββ src/
β βββ app/ # Next.js App Router
β β βββ page.tsx # Main page (Top movies + genre filters)
β β βββ layout.tsx # Main layout with Navbar and Footer
β β βββ globals.css # Global styles (gradients, scrollbar)
β β βββ api/ # API Routes (Server-side)
β β β βββ movies/ # Movie endpoints
β β β βββ top/ # GET /api/movies/top
β β β βββ top-rated/ # GET /api/movies/top-rated
β β β βββ now-playing/ # GET /api/movies/now-playing
β β β βββ upcoming/ # GET /api/movies/upcoming
β β β βββ search/ # GET /api/movies/search?q={query}
β β β βββ info/ # GET /api/movies/info?id={movieId}
β β β βββ discover/ # GET /api/movies/discover?with_genres={id}
β β β βββ recommendations/ # GET /api/movies/recommendations?id={movieId}
β β β βββ similar/ # GET /api/movies/similar?id={movieId}
β β βββ search/ # Search page
β β β βββ page.tsx # /search
β β βββ info/[id]/ # Details page
β β βββ page.tsx # /info/{id}
β βββ components/ # Reusable components
β β βββ Navbar.tsx # glassmorphism navigation bar
β β βββ Footer.tsx # Sticky footer
β β βββ TopCard.tsx # Popular movie card with hover effects
β β βββ MoviesCard.tsx # Compact card for carousels
β β βββ MoviesInfoSections.tsx # Horizontal carousel section
β β βββ GenreFilterCard.tsx # Genre filter chip
β β βββ Loading.tsx # Loading spinner
β βββ lib/ # Business logic
β β βββ api.ts # β TMDB API Client (core) with 9 endpoints
β β βββ fetchAPI.ts # Internal API Client
β βββ types/ # TypeScript Interfaces
β β βββ movies.d.ts # Movie, QueryMovie, InfoMovie
β β βββ images.d.ts # Types for importing images
β βββ assets/ # Static resources
β βββ placeholder.png # Placeholder image
β βββ logo.png # CineDB Logo
βββ public/ # Static public files
βββ .env.example # Env variables template
βββ package.json # Dependencies and scripts
βββ next.config.ts # Next.js configuration
βββ postcss.config.mjs # PostCSS configuration
βββ tsconfig.json # TypeScript configuration
# Development with Turbopack (hot reload)
pnpm dev
# Production build
pnpm build
# Run production build
pnpm start
# Code linting
pnpm lintThese endpoints are consumed by the frontend:
GET /api/movies/top
βββ Returns: Movie[]
βββ TMDB Top 20 popular movies
GET /api/movies/top-rated
βββ Returns: Movie[]
βββ Highest rated movies
GET /api/movies/now-playing
βββ Returns: Movie[]
βββ Movies currently in theaters
GET /api/movies/upcoming
βββ Returns: Movie[]
βββ Upcoming movie releases
GET /api/movies/discover?with_genres={genreId}&sort_by=popularity.desc&language=es-ES
βββ Returns: Movie[]
βββ Movies filtered by genre
βββ Example: /api/movies/discover?with_genres=28 (Action)
GET /api/movies/search?q={query}
βββ Returns: QueryMovie[]
βββ Search results by title
GET /api/movies/info?id={movieId}
βββ Returns: InfoMovie
βββ Full info: details + trailer + credits
GET /api/movies/recommendations?id={movieId}
βββ Returns: Movie[]
βββ Recommended movies based on TMDB algorithm
GET /api/movies/similar?id={movieId}
βββ Returns: Movie[]
βββ Similar movies by genre and keywords
The src/lib/api.ts file consumes these TMDB endpoints:
GET https://api.themoviedb.org/3/movie/popular
βββ Used by: topMovies()
GET https://api.themoviedb.org/3/movie/top_rated
βββ Used by: topRated()
GET https://api.themoviedb.org/3/movie/now_playing
βββ Used by: nowPlaying()
GET https://api.themoviedb.org/3/movie/upcoming
βββ Used by: upcoming()
GET https://api.themoviedb.org/3/discover/movie?with_genres={id}
βββ Used by: discoverMovies()
GET https://api.themoviedb.org/3/search/movie?query={q}
βββ Used by: searchMovies()
GET https://api.themoviedb.org/3/movie/{id}?append_to_response=videos,credits
βββ Used by: infoMovie()
GET https://api.themoviedb.org/3/movie/{id}/recommendations
βββ Used by: recommendedMovies()
GET https://api.themoviedb.org/3/movie/{id}/similar
βββ Used by: similarMovies()
- Main Background: Dark Gray (
gray-950,#030712) - Primary Accent: Amber/Gold Gradient (
#fbbf24β#d97706) - Text: White and Grays (
gray-100,gray-300,gray-400) - Cards: Medium Gray (
gray-800,gray-900) - Borders: Translucent grays with amber hover.
- Navbar: glassmorphism with
backdrop-blur-smandbg-gray-950/80.
- Main Font: Inter (Google Fonts).
- Adaptable sizes based on viewport.
- Weights: Light (300), Regular (400), Medium (500), Semibold (600), Bold (700), ExtraBold (800).
- Custom Gradients:
.text-gradient: Amber gradient text (for titles)..bg-gradient: Amber gradient background (for buttons/badges).
- Custom Scrollbar:
- 8px width,
gray-600color withgray-500hover. - Compatible with WebKit and Firefox.
- 8px width,
- Hover States:
- Cards with amber border and elevation.
- Genres with translucent amber background.
- Smooth transitions of 200-250ms.
- Loading States: Animated spinner with rotation.
- glassmorphism: Navbar with frosted glass effect.
- Mobile First: Optimized for small screens.
- Adaptable Grid: Changes at md, lg, xl breakpoints.
- Sticky Footer: Always at the bottom with
flex-1on main. - Horizontal Carousels: With smooth scroll and custom scrollbar.
interface Movie {
id?: string;
poster?: string;
top?: string; // Ranking position
title?: string;
year?: string;
rating?: string; // Average rating (0-10)
genres?: string[]; // Genre array
overview?: string; // Synopsis
adult?: boolean; // +18 Rating
}Usage: Popular, Discover, Recommendations, Similar
interface QueryMovie {
id?: string;
poster?: string;
title?: string;
year?: string;
type?: string; // "movie"
authors?: string[]; // Director array (optional)
}Usage: Search results
interface InfoMovie {
id?: string;
title?: string;
originalTitle?: string;
year?: string;
category?: string; // Genres comma separated
duration?: string; // Format "2h 18min"
rating?: string; // TMDB rating (0-10)
peopleRating?: string; // Vote count
poster?: string; // Full TMDB poster URL
tags?: string[]; // Genre array
synopsis?: string; // Full description
trailer?: string; // YouTube video ID for embed
direction?: string; // Main director
writers?: string[]; // Up to 5 writers
actors?: string[]; // Top 10 main actors
}Usage: Details page /info/[id]
Genre filtering system with 8 main categories:
const genres = [
{ id: null, name: "All" }, // Shows popular movies
{ id: 28, name: "Action" },
{ id: 35, name: "Comedy" },
{ id: 18, name: "Drama" },
{ id: 27, name: "Horror" },
{ id: 878, name: "Sci-Fi" },
{ id: 10749, name: "Romance" },
{ id: 53, name: "Thriller" },
];Full TMDB Genre Mapping (available in src/lib/api.ts):
- 28: Action | 12: Adventure | 16: Animation | 35: Comedy
- 80: Crime | 99: Documentary | 18: Drama | 10751: Family
- 14: Fantasy | 36: History | 27: Horror | 10402: Music
- 9648: Mystery | 10749: Romance | 878: Science Fiction
- 10770: TV Movie | 53: Thriller | 10752: War | 37: Western
.env.local file:
# TMDB API Configuration
TMDB_API_KEY=your_bearer_token_here.env.example file (for repository):
# TMDB API Configuration
# Get your API Key at: https://www.themoviedb.org/settings/api
# Use the "API Read Access Token (v4 auth)" NOT the "API Key (v3 auth)"
TMDB_API_KEY=your_tmdb_bearer_token_hereThe project uses standard Next.js 15 configuration with Turbopack enabled.
- β
Verify that
.env.localexists. - β
Ensure you are using
TMDB_API_KEY(withoutNEXT_PUBLIC_). - β
Restart the development server (
pnpm dev).
- β Your API Key is invalid or expired.
- β Verify that you copied the complete Read Access Token (v4).
- β Regenerate the token on TMDB if necessary.
- β Verify your internet connection.
- β Check if TMDB is operational.
- β Check the browser console for CORS errors.
- β
Ensure you added
TMDB_API_KEYin Vercel Environment Variables. - β Verify that the repository has all necessary files.
- β Check build logs in Vercel Dashboard.
- β New movie sections: Top Rated, Now Playing, Upcoming.
- β
3 new API endpoints:
/api/movies/top-rated,now-playing,upcoming. - β 9 functions in api.ts: topRated(), nowPlaying(), upcoming() added.
- β Optimized skeleton loaders: MoviesInfoSectionsSkeleton reduced from 519 to 45 lines (91% less code).
- β Horizontal carousels: Smooth scroll with custom scrollbar in each category.
- β Loading states: Independent loading states per category. ... and more.
- β Genre filters: Discovery system with 8 categories.
- β Recommended and similar movies: Endpoints and horizontal carousels.
- β Movie Interface: Renamed from TopMovie, now more versatile.
- β Custom scrollbar: Elegant design with theme colors.
- β
Custom gradients:
.text-gradientand.bg-gradientin CSS. - β Navbar glassmorphism: Frosted glass effect with backdrop-blur.
- β Sticky footer: Always at the end with flex layout.
- β
New components:
MoviesCard,MoviesInfoSections,GenreFilterCard. - β Dependency updates: Next.js 16.1.1, React 19.2.3.
- β UX improvements: Hover effects, smooth transitions, loading states.
- β Complete migration from IMDB scraping to TMDB API.
- β Removed Cheerio dependency.
- β Integrated YouTube trailers.
- β Full credits information (director, writers, actors).
- β Real-time updated data.
- β Better performance and reliability.
- β IMDB web scraping.
- β Top movies.
- β Basic search.
- β Detailed information.
Contributions are welcome. Please:
- Fork the project.
- Create a branch for your feature (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add: AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
This project is under the MIT license. See the LICENSE file for details.
- The Movie Database (TMDB) - For their excellent free API.
- Next.js - Amazing framework.
- Vercel - Simplified hosting and deployment.
- Tailwind CSS - Utility-first CSS framework.
- Lucide Icons - Beautiful and consistent icons.
Project Link: https://github.com/YeralAndre/cine-db
Live Demo: https://cine-db.vercel.app
β If you liked the project, give it a star on GitHub β
Made with β€οΈ using Next.js and TMDB API



