A React-based movie discovery application that allows users to search for movies and manage their favorites using The Movie Database (TMDB) API.
- 🎬 Browse popular movies
- 🔍 Search for movies by title
- ❤️ Add/remove movies from favorites
- 💾 Persistent favorites using localStorage
- 📱 Responsive design
- React 19 with TypeScript
- React Router for navigation
- Vite for build tooling
- TMDB API for movie data
- CSS for styling
- Node.js (v16 or higher)
- TMDB API key (free from The Movie Database)
-
Clone the repository:
git clone <repository-url> cd movies-app
-
Install dependencies:
npm install
-
Create a
.envfile in the root directory and add your TMDB API key:REACT_APP_TMDB_API_KEY=your_api_key_here REACT_APP_TMDB_BASE_URL=https://api.themoviedb.org/3
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:5173
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
src/
├── components/ # Reusable UI components
│ ├── MovieCard.tsx # Individual movie card
│ └── NavBar.tsx # Navigation bar
├── pages/ # Page components
│ ├── Home.tsx # Home page with search
│ └── Favorites.tsx # Favorites page
├── contexts/ # React context providers
│ └── MovieContext.tsx
├── hooks/ # Custom hooks
├── services/ # API service functions
│ └── api.ts
├── types/ # TypeScript type definitions
│ └── Movie.ts
├── css/ # Stylesheets
└── App.tsx # Main app component
The app uses The Movie Database (TMDB) API to fetch:
- Popular movies on the home page
- Search results based on user queries
- Uses React Context API for global state management
- Favorites are persisted in localStorage
- Movie context provides methods to add/remove favorites
This project is open source and available under the MIT License.