Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions mflix/README-JAVA-SPRING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ This is a full-stack movie browsing application built with Java Spring Boot and
## Project Structure

```
├── README-JAVA-SPRING.md
├── README.md
├── client/ # Next.js frontend (TypeScript)
└── server/java-spring/ # Java Spring Boot backend
└── server/ # Java Spring Boot backend
├── src/
├── pom.xml
├── .env.example
Expand All @@ -21,6 +21,8 @@ This is a full-stack movie browsing application built with Java Spring Boot and
- **MongoDB Atlas cluster or local deployment** with the `sample_mflix` dataset loaded
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
- **Maven** (included via Maven Wrapper)
- **Voyage AI API key** (For MongoDB Vector Search)
- [Get a Voyage AI API key](https://www.voyageai.com/)

## Getting Started

Expand All @@ -29,7 +31,7 @@ This is a full-stack movie browsing application built with Java Spring Boot and
Navigate to the Java Spring server directory:

```bash
cd server/java-spring
cd server
```

Create a `.env` file from the example:
Expand All @@ -42,20 +44,34 @@ Edit the `.env` file and set your MongoDB connection string:

```env
# MongoDB Connection
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/?retryWrites=true&w=majority
# Replace with your MongoDB Atlas connection string or local MongoDB URI
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/sample_mflix?retryWrites=true&w=majority

# Voyage AI Configuration
# API key for Voyage AI embedding model (required for Vector Search)
VOYAGE_API_KEY=your_voyage_api_key

# Server Configuration
# Port on which the Spring Boot application will run
PORT=3001

# CORS Configuration
# Allowed origin for cross-origin requests (frontend URL)
# For multiple origins, separate with commas
CORS_ORIGIN=http://localhost:3000

# Optional: Enable MongoDB Search tests
# Uncomment the following line to enable Search tests
# ENABLE_SEARCH_TESTS=true
```

**Note:** Replace `username`, `password`, and `cluster` with your actual MongoDB Atlas credentials.
**Note:** Replace `username`, `password`, and `cluster` with your
actual MongoDB Atlas credentials. Replace `your_voyage_api_key` with
your key.

### 2. Start the Backend Server

From the `server/java-spring` directory, run:
From the `server` directory, run:

```bash
# Using Maven Wrapper (recommended)
Expand Down Expand Up @@ -100,11 +116,15 @@ Open your browser and navigate to:

## Features

- **Browse Movies:** View a paginated list of movies from the sample_mflix dataset
- **Search:** Full-text search using MongoDB Search
- **Filter:** Filter movies by genre, year, rating, and more
- **Movie Details:** View detailed information about each movie
- **Aggregations:** Complex data aggregations and analytics
- **Browse Movies:** View a paginated list of movies from the
sample_mflix dataset
- **CRUD Operations:** Create, read, update and delete movies by using
the MongoDB Java driver
- **Search:** Search movies with filters by using MongoDB Search
- **Vector Search:** Search movie plots with similar search terms by
using MongoDB Vector Search
- **Aggregations:** View data aggregations and analytics built with
aggregation pipelines

## Development

Expand All @@ -119,7 +139,7 @@ The Java Spring Boot backend uses:
To run tests:

```bash
cd server/java-spring
cd server
./mvnw test
```

Expand Down
203 changes: 199 additions & 4 deletions mflix/README-JAVASCRIPT-EXPRESS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,211 @@
# JavaScript Express.js MongoDB Sample MFlix Application

[TODO: Add intro]
This is a full-stack movie browsing application built with Express.js and Next.js, demonstrating MongoDB operations using the `sample_mflix` dataset. The application showcases CRUD operations, aggregations, and MongoDB Search using the native MongoDB Node.js driver.

## Project Structure

```
├── README.md
├── client/ # Next.js frontend
└── server/ # Express.js backend
├── client/ # Next.js frontend (TypeScript)
└── server # Express.js backend
├── src/
├── package.json
├── .env.example
└── tsconfig.json
```

## Prerequisites

