Deploy MemMachine

Memory layer for AI agents: REST and MCP API with Postgres and Qdrant

Deploy MemMachine

/var/lib/postgresql/data

/qdrant/data

Deploy and Host MemMachine on Railway

MemMachine is an open-source memory layer for AI agents. It stores conversation episodes and user profile facts and returns the relevant ones when an agent asks, so assistants remember people, preferences and past sessions. Agents use it through a REST API, an MCP server, or the Python and TypeScript clients.

About Hosting MemMachine

This template runs MemMachine v0.4.0 as three services on Railway's private network. MemMachine serves the REST API and MCP endpoint on its public domain, behind a small Caddy gate that requires a generated API key, because MemMachine has no login of its own. Qdrant stores the vectors for long-term episodic memory. Postgres holds episodes, sessions, projects and profile memory; MemMachine migrates it on boot. MemMachine waits for both databases before it starts. Every app service builds from a public GitHub repo that pins the official images by version and digest, and Qdrant and Postgres keep their data on volumes.

Common Use Cases

  • Long-term memory for chatbots and agents that should remember users across sessions
  • Shared memory for Claude, Cursor or other MCP clients through the /mcp endpoint
  • User profile extraction (preferences, facts) for personalised assistants
  • A self-hosted alternative to hosted memory APIs, with your own model provider

Dependencies for MemMachine Hosting

  • PostgreSQL (included, Railway Postgres with pgvector)
  • Qdrant (included, private service)
  • An OpenAI API key, or a key for any OpenAI-compatible provider

Deployment Dependencies

Implementation Details

The only prompt is OPENAI_API_KEY. MemMachine checks the embedding model and the LLM at startup and stops with an AuthenticationError if the key doesn't work. For another OpenAI-compatible provider, set OPENAI_BASE_URL, LLM_MODEL and EMBEDDING_MODEL on the MemMachine service (and EMBEDDING_DIMENSIONS if the vectors aren't 1536 long) before you store memories.

After deploy, copy MEMMACHINE_API_KEY from the MemMachine service's Variables tab and send it as Authorization: Bearer YOUR-KEY:

curl -X POST https://YOUR-DOMAIN/api/v2/memories/search \
  -H "Authorization: Bearer YOUR-KEY" -H "content-type: application/json" \
  -d '{"org_id":"acme","project_id":"demo","query":"Where does Alice live?"}'

In Python, use MemMachineClient(api_key=..., base_url="https://YOUR-DOMAIN"). MCP clients connect to https://YOUR-DOMAIN/mcp/ with the same header. /api/v2/health and the API docs at /docs are public; everything else needs the key.

Not included: Neo4j, which upstream uses only for the alternative declarative memory backend (this template runs the default event backend on Qdrant and Postgres), and upstream's local docs site.

Updates: the services build from the template repo's main branch. When we bump MemMachine or Qdrant there, Railway shows you an update notice and you choose when to apply it. Read the repo's CHANGELOG.md first.

Why Deploy MemMachine 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 MemMachine 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.


Template Content

More templates in this category

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

okisdev
117
View Template
Weaviate
Vector database with hybrid search and an API key-protected API

GitHub Locker
1
View Template
Möbius Personal AI OS
Self-hosted AI agent that builds and runs apps for you, with memory.

Tracklayer
1