Leveraging Hybrid Search with MongoDB, Modal, and Clay for Enhanced California Data Insights
- Gate
- Machine Learning
- Departs
- Crew
- Charles Frye
- Passengers
- 832
Explore a hybrid search application utilizing MongoDB, Modal, and Clay for satellite image analysis of California, showcasing data integration and real-time capabilities.

Combining data APIs, foundation models, and serverless infrastructure creates an effective ecosystem for data analysis and application development. One practical demonstration of this integration is a hybrid search application designed to search over California using timestamps, geolocation data, and satellite image embeddings sourced from an innovative model by Clay and Development Seed.
This application isn’t just a showcase of new technology but represents the potential of integrating diverse datasets to yield actionable insights. You can explore the application here and access the underlying code here.
How the Hybrid Search Works
The mechanics of this hybrid search involve a series of steps that leverage satellite imagery to respond to search queries. Here’s an overview of the data flow:
- Every few days, the European Space Agency’s Sentinel satellites capture images of the Earth and store them in cloud storage, making them accessible via an API.
- Daily queries are made to this API for new images focusing on a defined area of interest, specifically the state of California. These areas are represented in GeoJSON format, which is widely available online.
- The returned API responses, formatted as JSON documents, are uploaded to a MongoDB Atlas cluster for storage and easy access.
- In the background, asynchronous queries to the database help identify entries lacking associated embeddings.
- These unembedded entries are sent to a serverless embedding service that utilizes the Clay v1 foundation model. The model processes numerous sub-regions simultaneously using high-performance A10 GPUs and merges the resulting embeddings into a single output through custom PyTorch code.
- The generated embeddings are transferred back to the MongoDB Atlas cluster for storage.
- Finally, a lightweight frontend client built on Alpine JS interacts with users through a simple FastAPI server, which serves the necessary queries to MongoDB Atlas based on geolocation, image embeddings, and timestamps.
This entire hybrid application showcases the integration of API queries, data persistence, GPU inference, and hybrid searches, facilitated by Modal and MongoDB Atlas. Setting it up requires basic credentials for these platforms and a few commands — all detailed in the full code repository.
Why Select Modal and MongoDB Atlas?
The satellite image search application illustrates a growing trend in technology where APIs and foundation models like Clay are employed to create rich, interactive user experiences.
The synergy between Modal and MongoDB Atlas lies in their respective strengths, making them an ideal selection for developers pursuing scalable, efficient projects:
-
Versatility & Developer Experience
Modal simplifies the process of executing various Python workloads in the cloud, applicable for tasks ranging from the execution of scheduled jobs to the operation of database clients and GPU-accelerated neural networks.
MongoDB Atlas complements this by providing a flexible storage solution that adapts to diverse cloud storage needs while maintaining a unified interface through its JSON document model, effectively bridging the gap between data APIs and storage.
This integrated approach allows for rapid iteration and development.
-
Scalability
Modal’s serverless infrastructure automatically scales resources to match workload demands, allowing users to pay only for what they utilize. This capability is exemplified by companies like Suno, which successfully deploys applications at scale through Modal.
Conversely, MongoDB Atlas is engineered to effectively manage large-scale operations, featuring built-in data tiering and point-in-time recovery, alongside global availability and multi-region replication, which together ensure that your data and compute resources align with operational needs.
-
AI and Machine Learning Capabilities
Modal provides on-demand access to advanced GPUs, such as NVIDIA H100s, enabling the execution of sophisticated foundation models. It also supports robust development primitives designed for cloud environments, facilitating the management of large file storage and queue systems.
MongoDB Atlas enhances this by offering flexible search capabilities that encompass text, geospatial, and vector data presentations, integrating seamlessly with current foundation models and linking them directly to operational data for real-time responsiveness.
Through this powerful combination, users can harness state-of-the-art hardware and intelligent models to elevate their applications' capabilities and performance.
