REST API for searching movies with MongoDB Atlas Search, managing a watchlist in the same cluster, and assigning 1–5 star ratings. Built with Node.js, TypeScript, Express, and the official MongoDB Node.js driver. There is no web UI—call the API with Bruno (see bruno/), Postman, or any HTTP client.
For endpoint behavior, data model notes, and implementation details, see AGENTS.md.
- Node.js (LTS recommended; the companion tutorial targets Node.js 22+)
- MongoDB Atlas with the
sample_mflixdatabase loaded (e.g. Atlas sample dataset), including themoviescollection used for search and watchlist lookups - Atlas Search on that cluster: a search index on
sample_mflix.movieswhose name matchesSEARCH_INDEX_NAME(ordefault). The app does not create the index. Useresources/atlas-search-index.jsonand the short UI checklist inresources/atlas-search-setup.txt.
-
Install dependencies (this repo uses pnpm):
pnpm install
-
Configure environment — create a
.envfile in the project root (do not commit secrets):MONGODB_URI=mongodb+srv://<USER>:<PASSWORD>@<HOST>/ PORT=3000 SEARCH_INDEX_NAME=default
MONGODB_URIis required.PORTdefaults to3000if omitted.SEARCH_INDEX_NAMEmust match your Atlas Search index name; omit it to usedefault. -
Ensure Atlas Search is ready — index
titleandplotonmoviesas described inresources/. Until the index exists and is active,GET /movies/searchwill fail at query time. -
Run the server
-
Development (watch mode):
pnpm run dev
-
Production-style:
pnpm run buildthenpnpm start.
-
-
Smoke test — open
http://localhost:3000/health(or yourPORT). You should see{ "ok": true }. -
Try the API — import the Bruno collection from
bruno/(collection name Movie Ratings) or call routes listed inAGENTS.md.
| Command | Description |
|---|---|
pnpm run dev |
Run src/app.ts with tsx in watch mode |
pnpm run build |
Compile TypeScript to dist/ |
pnpm start |
Run node dist/app.js |
AGENTS.md— Configuration, HTTP API summary, watchlist semantics, and Atlas Search pipeline overview.