█

AI/TLDR

Buy me a coffee
Buy me a coffee

chromem-go

Embeddable in-memory vector database for Go with a Chroma-like interface

Vector DatabasesOpen source
Language
Go
License
MPL-2.0
$go get github.com/philippgille/chromem-go@latest
IN SHORT

What is chromem-go?

chromem-go is a vector database written in Go that you embed directly inside your application, the same way you would use SQLite instead of running PostgreSQL or MySQL. It stores documents and their embeddings in memory, with optional persistence, and has zero third-party dependencies. It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Go and licensed MPL-2.0.

Overview

chromem-go is a vector database written in Go that you embed directly inside your application, the same way you would use SQLite instead of running PostgreSQL or MySQL. It stores documents and their embeddings in memory, with optional persistence, and has zero third-party dependencies.

It is aimed at Go developers who want to add retrieval augmented generation (RAG), text and code search, recommendations, or classification to an app without standing up and maintaining a separate database service. Its API mirrors Chroma's core interface, so the create-collection, add, and query flow is familiar, while also offering more Go-idiomatic methods.

Within the embedded / in-process vector database category, chromem-go trades very large scale and a wide feature set for simplicity and good performance on common workloads. The README reports querying 1,000 documents in about 0.3 ms and 100,000 documents in about 40 ms on a mid-range 2020 laptop CPU. Note that it is in beta and may introduce breaking changes before v1.0.0.

What it does

  • Embeddable like SQLite: no client-server model and no separate database to run or maintain
  • Chroma-like interface with CreateCollection, GetOrCreateCollection, Add, and Query methods
  • Zero dependencies on third-party libraries
  • In-memory storage with optional persistence
  • Built-in embedding support for multiple providers and models, so you can pass plain text and let it create embeddings (or supply your own)
  • Metadata and document-content filters on queries, plus concurrent adds via AddConcurrently

Getting started

Install the module, then create a database, add documents to a collection, and run a nearest-neighbor query.

Install

Add chromem-go to your Go module.

bashbash
go get github.com/philippgille/chromem-go@latest

Create a DB and collection

Set up an in-memory database and a collection to hold your documents.

gogo
package main

import "github.com/philippgille/chromem-go"

func main() {
    db := chromem.NewDB()
    collection, _ := db.CreateCollection("all-my-documents", nil, nil)
}

Add documents and query

Add documents (embeddings are created for you when you pass nil), then query for the most similar results. Optional metadata and content filters are supported.

gogo
_ = collection.Add(ctx,
    []string{"doc1", "doc2"}, // unique ID for each doc
    nil,                       // embeddings handled automatically, or supply your own
    []map[string]string{{"source": "notion"}, {"source": "google-docs"}},
    []string{"This is document1", "This is document2"},
)

results, _ := collection.Query(ctx,
    "This is a query document",
    2,
    map[string]string{"metadata_field": "is_equal_to_this"}, // optional filter
    map[string]string{"$contains": "search_string"},          // optional filter
)

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Add retrieval augmented generation (RAG) or question answering to a Go app without running a separate vector database service
  • Build text or code search over a local document set inside a single binary
  • Power recommendation features from embeddings stored in-process
  • Run classification or clustering experiments where embedding millions of documents is not required

How chromem-go compares

chromem-go alongside other open-source vector databases tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Supabase★ 116kManaged Postgres backend whose Vector toolkit (pgvector) stores, indexes, and queries embeddings next to transactional data.
Redis Cloud★ 77.8kFully-managed Redis with built-in vector search, offering low-latency similarity and hybrid queries over any embeddings.
Milvus★ 46.8kA distributed vector database for storing and searching billions of embeddings at scale, with multiple index types and Kubernetes-native deployment.
FAISS★ 42kA library from Meta for efficient similarity search and clustering of dense vectors, with both exact and approximate indexes.
Qdrant★ 35.8kA Rust-based vector search engine that stores embeddings with rich payload filtering for semantic search and recommendation systems.
Chroma★ 29.8kA developer-focused vector database designed for quickly building retrieval and RAG features with a simple Python and JavaScript API.
pgvector★ 23.9kA PostgreSQL extension that adds a vector data type and similarity search so you can store and query embeddings inside an existing Postgres database.
chromem-go★ 1.1kEmbeddable in-memory vector database for Go with a Chroma-like interface