Deploy & Host Mem0 | Railway

Deploy and Host Mem0 on Railway

Mem0 is an open-source memory layer for AI agents and assistants. It extracts facts from conversations with an LLM, stores them as vector embeddings, and returns the relevant memories for each user, agent or session when you search. Apps use it through its REST API or the official Python and TypeScript SDKs.

About Hosting Mem0

This template deploys the Mem0 v2.2.0 self-hosted server, its web dashboard and a Railway Postgres database. Memories are stored with pgvector, which Railway's Postgres already includes. Users and API keys live in a second database created on first start. You must provide an OpenAI API key when deploying; LLM and embedding calls are billed by OpenAI. The first account registered in the dashboard becomes admin, and registration then closes, so register right after deploying. The API also accepts a generated admin API key. Telemetry is off. The memory history database is kept on a small volume.

Common Use Cases

Dependencies for Mem0 Hosting

Deployment Dependencies

Implementation Details

Service Source Networking Storage
mem0 repo, Dockerfile public API on 8000; private IPv4/IPv6 volume at /app/history
dashboard repo, dashboard/Dockerfile public domain on 3000 none
Postgres Railway Postgres 18 (pgvector) private only volume

Add and search memories:

curl -X POST "$MEM0_API_URL/memories" -H "X-API-Key: $ADMIN_API_KEY" -H "Content-Type: application/json" \
  -d '{"messages": [{"role": "user", "content": "I prefer dark roast coffee"}], "user_id": "alice"}'
curl -X POST "$MEM0_API_URL/search" -H "X-API-Key: $ADMIN_API_KEY" -H "Content-Type: application/json" \
  -d '{"query": "What coffee does Alice like?", "user_id": "alice"}'

From another Railway service, use ${{mem0.MEM0_PRIVATE_URL}}. Create per-user API keys in the dashboard instead of sharing the admin key. Interactive API docs are at /docs on the API domain.

Variable Service Default Purpose
OPENAI_API_KEY mem0 none (required) LLM and embeddings
ADMIN_API_KEY mem0 generated secret Admin access via X-API-Key
JWT_SECRET mem0 generated secret Signs dashboard login tokens
MEM0_TELEMETRY mem0 false Upstream anonymous telemetry
RAILWAY_DOCKERFILE_PATH dashboard dashboard/Dockerfile Builds the dashboard image

Notes:

This is a community-maintained deployment package and does not imply affiliation with or endorsement by Mem0.

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