Skip to content

Commit 2f9ea16

Browse files
authored
Merge pull request #33 from jordan-smith721/cleanup2
Add READMEs and cleanup
2 parents b312aaf + 251250b commit 2f9ea16

18 files changed

Lines changed: 344 additions & 186 deletions

File tree

mflix/README-JAVA-SPRING.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ This is a full-stack movie browsing application built with Java Spring Boot and
55
## Project Structure
66

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

2527
## Getting Started
2628

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

3133
```bash
32-
cd server/java-spring
34+
cd server
3335
```
3436

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

4345
```env
4446
# MongoDB Connection
45-
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/?retryWrites=true&w=majority
47+
# Replace with your MongoDB Atlas connection string or local MongoDB URI
48+
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/sample_mflix?retryWrites=true&w=majority
49+
50+
# Voyage AI Configuration
51+
# API key for Voyage AI embedding model (required for Vector Search)
52+
VOYAGE_API_KEY=your_voyage_api_key
4653
4754
# Server Configuration
55+
# Port on which the Spring Boot application will run
4856
PORT=3001
4957
5058
# CORS Configuration
59+
# Allowed origin for cross-origin requests (frontend URL)
60+
# For multiple origins, separate with commas
5161
CORS_ORIGIN=http://localhost:3000
62+
63+
# Optional: Enable MongoDB Search tests
64+
# Uncomment the following line to enable Search tests
65+
# ENABLE_SEARCH_TESTS=true
5266
```
5367

54-
**Note:** Replace `username`, `password`, and `cluster` with your actual MongoDB Atlas credentials.
68+
**Note:** Replace `username`, `password`, and `cluster` with your
69+
actual MongoDB Atlas credentials. Replace `your_voyage_api_key` with
70+
your key.
5571

5672
### 2. Start the Backend Server
5773

58-
From the `server/java-spring` directory, run:
74+
From the `server` directory, run:
5975

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

101117
## Features
102118

103-
- **Browse Movies:** View a paginated list of movies from the sample_mflix dataset
104-
- **Search:** Full-text search using MongoDB Search
105-
- **Filter:** Filter movies by genre, year, rating, and more
106-
- **Movie Details:** View detailed information about each movie
107-
- **Aggregations:** Complex data aggregations and analytics
119+
- **Browse Movies:** View a paginated list of movies from the
120+
sample_mflix dataset
121+
- **CRUD Operations:** Create, read, update and delete movies by using
122+
the MongoDB Java driver
123+
- **Search:** Search movies with filters by using MongoDB Search
124+
- **Vector Search:** Search movie plots with similar search terms by
125+
using MongoDB Vector Search
126+
- **Aggregations:** View data aggregations and analytics built with
127+
aggregation pipelines
108128

109129
## Development
110130

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

121141
```bash
122-
cd server/java-spring
142+
cd server
123143
./mvnw test
124144
```
125145

mflix/README-JAVASCRIPT-EXPRESS.md

Lines changed: 199 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,211 @@
11
# JavaScript Express.js MongoDB Sample MFlix Application
22

3-
[TODO: Add intro]
3+
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.
4+
5+
## Project Structure
46

57
```
68
├── README.md
7-
├── client/ # Next.js frontend
8-
└── server/ # Express.js backend
9+
├── client/ # Next.js frontend (TypeScript)
10+
└── server # Express.js backend
11+
├── src/
12+
├── package.json
13+
├── .env.example
14+
└── tsconfig.json
915
```
1016

