-
Notifications
You must be signed in to change notification settings - Fork 6
Add READMEs and cleanup #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
5cda8e2
b9cecb8
be79f27
30de09e
251250b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||
|
|
||||||
|
|
@@ -100,11 +102,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 | ||||||
|
|
||||||
|
|
@@ -176,5 +182,5 @@ If you have problems running the sample app, please check the following: | |||||
| - [ ] Verify that you have no firewalls blocking access to the server or client ports. | ||||||
|
|
||||||
| If you have verified the above and still have issues, please | ||||||
| [open an issue](https://github.com/mongodb/docs-sample-apps/issues/new/choose) | ||||||
| on the source repository `mongodb/docs-sample-apps`. | ||||||
| [open an issue](https://github.com/mongodb/sample-app-java-mflix/issues/new/choose) | ||||||
| on the source repository `mongodb/sample-app-java-mflix`. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, this was actually correct. We have disabled Issues on the artifact repos and want people to create issues directly on the source repo so we only have one place to watch instead of three of them.
Suggested change
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good to know, I thought we were keeping the source repo separated. Changed back |
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,16 +1,198 @@ | ||||||
| # 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 | ||||||
| ├── README-JAVASCRIPT-EXPRESS.md | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this is the public-facing project, the README will be renamed by the copy tool to just
Suggested change
|
||||||
| ├── client/ # Next.js frontend (TypeScript) | ||||||
| └── server/js-express/ # Express.js backend | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, missed this - the copier tool will rename this to just
Suggested change
|
||||||
| ├── 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/js-express | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ``` | ||||||
|
|
||||||
| Create a `.env` file from the example: | ||||||
|
|
||||||
| ```bash | ||||||
| cp .env.example .env | ||||||
| ``` | ||||||
|
|
||||||
| Edit the `.env` file and set your MongoDB connection string: | ||||||
|
|
||||||
| ```env | ||||||
| # MongoDB Configuration | ||||||
| # Replace with your MongoDB Atlas connection string | ||||||
| MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/sample_mflix?retryWrites=true&w=majority | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||||||
|
|
||||||
| # Server Configuration | ||||||
| PORT=3001 | ||||||
| NODE_ENV=development | ||||||
|
|
||||||
| # CORS Configuration (frontend URL) | ||||||
| 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. | ||||||
|
|
||||||
| ### 2. Install Backend Dependencies | ||||||
|
|
||||||
| From the `server/js-express` directory, run: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```bash | ||||||
| npm install | ||||||
| ``` | ||||||
|
|
||||||
| ### 3. Start the Backend Server | ||||||
|
|
||||||
| From the `server/js-express` directory, run: | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| ```bash | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 production mode | ||||||
| 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/js-express | ||||||
| npm test | ||||||
| ``` | ||||||
|
|
||||||
| To run tests with coverage: | ||||||
|
|
||||||
| ```bash | ||||||
| cd server/js-express | ||||||
| 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 | ||||||
|
|
||||||
|
|
@@ -22,5 +204,5 @@ If you have problems running the sample app, please check the following: | |||||
| - [ ] Verify that you have no firewalls blocking access to the server or client ports. | ||||||
|
|
||||||
| If you have verified the above and still have issues, please | ||||||
| [open an issue](https://github.com/mongodb/docs-sample-apps/issues/new/choose) | ||||||
| on the source repository `mongodb/docs-sample-apps`. | ||||||
| [open an issue](https://github.com/mongodb/sample-app-nodejs-mflix/issues/new/choose) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| on the source repository `mongodb/sample-app-nodejs-mflix`. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.