Railway

Deploy Chroma — Self-Hosted AI Vector Database

Self-host Chroma — vector database for RAG & semantic search

Deploy Chroma — Self-Hosted AI Vector Database

Just deployed

/data

Deploy and Host Chroma on Railway

Chroma is the open-source, AI-native vector database — a self-hosted Pinecone alternative for storing and searching embeddings, and the backbone of RAG pipelines, semantic search, and LLM memory. It's the default vector store in LangChain tutorials and natively integrated with LlamaIndex and Haystack, so it drops into almost any AI stack. This template deploys the official Chroma image with a persistent volume and token authentication already configured — the two things a naive Chroma deploy gets wrong — so your embeddings survive redeploys and your database isn't left open.


What This Template Deploys

ServicePurpose
ChromaThe vector database server and REST API on port 8000

A single lightweight service. A persistent volume holds your collections, embeddings, and the SQLite metadata, so nothing is lost on redeploy. Token authentication is enabled so the database isn't publicly writable.


About Hosting

Chroma is simple to run, but two specifics separate a working production instance from a broken or insecure one — both handled here.

Persist the volume, or you lose your entire database on redeploy. This is the number-one Chroma production failure: without a mounted volume, all embeddings and the SQLite metadata live in the container filesystem and are wiped on every redeploy. This template mounts a volume at the persist directory and sets IS_PERSISTENT=TRUE, so your collections and vectors survive deployments. Re-embedding a large corpus is slow and costly — this is the setting that prevents that pain.

Token auth is off by default — this template turns it on. Out of the box, Chroma runs with no authentication, so a public deployment is an open, writable vector database anyone can read or overwrite. This template sets CHROMA_SERVER_AUTHN_PROVIDER to the token provider and generates a secret CHROMA_SERVER_AUTHN_CREDENTIALS bearer token, so only clients sending that token in the Authorization header can connect.

It binds to all interfaces for Railway. CHROMA_SERVER_HOST=0.0.0.0 lets Railway route traffic, with automatic HTTPS on the public endpoint. For service-to-service use, connect over Railway's private network to keep traffic internal and free.

Drops into LangChain and LlamaIndex. Chroma is the de facto default vector store for both. Install langchain-chroma or llama-index-vector-stores-chroma, point the host at your Railway domain, pass your bearer token, and your RAG pipeline has a persistent, self-hosted vector store — no per-vector cloud fees. ANONYMIZED_TELEMETRY=FALSE disables Chroma's anonymous usage reporting.

Typical cost: ~$5–10/month on Railway for the service and storage, scaling with your embedding volume. Chroma is Apache-2.0 licensed and free — versus Pinecone's per-vector, per-query pricing that climbs fast as your data grows.


How It Compares

Chroma (self-hosted)PineconeQdrantpgvector
Cost modelFlat infraPer vector/queryFlat infraFlat infra
SetupOne clickManagedOne clickAdd to Postgres
LangChain/LlamaIndexDefault storeSupportedSupportedSupported
Data ownershipFull — your infraVendorFullFull
Best forFast RAG prototyping → prodManaged scaleLarge-scale prodExisting Postgres
Self-hostableYesNoYesYes

Pinecone is fully managed but bills per vector and query and keeps your data on its servers. Qdrant targets very large-scale production. pgvector is great if you already run Postgres. Chroma's edge is developer experience — it's the default vector store in LangChain, trivially easy to use, and scales from prototype to production — self-hosted here at flat cost with your embeddings on infrastructure you own.


Deploy in Under 5 Minutes

  1. Click Deploy on Railway — Chroma builds with the volume and auth configured (~2 minutes)
  2. Confirm the volume is mounted and IS_PERSISTENT=TRUE
  3. Copy your bearer token from the CHROMA_SERVER_AUTHN_CREDENTIALS variable
  4. Grab your Railway public domain (or use the private URL for service-to-service)
  5. Connect with the Chroma client, LangChain, or LlamaIndex, passing the token in the Authorization header

Create a collection, add embeddings, and run your first similarity search.


Common Use Cases

  • RAG pipelines — store document embeddings and retrieve relevant chunks to ground LLM responses
  • Semantic search — search by meaning instead of keywords across documents, products, or content
  • LLM / agent memory — give chatbots and agents long-term memory backed by a vector store
  • Knowledge bases — power an AI assistant over your own documents, self-hosted and private
  • Multi-modal search — store text, image, and other embeddings in one collection