17+
## Prerequisites
18+
19+
- **Node.js 22** or higher
20+
- **MongoDB Atlas cluster or local deployment** with the `sample_mflix` dataset loaded
21+
- [Load sample data](https://www.mongodb.com/docs/atlas/sample-data/)
22+
- **npm** (included with Node.js)
23+
- **Voyage AI API key** (For MongoDB Vector Search)
24+
- [Get a Voyage AI API key](https://www.voyageai.com/)
25+
1126
## Getting Started
1227

13-
[TODO: Add getting started instructions explaining how to set connection string, start server, start client, etc.]
28+
### 1. Configure the Backend
29+
30+
Navigate to the Express server directory:
31+
32+
```bash
33+
cd server
34+
```
35+
36+
Create a `.env` file from the example:
37+
38+
```bash
39+
cp .env.example .env
40+
```
41+
42+
Edit the `.env` file and set your MongoDB connection string:
43+
44+
```env
45+
# MongoDB Connection
46+
# Replace with your MongoDB Atlas connection string or local MongoDB URI
47+
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/sample_mflix?retryWrites=true&w=majority
48+
49+
# Voyage AI Configuration
50+
# API key for Voyage AI embedding model (required for Vector Search)
51+
VOYAGE_API_KEY=your_voyage_api_key
52+
53+
# Server Configuration
54+
PORT=3001
55+
NODE_ENV=development
56+
57+
58+
# CORS Configuration
59+
# Allowed origin for cross-origin requests (frontend URL)
60+
# For multiple origins, separate with commas
61+
CORS_ORIGIN=http://localhost:3000
62+
63+
# Optional: Enable MongoDB Search tests
64+
# Uncomment the following line to enable Search tests
65+
# ENABLE_SEARCH_TESTS=true
66+
```
67+
68+
**Note:** Replace `<username>`, `<password>`, and `<cluster>` with
69+
your actual MongoDB Atlas credentials. Replace `your_voyage_api_key` with
70+
your key.
71+
72+
### 2. Install Backend Dependencies
73+
74+
From the `server` directory, run:
75+
76+
```bash
77+
npm install
78+
```
79+
80+
### 3. Start the Backend Server
81+
82+
From the `server` directory, run:
83+
84+
```bash
85+
# Development mode with hot reloading
86+
npm run dev
87+
```
88+
89+
90+
Or for production mode, run:
91+
92+
```bash
93+
npm run build
94+
npm start
95+
```
96+
97+
The server will start on `http://localhost:3001`. You can verify it's running by visiting:
98+
- API root: http://localhost:3001/
99+
- API documentation (Swagger UI): http://localhost:3001/api-docs
100+
101+
### 4. Configure and Start the Frontend
102+
103+
Open a new terminal and navigate to the client directory:
104+
105+
```bash
106+
cd client
107+
```
108+
109+
Install dependencies:
110+
111+
```bash
112+
npm install
113+
```
114+
115+
Start the development server:
116+
117+
```bash
118+
npm run dev
119+
```
120+
121+
The Next.js application will start on `http://localhost:3000`.
122+
123+
### 5. Access the Application
124+
125+
Open your browser and navigate to:
126+
- **Frontend:** http://localhost:3000
127+
- **Backend API:** http://localhost:3001
128+
- **API Documentation:** http://localhost:3001/api-docs
129+
130+
## Features
131+
132+
- **Browse Movies:** View a paginated list of movies from the
133+
sample_mflix dataset
134+
- **CRUD Operations:** Create, read, update and delete movies by using
135+
the MongoDB Node.js driver
136+
- **Search:** Search movies with filters by using MongoDB Search
137+
- **Vector Search:** Search movie plots with similar search terms by
138+
using MongoDB Vector Search
139+
- **Aggregations:** View data aggregations and analytics built with
140+
aggregation pipelines
141+
142+
## Development
143+
144+
### Backend Development
145+
146+
The Express.js backend uses:
147+
- **Express.js 5** for REST API
148+
- **MongoDB Node.js Driver** for database operations
149+
- **TypeScript** for type safety
150+
- **Swagger** for API documentation
151+
- **Jest** for testing
152+
153+
To run tests:
154+
155+
```bash
156+
cd server
157+
npm test
158+
```
159+
160+
To run tests with coverage:
161+
162+
```bash
163+
cd server
164+
npm run test:coverage
165+
```
166+
167+
### Frontend Development
168+
169+
The Next.js frontend uses:
170+
- **React 19** with TypeScript
171+
- **Next.js 16** with App Router
172+
- **Turbopack** for fast development builds
173+
174+
#### Development Mode
175+
176+
For active development with hot reloading and fast refresh:
177+
178+
```bash
179+
cd client
180+
npm run dev
181+
```
182+
183+
This starts the development server on `http://localhost:3000` with Turbopack for fast rebuilds.
184+
185+
#### Production Build
186+
187+
To create an optimized production build and run it:
188+
189+
```bash
190+
cd client
191+
npm run build # Creates optimized production build
192+
npm start # Starts production server
193+
```
194+
195+
The production build:
196+
- Minifies and optimizes JavaScript and CSS
197+
- Optimizes images and assets
198+
- Generates static pages where possible
199+
- Provides better performance for end users
200+
201+
#### Linting
202+
203+
To check code quality:
204+
205+
```bash
206+
cd client
207+
npm run lint
208+
```
14209

15210
## Issues
16211

0 commit comments

Comments
 (0)