A full-stack movie database application built with the MERN stack, featuring a comprehensive collection of 250+ movies with search, filtering, and admin management capabilities.
Live Demo: https://mern-movie-db.vercel.app/
- Features
- Tech Stack
- Project Structure
- Installation
- Environment Variables
- Running Locally
- Database Seeding
- User Roles
- API Endpoints
- Deployment
- Screenshots
- Future Enhancements
- Contributing
- License
- Browse 250+ curated movies with pagination
- Advanced search and filtering by title, genre, rating, and year
- View detailed movie information including cast, director, duration, and synopsis
- Responsive design optimized for mobile, tablet, and desktop
- User authentication with JWT tokens
- Secure login and registration
- Full CRUD operations for movie management
- Add new movies with complete metadata
- Edit existing movie information
- Delete movies from the database
- Admin dashboard with statistics
- Role-based access control
- RESTful API architecture
- MongoDB database with Mongoose ODM
- JWT-based authentication and authorization
- Password hashing with bcrypt
- CORS-enabled backend
- Environment-based configuration
- Spotlight card hover effects
- Optimized image loading
- Error handling and validation
- React 18.2.0
- React Router 6.x
- Material-UI (MUI) 5.x
- Axios for API calls
- Context API for state management
- Node.js
- Express.js
- MongoDB with Mongoose
- JSON Web Tokens (JWT)
- bcryptjs for password hashing
- dotenv for environment management
- Frontend: Vercel
- Backend: Render
- Database: MongoDB Atlas
MovieDB/
├── backend/
│ ├── config/
│ │ └── database.js # MongoDB connection
│ ├── controllers/
│ │ ├── authController.js # Authentication logic
│ │ └── movieController.js # Movie CRUD operations
│ ├── data/
│ │ └── top250movies.js # Movie dataset
│ ├── middleware/
│ │ └── auth.js # JWT verification
│ ├── models/
│ │ ├── Movie.js # Movie schema
│ │ └── User.js # User schema
│ ├── routes/
│ │ ├── auth.js # Auth routes
│ │ └── movies.js # Movie routes
│ ├── scripts/
│ │ └── seedMovies.js # Database seeding script
│ ├── .env # Environment variables
│ ├── server.js # Express server entry point
│ └── package.json
│
├── frontend/
│ ├── public/
│ │ └── index.html
│ ├── src/
│ │ ├── components/
│ │ │ ├── Auth/
│ │ │ │ ├── Login.js
│ │ │ │ └── Register.js
│ │ │ ├── Common/
│ │ │ │ ├── MovieCard.js
│ │ │ │ └── SpotlightCard.js
│ │ │ ├── Dashboard/
│ │ │ │ ├── AdminDashboard.js
│ │ │ │ ├── AddMovie.js
│ │ │ │ └── EditMovie.js
│ │ │ ├── Layout/
│ │ │ │ └── Navbar.js
│ │ │ ├── Movie/
│ │ │ │ ├── MovieDetail.js
│ │ │ │ └── MovieList.js
│ │ │ └── Search/
│ │ │ └── SearchPage.js
│ │ ├── context/
│ │ │ └── AuthContext.js # Authentication context
│ │ ├── services/
│ │ │ └── api.js # Axios configuration
│ │ ├── App.js
│ │ ├── index.js
│ │ └── theme.js # MUI theme configuration
│ ├── .env.production
│ └── package.json
│
└── README.md
- Node.js (v14 or higher)
- npm or yarn
- MongoDB Atlas account or local MongoDB instance
- Git
git clone https://github.com/raza-khan0108/mern-movie-db.git
cd mern-movie-dbcd backend
npm installcd frontend
npm installCreate a .env file in the backend directory:
MONGODB_URI=your_mongodb_atlas_uri
JWT_SECRET=your_super_secret_jwt_key_minimum_32_characters
NODE_ENV=development
PORT=5000
FRONTEND_URL=http://localhost:3000Create a .env file in the frontend directory:
REACT_APP_API_URL=http://localhost:5000/apicd backend
npm run devThe backend server will run on http://localhost:5000
cd frontend
npm startThe frontend will run on http://localhost:3000
Populate the database with 250+ movies:
cd backend
npm run seedThis will:
- Connect to MongoDB
- Clear existing movies
- Insert 250+ movies from the dataset
- Display success confirmation
- Browse and search movies
- View movie details
- Access personal profile
- All user capabilities
- Access admin dashboard
- Add new movies
- Edit existing movies
- Delete movies
- View statistics
For testing purposes, the registration form includes a role selector:
- Select "User" for standard access
- Select "Admin" for administrative access
Note: In production, admin access should be granted manually through database modification or a secure admin panel.
POST /api/auth/register - Register new user
POST /api/auth/login - Login user
GET /api/auth/me - Get current user
GET /api/movies - Get all movies (with pagination)
GET /api/movies/:id - Get single movie
POST /api/movies - Create movie (Admin only)
PUT /api/movies/:id - Update movie (Admin only)
DELETE /api/movies/:id - Delete movie (Admin only)
GET /api/movies/search - Search movies
page - Page number (default: 1)
limit - Items per page (default: 10)
search - Search term
genre - Filter by genre
minRating - Minimum rating
year - Release year
- Push code to GitHub
- Connect repository to Vercel
- Configure build settings:
- Framework: Create React App
- Root Directory:
frontend - Build Command:
npm run build - Output Directory:
build
- Add environment variables:
REACT_APP_API_URL: Your backend URL
- Connect repository to Render
- Create Web Service
- Configure settings:
- Root Directory:
backend - Build Command:
npm install - Start Command:
npm start
- Root Directory:
- Add environment variables:
MONGODB_URIJWT_SECRETNODE_ENV=productionFRONTEND_URL
- Create cluster on MongoDB Atlas
- Whitelist IP:
0.0.0.0/0for Render access - Create database user
- Get connection string
- Update environment variables
Browse through 250+ curated movies with intuitive navigation and pagination.
Advanced search functionality with multiple filter options including genre, rating, and release year.
Comprehensive movie information with cast, director, runtime, and high-quality poster images.
Powerful admin interface for managing the movie database with full CRUD capabilities.
- User watchlist and favorites
- Movie ratings and reviews
- Advanced filtering (multiple genres, cast search)
- Recommendation system
- Movie trailers integration
- User profile management
- Email verification
- Password reset functionality
- Social sharing features
- Dark/Light theme toggle
- Infinite scroll pagination
- Movie comparison feature
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Movie data sourced from IMDb Top 250
- Poster images from various movie databases
- UI inspiration from modern streaming platforms
- Material-UI component library
Developer: Raza Khan
GitHub: https://github.com/raza-khan0108
Live Demo: https://mern-movie-db.vercel.app/
Built with passion for movies and modern web technologies.