---
title: "Deploy Hindsight"
description: "Self-hosted long-term memory for AI agents: API, web UI and pgvector"
category: "AI/ML"
url: https://railway.com/deploy/hindsight-1
---

# Deploy Hindsight

Self-hosted long-term memory for AI agents: API, web UI and pgvector

**[Deploy Hindsight on Railway](https://railway.com/template/hindsight-1)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/hindsight-1/manifest.json

- **Creator:** Agaz Self-Host
- **Category:** AI/ML

## Template content

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### hindsight-api https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/hindsight.png

- **Source:** https://github.com/aalfath/hindsight-railway-template
- **Health check:** /health
- **Public domain:** Yes

### hindsight-control-plane https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/hindsight.png

- **Source:** https://github.com/aalfath/hindsight-railway-template
- **Health check:** /api/health
- **Public domain:** Yes

## Documentation

# Deploy and Host Hindsight on Railway

Hindsight is an open-source (MIT) memory server for AI agents from Vectorize. Agents store what they learn with **retain**, fetch it with **recall** (semantic, keyword, graph and time search with reranking) and ask questions over it with **reflect**. It has a REST API, an MCP endpoint, Python and TypeScript SDKs, and a web UI.

## About Hosting Hindsight

Hindsight needs PostgreSQL with the pgvector extension, the API server and, for a UI, the separate Control Plane app. This template deploys all three on Railway's private network. The API runs the official full image, which bundles the local embedding and reranker models, so recall works without any outside service. It runs database migrations and background work on start and stores everything in Postgres on a volume. API-key authentication is on from the first deploy, and the web UI asks for its own generated access key. Add an LLM API key for fact extraction and reflect. Without one, Hindsight still stores and recalls memories. Each service builds from a public GitHub repo, so you get update notices.

## Common Use Cases

* Long-term memory for chatbots, support agents and coding assistants, shared across sessions and users
* A memory server for MCP clients such as Claude Code, Cursor or other agent frameworks
* A private, self-hosted alternative to managed agent-memory services, with your data in your own Postgres

## Dependencies for Hindsight Hosting

* PostgreSQL with pgvector (Railway's PostgreSQL, included)
* Optional: an API key for an LLM provider (OpenAI, Anthropic, Gemini, Groq, OpenRouter, an Ollama server and others)

### Deployment Dependencies

* Hindsight source and releases: https://github.com/vectorize-io/hindsight/releases (this template runs 1.2.1)
* Installation and services: https://hindsight.vectorize.io/developer/installation
* Configuration reference: https://hindsight.vectorize.io/developer/configuration
* Template repository: https://github.com/aalfath/hindsight-railway-template

### Implementation Details

Services:

* **hindsight-api**: the memory API, MCP endpoint and built-in background worker (`ghcr.io/vectorize-io/hindsight-api:1.2.1`, about 1.8 GB RAM at idle because of the local models). Public, and every request needs `Authorization: Bearer HINDSIGHT_API_TENANT_API_KEY`. Health check `/health`.
* **hindsight-control-plane**: the web UI (`ghcr.io/vectorize-io/hindsight-control-plane:1.2.1`). Public, login with `HINDSIGHT_CP_ACCESS_KEY`. It calls the API over the private network. Health check `/api/health`.
* **Postgres**: Railway PostgreSQL 18 with pgvector, on a volume. Private only.

After deploy:

1. Open the `hindsight-control-plane` URL and log in with the `HINDSIGHT_CP_ACCESS_KEY` value from that service's Variables tab.
2. To use the API, copy `HINDSIGHT_API_TENANT_API_KEY` from `hindsight-api` and try it:

```
curl -X POST "https://YOUR-API-DOMAIN/v1/default/banks/my-bank/memories" \
  -H "Authorization: Bearer YOUR-API-KEY" -H "Content-Type: application/json" \
  -d '{"items":[{"content":"Ada works at Railway and loves hiking."}]}'
curl -X POST "https://YOUR-API-DOMAIN/v1/default/banks/my-bank/memories/recall" \
  -H "Authorization: Bearer YOUR-API-KEY" -H "Content-Type: application/json" \
  -d '{"query":"Where does Ada work?"}'
```

3. For fact extraction, observations and reflect, set `HINDSIGHT_API_LLM_API_KEY` (and `HINDSIGHT_API_LLM_PROVIDER` if it isn't OpenAI) on `hindsight-api`. Other settings such as `HINDSIGHT_API_LLM_MODEL` or `HINDSIGHT_API_LLM_BASE_URL` are listed in the configuration reference.

Updates: when a new Hindsight release is tested, the template repo's pinned version moves on `main` and Railway shows you an update notice. Read the repo's CHANGELOG before you apply it: the API migrates the database on start.

## Why Deploy Hindsight 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 Hindsight on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.



## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/hindsight-1
