This is a Next.js frontend application that demonstrates a modern movie browsing experience by connecting to a backend API. The application showcases Server Side Rendering (SSR), responsive design, and interactive features while displaying movie data from the MongoDB sample_mflix dataset.
client/
├── README.md
├── package.json
├── next.config.ts
├── tsconfig.json
├── .env.example
└── app/
├── layout.tsx # Root layout with navigation
├── page.tsx # Home page
├── globals.css # Global styles
├── movies/ # Movies listing page
├── movie/[id]/ # Individual movie details
├── aggregations/ # Data aggregations page
├── components/ # Reusable UI components
├── lib/ # API utilities and constants
└── types/ # TypeScript type definitions
- Backend API Server: The backend server must be running on
http://localhost:3001 - MongoDB Database: The backend must be connected to a MongoDB instance with the
sample_mflixdataset loaded - Node.js 18 or higher
- npm (included with Node.js)
Copy the environment example file:
cp .env.example .env.localEdit .env.local and update the API URL if needed:
API_URL=http://localhost:3001npm installnpm run devThe Next.js application will start on http://localhost:3000.
Open your browser and navigate to:
- Frontend: http://localhost:3000
- Movies Page: http://localhost:3000/movies
- Aggregations: http://localhost:3000/aggregations
- Browse Movies: View a paginated list of movies from the sample_mflix dataset with server-side rendering
- Movie Details: Access comprehensive movie information including plot, cast, ratings, and metadata
- CRUD Operations: Create, read, update, and delete movies
- Search & Filters: Search movies with various filters and sorting options using MongoDB Search
- Vector Search: Find movies with similar plot descriptions using MongoDB Vector Search
- Data Aggregations: View analytics and insights built with MongoDB aggregation pipelines
If you have problems running the sample app, please check the following:
- Verify that you have started the backend server on port 3001.
- Verify that the backend is connected to MongoDB with the sample_mflix dataset.
- Verify that you have set the correct API_URL in your
.env.localfile. - Verify that you have no firewalls blocking access to ports 3000 or 3001.
If you have verified the above and still have issues, please open an issue on the source repository mongodb/docs-sample-apps.