
Deploy MemMachine
Memory layer for AI agents: REST and MCP API with Postgres and Qdrant
Just deployed
/var/lib/postgresql/data
Just deployed
/qdrant/data
MemMachine
Just deployed
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
/mcpendpoint - 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
MemMachine
aalfath/memmachine-railway-templateOPENAI_API_KEY
API key for your model provider (OpenAI by default). MemMachine checks it at startup and stops without a working key.

