A React-based movie browsing application that allows users to discover movies from any year using The Movie Database (TMDB) API.
- Birth Year Selection: Dropdown with years from 1900 to current year
- Movie Discovery: Fetches movies from TMDB API based on selected year
- Responsive Grid Layout:
- 4 movies per row on large screens
- 3 movies per row on medium screens
- 2 movies per row on small screens
- 1 movie per row on mobile
- Pagination: Browse through multiple pages of results
- Movie Information: Each movie shows poster, title, and release year
- Lazy Loading: Movie posters load asynchronously with loading skeletons
- Error Handling: Graceful error handling for API failures
- Create an account at The Movie Database
- Go to Settings > API in your account
- Create a new API key (v3 auth)
- Copy your API key
- Copy
.env.exampleto.env.localin your project root:cp .env.example .env.local
- Edit
.env.localand replaceyour_api_key_herewith your actual TMDB API key:
VITE_TMDB_API_KEY=your_actual_api_key_here# Install dependencies
npm install
# Start development server
npm run devThe app will be available at http://localhost:5173
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLintnpm run lint:fix- Run ESLint with auto-fixnpm run format- Format code with Prettiernpm run format:check- Check code formatting
- Select Birth Year: Choose your birth year from the dropdown
- Click "Go!": The button is enabled only when a year is selected
- Browse Movies: View movies in a responsive grid layout
- Navigate Pages: Use Previous/Next buttons to browse through results
- View Details: Each movie shows poster, title, and release year
- React 18 with TypeScript
- Vite for development and building
- Chakra UI v3 for components and styling
- Axios for API requests
- React Icons for UI icons
- TMDB API for movie data
This project includes interactive demos showcasing advanced state management patterns in the src/demos/ folder:
- useReducer patterns - Atomic state updates and predictable transitions
- Immer integration - Complex nested state with simple syntax
- State machines - Preventing invalid states (e.g., image loading)
- Performance comparisons - Real-time measurements of different approaches
The demos are automatically displayed in development mode and excluded from production builds. See src/demos/README.md for detailed information.
The app uses TMDB's /discover/movie endpoint with the following parameters:
primary_release_year: Selected birth yearsort_by: popularity.descpage: Current page number
Movies are displayed 12 per page (3 rows × 4 columns on large screens).
The grid layout automatically adjusts based on screen size:
- Large (lg): 4 columns
- Medium (md): 3 columns
- Small (sm): 2 columns
- Mobile (base): 1 column
- Network errors are caught and displayed to the user
- Missing movie posters show a placeholder
- Loading states are shown during API calls
- Graceful fallbacks for missing data