diff --git a/app/ai/page.tsx b/app/ai/page.tsx new file mode 100644 index 0000000..190d948 --- /dev/null +++ b/app/ai/page.tsx @@ -0,0 +1,506 @@ +import Image from "next/image"; +import Link from "next/link"; +import CommandSnippet from "../components/CommandSnippet"; +import { getMetadata } from "../services/metadataService"; +import { withBasePath } from "../services/sitePath"; + +export const metadata = getMetadata({ + title: "DocumentDB for AI - Vector Search, RAG, and Embeddings", + description: + "Build AI applications with DocumentDB: a Mongo API-compatible document model, native vector search, PostgreSQL reliability, and self-hosted deployment.", + extraKeywords: [ + "AI database", + "vector search", + "RAG", + "embeddings", + "open source vector database", + "Mongo API compatible", + "pgvector", + ], +}); + +const quickRunCommand = `docker run -dt --name documentdb \\ + -p 10260:10260 \\ + ghcr.io/documentdb/documentdb/documentdb-local:latest \\ + --username admin --password password`; + +const connectCommand = `mongosh "mongodb://admin:password@localhost:10260/?tls=true&tlsAllowInvalidCertificates=true"`; + +const createIndexCommand = `db.runCommand({ + createIndexes: "documents", + indexes: [{ + key: { embedding: "cosmosSearch" }, + name: "vector_idx", + cosmosSearchOptions: { + kind: "vector-hnsw", + similarity: "COS", + dimensions: 1536 + } + }] +});`; + +const vectorSearchCommand = `db.documents.aggregate([ + { + $vectorSearch: { + queryVector: [0.12, -0.04, 0.31, /* ... 1536 dims */], + path: "embedding", + limit: 10, + numCandidates: 100, + filter: { category: "technical" } + } + } +]);`; + +const heroBadges = [ + "Start locally in minutes", + "Mongo API-compatible", + "Native vector search", + "MIT licensed", +]; + +const beforeAfter = [ + { + title: "Before", + accent: + "border-red-500/20 bg-red-500/5 text-red-200 shadow-[0_24px_80px_-50px_rgba(239,68,68,0.45)]", + heading: "Typical AI stack", + points: [ + "App database for documents and metadata", + "Separate vector database for embeddings", + "Extra data sync and failure modes between systems", + "More moving parts, more cost, more things to break", + ], + }, + { + title: "After", + accent: + "border-emerald-500/20 bg-emerald-500/5 text-emerald-200 shadow-[0_24px_80px_-50px_rgba(16,185,129,0.45)]", + heading: "DocumentDB stack", + points: [ + "BSON documents and embeddings stored together", + "Native vector search with filtering in one database", + "Geospatial, graph, and 40+ aggregation stages in one system", + "Simpler architecture with PostgreSQL-backed operations", + ], + }, +]; + +const quickStartSteps = [ + { + step: "01", + title: "Run locally with Docker", + description: + "One command to start DocumentDB on port 10260 with local credentials.", + label: "Docker", + code: quickRunCommand, + }, + { + step: "02", + title: "Connect with mongosh", + description: + "Connect with mongosh, pymongo, the Node.js driver, or another standard Mongo client.", + label: "Shell", + code: connectCommand, + }, + { + step: "03", + title: "Create a vector index", + description: + "Create a native HNSW vector index with cosine similarity for embedding retrieval.", + label: "Index", + code: createIndexCommand, + }, + { + step: "04", + title: "Query by meaning", + description: + "Retrieve semantically similar results with vector search and optional metadata filters.", + label: "Vector search", + code: vectorSearchCommand, + }, +]; + +const useCases = [ + { + badge: "RAG", + title: "RAG and grounded chat", + description: + "Store chunks, metadata, and embeddings together so retrieval stays close to the source document.", + points: [ + "Pre-filter by category, source, or recency before retrieval", + "Return source text alongside similarity scores", + ], + }, + { + badge: "Search", + title: "Semantic search", + description: + "Search products, knowledge bases, or support histories by meaning instead of exact keyword match.", + points: [ + "Choose cosine, L2, or inner product for your domain", + "Mix vector results with metadata filters in one query", + ], + }, + { + badge: "Agents", + title: "Agent memory", + description: + "Store conversation state as BSON documents and retrieve past context with vector similarity.", + points: [ + "Persist tool outputs, plans, and dialogue turns naturally", + "Recall relevant history without scanning entire threads", + ], + }, + { + badge: "Graph + AI", + title: "Knowledge navigation", + description: + "Find the best vector matches, then traverse related entities with `$graphLookup` in one query pipeline.", + points: [ + "Recursive traversal with depth control", + "Useful when retrieval also needs relationship traversal", + ], + }, +]; + +const credibilityPoints = [ + { + value: "3.2k+", + label: "GitHub stars", + }, + { + value: "200+", + label: "Forks", + }, + { + value: "11", + label: "TSC members", + detail: "across 5 organizations", + }, +]; + +const contributorLogos = [ + { + name: "Microsoft", + src: "/images/AzureLogo.png", + }, + { + name: "Amazon", + src: "/images/AWS%20Logo.png", + }, + { + name: "Rippling", + src: "/images/Rippling%20Logo%20no%20background.png", + }, + { + name: "YugabyteDB", + src: "/images/YugabyteLogo.png", + }, + { + name: "AB InBev", + src: "/images/AB%20InBev%20transparent%20logo.png", + }, +]; + +function SectionIntro({ + eyebrow, + title, + description, +}: { + eyebrow: string; + title: string; + description: string; +}) { + return ( +
+

+ {eyebrow} +

+

+ {title} +

+

{description}

+
+ ); +} + +export default function AIPage() { + return ( +
+
+
+
+
+

+ Easy start for AI teams +

+

+ Stop juggling databases for AI +

+

+ Documents, vectors, and search in one Mongo API-compatible system. +

+

+ Run locally with Docker, use familiar Mongo drivers and tools, and + keep documents plus embeddings together — no extra sync layer needed. +

+
+ + Start with Docker + + + Explore AI/ML Samples + +
+
+ {heroBadges.map((badge) => ( + + {badge} + + ))} +
+
+ +
+
+ + Quick start + + + Vector search in minutes + +
+

+ Start locally with one Docker command +

+

+ Spin up DocumentDB with Docker, then follow the four-step quick + start below to connect with mongosh, create a vector index, and + run your first vector search. +

+
+ +
+
+
+

+ API +

+

Mongo API-compatible

+

+ Use familiar Mongo drivers and tools. +

+
+
+

+ Indexing +

+

HNSW + IVFFlat

+

+ Choose the right vector algorithm for recall, scale, and cost. +

+
+
+

+ Retrieval +

+

Vector search

+

+ Filter by metadata and return similarity scores. +

+
+
+
+
+
+ +
+
+ +
+ {beforeAfter.map((item) => ( +
+ + {item.title} + +

{item.heading}

+
    + {item.points.map((point) => ( +
  • + + {point} +
  • + ))} +
+
+ ))} +
+
+
+ +
+
+ +
+ {quickStartSteps.map((item) => ( +
+
+ + {item.step} + +

+ {item.label} +

+
+

{item.title}

+

{item.description}

+
+ +
+
+ ))} +
+
+ + Follow the full Docker quick start + + + See the Python setup + +
+
+
+ +
+
+ +
+ {useCases.map((item) => ( +
+ + {item.badge} + +

{item.title}

+

{item.description}

+
    + {item.points.map((point) => ( +
  • + + {point} +
  • + ))} +
+
+ ))} +
+
+
+ +
+
+ +
+ {credibilityPoints.map((item) => ( +
+

{item.value}

+

+ {item.label} +

+ {"detail" in item && item.detail && ( +

{item.detail}

+ )} +
+ ))} +
+
+ {contributorLogos.map((logo) => ( +
+ {logo.name} +
+ ))} +
+
+
+ +
+
+

+ Ready to try it? +

+

+ Go from zero to vector search in four commands. Open source, self-hosted, MIT-licensed. +

+
+ + Start with Docker + + + View on GitHub + +
+
+
+
+ ); +} diff --git a/app/components/Navbar.tsx b/app/components/Navbar.tsx index 728b676..5ec97c7 100644 --- a/app/components/Navbar.tsx +++ b/app/components/Navbar.tsx @@ -30,6 +30,7 @@ const navItems: NavItem[] = [ icon: "discord", }, { label: "Docs", href: "/docs", kind: "link" }, + { label: "AI", href: "/ai", kind: "link" }, { label: "Download", href: "/packages", kind: "link" }, { label: "K8s Operator", href: "/kubernetes-operator", kind: "link" }, { label: "Blogs", href: withBasePath("/blogs/"), kind: "anchor" }, diff --git a/app/data/samples.ts b/app/data/samples.ts index 95951df..b415fe0 100644 --- a/app/data/samples.ts +++ b/app/data/samples.ts @@ -62,5 +62,15 @@ export const samples: Sample[] = [ difficulty: 'Intermediate', tags: ['Vector Search', 'Semantic Search', 'Flask', 'Embeddings', 'Ollama', 'Clinical NLP', 'DocumentDB OSS', 'Open Source'], githubUrl: 'https://github.com/documentdb/documentdb-samples-gallery/tree/main/clinical-note-similarity-py', + }, + { + id: 'activity-log-fastapi-py', + title: 'Activity Log & Notification Service: Real-Time Event Ingestion with FastAPI, Beanie, and DocumentDB', + description: 'A production-style async Python backend that ingests high-volume activity events via FastAPI, stores them in DocumentDB using the Beanie ODM over Motor, and exposes endpoints to query recent activities, compute server-side aggregation statistics ($facet pipeline), and stream real-time ERROR alerts to clients over WebSockets.', + language: 'Python', + industry: 'DevOps / Observability', + difficulty: 'Intermediate', + tags: ['FastAPI', 'Beanie', 'Motor', 'REST API', 'WebSocket', 'Aggregation', 'DocumentDB OSS', 'Open Source'], + githubUrl: 'https://github.com/documentdb/documentdb-samples-gallery/tree/main/activity-log-fastapi-py', } ]; diff --git a/app/page.tsx b/app/page.tsx index 143f948..04d6166 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -10,6 +10,16 @@ type CapabilityIconName = | "vector" | "platform"; +type Capability = { + eyebrow: string; + title: string; + description: string; + highlights: string[]; + icon: CapabilityIconName; + href?: string; + linkLabel?: string; +}; + const quickRunCommand = `docker run -dt --name documentdb \\ -p 10260:10260 \\ ghcr.io/documentdb/documentdb/documentdb-local:latest \\ @@ -68,7 +78,7 @@ const whyDocumentDB = [ }, ]; -const capabilities = [ +const capabilities: Capability[] = [ { eyebrow: "Foundation", title: "Document + SQL", @@ -92,6 +102,8 @@ const capabilities = [ "Embeddings and similarity search powered by pgvector.", highlights: ["Embeddings", "Similarity"], icon: "vector" as const, + href: "/ai", + linkLabel: "Explore AI", }, { eyebrow: "Open source", @@ -421,15 +433,25 @@ export default function Home() {

{item.description}

-
- {item.highlights.map((highlight) => ( - +
+ {item.highlights.map((highlight) => ( + + {highlight} + + ))} +
+ {item.href ? ( + - {highlight} -
- ))} + {item.linkLabel} + + ) : null}
))}