Configuration

VariableRequiredDescription
IS_PERSISTENTPre-setTRUE — persists data to the mounted volume (critical)
PERSIST_DIRECTORYPre-setThe volume path where collections and metadata are stored
CHROMA_SERVER_AUTHN_PROVIDERPre-setToken auth provider — secures the database
CHROMA_SERVER_AUTHN_CREDENTIALSPre-setYour secret bearer token — pass it from clients
CHROMA_SERVER_HOSTPre-set0.0.0.0 so Railway can route to it
ANONYMIZED_TELEMETRYPre-setFALSE to disable usage reporting
PORTPre-set8000 — the Chroma REST API

Persist the volume — it's your whole database. Without the mounted volume and IS_PERSISTENT=TRUE, every redeploy wipes your embeddings and metadata. This template mounts it, so re-embedding your corpus is never forced on you.

Keep the auth token — Chroma is open by default. This template enables token auth and generates CHROMA_SERVER_AUTHN_CREDENTIALS. Pass that token in the Authorization header from your clients, and keep it secret.


Dependencies for Chroma Hosting

  • Railway account — ~$5–10/month, scaling with embedding volume
  • A persistent Railway volume for collections and metadata (included)
  • An embedding model (OpenAI, a local model, or Chroma's built-in functions) to generate vectors
  • A Chroma client, LangChain, or LlamaIndex in your application

Deployment Dependencies

Implementation Details

The template runs the official chromadb/chroma image as a single service on port 8000, with a persistent volume mounted at the persist directory and IS_PERSISTENT=TRUE, so collections, embeddings, and the SQLite metadata survive redeploys — addressing the most common Chroma production failure, data loss from an unmounted container filesystem.

Token authentication is enabled by default: CHROMA_SERVER_AUTHN_PROVIDER is set to the token provider and a secret CHROMA_SERVER_AUTHN_CREDENTIALS bearer token is generated, so the database isn't publicly writable and clients must send the token in the Authorization header. CHROMA_SERVER_HOST=0.0.0.0 allows Railway to route traffic, with automatic HTTPS on the public endpoint and private networking for service-to-service connections, and ANONYMIZED_TELEMETRY=FALSE disables usage reporting. Chroma is the default vector store in LangChain and natively supported by LlamaIndex and Haystack. Embeddings are generated by your chosen model and stored for fast similarity search using cosine or Euclidean distance. All data persists on the volume, which is the component to back up.


Frequently Asked Questions

Why does Chroma need a volume? Because without one, all your embeddings and metadata live in the container filesystem and are wiped on every redeploy. Mounting a volume with IS_PERSISTENT=TRUE keeps your collections across deployments — this template does it, preventing the most common Chroma data-loss failure.

Is my database secured? Yes. This template enables token authentication and generates a bearer token in CHROMA_SERVER_AUTHN_CREDENTIALS. Pass it in the Authorization header from clients. By default Chroma has no auth, so this is important on a public endpoint.

Does it work with LangChain and LlamaIndex? Yes — Chroma is the default vector store for both. Install langchain-chroma or llama-index-vector-stores-chroma, point the host at your Railway domain, and pass your token.

What can I build with it? RAG pipelines, semantic search, chatbot and agent memory, recommendation systems, and knowledge bases — anything needing fast similarity search over embeddings.

Does my data persist? Yes, on the mounted volume — collections, embeddings, and metadata survive redeploys. Back it up, since re-embedding a large corpus is slow and costly.

How does it compare to Pinecone? Pinecone is managed but bills per vector and query and holds your data. Chroma self-hosted is flat-cost, keeps embeddings on your infrastructure, and is the easier, framework-default choice for most RAG apps.


Why Deploy Chroma on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Chroma on Railway you get an AI vector database with the two hard parts solved — the volume persisted so your embeddings survive redeploys, and token auth enabled so it isn't open — plus automatic HTTPS. The default vector store for RAG and semantic search, self-hosted on infrastructure you own.


Template Content

More templates in this category

View Template
Chat Chat
Chat Chat, your own unified chat and search to AI platform.

okisdev
113
View Template
stella
Self-host stella with web, API, Postgres, Redis, and object storage.

Jan Kubica
1
View Template
Hermes Agent | OpenClaw Alternative with Dashboard
Self-Hosted Hermes AI Agent for Telegram, Discord & Slack

codestorm
56