- **Node.js 22** or higher
- **MongoDB Atlas cluster or local deployment** with the `sample_mflix` dataset loaded
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
- **npm** (included with Node.js)
- **Voyage AI API key** (For MongoDB Vector Search)
- [Get a Voyage AI API key](https://www.voyageai.com/)

## Getting Started

[TODO: Add getting started instructions explaining how to set connection string, start server, start client, etc.]
### 1. Configure the Backend

Navigate to the Express server directory:

```bash
cd server
```

Create a `.env` file from the example:

```bash
cp .env.example .env
```

Edit the `.env` file and set your MongoDB connection string:

```env
# MongoDB Connection
# Replace with your MongoDB Atlas connection string or local MongoDB URI
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/sample_mflix?retryWrites=true&w=majority
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the Voyage API key to the Python and Java .env.example files when I moved them - we should probably do this for JS too and update this README to match.


# Voyage AI Configuration
# API key for Voyage AI embedding model (required for Vector Search)
VOYAGE_API_KEY=your_voyage_api_key

# Server Configuration
PORT=3001
NODE_ENV=development


# CORS Configuration
# Allowed origin for cross-origin requests (frontend URL)
# For multiple origins, separate with commas
CORS_ORIGIN=http://localhost:3000

# Optional: Enable MongoDB Search tests
# Uncomment the following line to enable Search tests
# ENABLE_SEARCH_TESTS=true
```

**Note:** Replace `<username>`, `<password>`, and `<cluster>` with
your actual MongoDB Atlas credentials. Replace `your_voyage_api_key` with
your key.

### 2. Install Backend Dependencies

From the `server` directory, run:

```bash
npm install
```

### 3. Start the Backend Server

From the `server` directory, run:

```bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend making these separate bash blocks so users can just execute them in their IDE if they want to.

# Development mode with hot reloading
npm run dev
```


Or for production mode, run:

```bash
npm run build
npm start
```

The server will start on `http://localhost:3001`. You can verify it's running by visiting:
- API root: http://localhost:3001/
- API documentation (Swagger UI): http://localhost:3001/api-docs

### 4. Configure and Start the Frontend

Open a new terminal and navigate to the client directory:

```bash
cd client
```

Install dependencies:

```bash
npm install
```

Start the development server:

```bash
npm run dev
```

The Next.js application will start on `http://localhost:3000`.

### 5. Access the Application

Open your browser and navigate to:
- **Frontend:** http://localhost:3000
- **Backend API:** http://localhost:3001
- **API Documentation:** http://localhost:3001/api-docs

## Features

- **Browse Movies:** View a paginated list of movies from the
sample_mflix dataset
- **CRUD Operations:** Create, read, update and delete movies by using
the MongoDB Node.js driver
- **Search:** Search movies with filters by using MongoDB Search
- **Vector Search:** Search movie plots with similar search terms by
using MongoDB Vector Search
- **Aggregations:** View data aggregations and analytics built with
aggregation pipelines

## Development

### Backend Development

The Express.js backend uses:
- **Express.js 5** for REST API
- **MongoDB Node.js Driver** for database operations
- **TypeScript** for type safety
- **Swagger** for API documentation
- **Jest** for testing

To run tests:

```bash
cd server
npm test
```

To run tests with coverage:

```bash
cd server
npm run test:coverage
```

### Frontend Development

The Next.js frontend uses:
- **React 19** with TypeScript
- **Next.js 16** with App Router
- **Turbopack** for fast development builds

#### Development Mode

For active development with hot reloading and fast refresh:

```bash
cd client
npm run dev
```

This starts the development server on `http://localhost:3000` with Turbopack for fast rebuilds.

#### Production Build

To create an optimized production build and run it:

```bash
cd client
npm run build # Creates optimized production build
npm start # Starts production server
```

The production build:
- Minifies and optimizes JavaScript and CSS
- Optimizes images and assets
- Generates static pages where possible
- Provides better performance for end users

#### Linting

To check code quality:

```bash
cd client
npm run lint
```

## Issues

Expand Down
Loading
Loading