On this page
This repository accompanies the MongoDB tutorial on building an AI-powered image search application. If you watched the video, or you are about to, this page summarizes how the repo is organized and what each layer of search does.
Most operating systems still rely heavily on filenames when searching images. Once your collection grows into hundreds or thousands of photos, finding exactly what you are looking for becomes surprisingly difficult.
This project explores a different approach. Instead of searching filenames, a vision model understands each image, generates structured metadata, stores everything in MongoDB, and layers increasingly capable search techniques on top of that data.
Helpful links
Built with MongoDB Search, MongoDB Vector Search, Ollama, Voyage AI, and Next.js.
Starting with nothing more than a folder of images, you build a search application capable of understanding what is actually inside each image. The search experience grows one layer at a time.
| Step | Try searching | What happens |
|---|---|---|
| MongoDB Search | beach | Keyword match across titles, descriptions, summaries, tags, and other metadata |
| MongoDB Vector Search | ocean | Finds relevant images by meaning, even when the exact word never appears in a document |
| Hybrid Search | wild flying animals | MongoDB Search and Vector Search combined with $rankFusion for keyword precision plus semantic understanding |
One of the goals of this project was to keep the overall architecture simple. Everything revolves around a single MongoDB document per image.
high-level pipeline
Images
│
â–Ľ
Vision Model (Ollama)
│
â–Ľ
Structured Metadata
│
â–Ľ
MongoDB Documents
├── MongoDB Search
└── Vector Embeddings
│
â–Ľ
Hybrid Search
│
â–Ľ
Next.js ApplicationRather than introducing multiple databases or external search systems, MongoDB becomes the central source of truth. Metadata, embeddings, and search indexes all live together. That simplicity is one of the best parts of this architecture.
As the project grew, a few design decisions ended up making a big difference.
If you are exploring the code after watching the video, these are the best places to start.
| Location | Purpose |
|---|---|
| tools/process/ | Image processing pipeline, Ollama integration, metadata generation, and embedding tools |
| lib/image/queries/ | MongoDB aggregation pipelines for Search, Vector Search, and Hybrid Search |
| app/api/ | API routes connecting the frontend to MongoDB |
| app/ | Next.js application and user interface |
Suggested reading order
That order mirrors the tutorial and builds the project one concept at a time.
These sections map directly to the repository. Timestamps point to where each topic appears in the tutorial.
| Video section | Timestamp | Repository |
|---|---|---|
| System architecture & local LLM processing | 2:05 | ARCHITECTURE.md |
| Generating structured metadata JSON | 3:19 | tools/process/ |
| Image processing | 4:44 | tools/process/ |
| Setting up traditional text search | 8:33 | SEARCH.md, lib/image/queries/ |
| Creating a vector search index | 13:09 | generate-embeddings.js |
| Implementing hybrid search with rank fusion | 20:25 | lib/image/queries/ |
The README gives you the high-level overview. These documents take a deeper look at individual parts of the project.
ARCHITECTURE.md
Understand the overall system, the processing pipeline, and why the project is structured this way.
Read guide →
CODE-GUIDE.md
A guided tour of the repository and where to find the code shown in the tutorial.
Read guide →
SEARCH.md
Learn how MongoDB Search, MongoDB Vector Search, and Hybrid Search are implemented.
Read guide →
OLLAMA.md
Learn how Ollama fits into the processing pipeline and how to swap in other providers.
Read guide →
PROMPTS.md
Read about the prompt engineering decisions and lessons learned while building the project.
Read guide →
Image search is really just the beginning. The same architecture can be applied to many other types of data.
Once your data has been enriched with AI and stored in MongoDB, you can continue building on top of it without introducing additional systems. That is what makes this pattern so powerful.
Learn more: learnmongo.com