Use this guide to run XMem on your own machine.
Choose the view that matches you:
- Every User: the quickest path to run XMem locally and use the Chrome extension.
- Developer View: details for contributors, debugging, manual startup, ports, and environment setup.
This path is for anyone who wants to install XMem locally and start using it.
Install these first:
- Git
- Node.js 20 or newer
- Python 3.11 or newer
- Docker Desktop
- Chrome or another Chromium-based browser
- Ollama, unless you plan to use a cloud LLM key
git clone https://github.com/XortexAI/XMem.git
cd XMemIf you already have the repository, open a terminal in the XMem repository root.
Use this if you want XMem to run without cloud LLM calls.
Start Docker Desktop and Ollama, then run:
npm run setupXMem will use:
qwen2.5:1.5bfor chatnomic-embed-textfor embeddings- Local Postgres with pgvector for vector storage
Use this if you want XMem to use Gemini, Claude, OpenAI, OpenRouter, or Bedrock.
Create .env from the local template.
PowerShell:
Copy-Item templates\xmem.env.local .env
notepad .envmacOS or Linux:
cp templates/xmem.env.local .env
${EDITOR:-nano} .envAdd at least one real provider key:
GEMINI_API_KEY=
CLAUDE_API_KEY=
OPENAI_API_KEY=
OPENROUTER_API_KEY=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=Then run:
npm run setupWhen a cloud key is present, XMem uses that provider for LLM calls and uses FastEmbed locally for embeddings. Ollama is not required in this mode.
npm run startThe API runs at:
http://localhost:8000
You can check the API in your browser:
http://localhost:8000/health
The setup is ready when the health response includes:
{
"pipelines_ready": true
}In another terminal, run:
npm run verifyIf anything fails, run:
npm run doctorAfter setup, the built extension is available at:
repos/xmem-extension/dist
Load it in Chrome:
- Open
chrome://extensions - Enable Developer mode
- Click Load unpacked
- Select
repos/xmem-extension/dist
Use these extension settings:
API URL: http://localhost:8000
API Key: dev-xmem-key
User ID: any stable local user id
npm run setup
npm run start
npm run verify
npm run doctorUse this shortcut on the first run:
npm run devnpm run dev runs setup automatically if needed, then starts the API.
This path is for contributors and anyone who wants to understand or customize the local environment.
npm run setup prepares the full local workspace:
- Creates
.envfromtemplates/xmem.env.localif it does not exist - Detects cloud LLM keys and configures routing
- Starts local Postgres, MongoDB, and Neo4j containers
- Creates a Python virtual environment in
.venv - Installs XMem with local and development dependencies
- Clones and builds the Chrome extension in
repos/xmem-extension - Pulls Ollama models when local Ollama mode is enabled
The default local setup uses these ports:
| Service | URL or Port | Purpose |
|---|---|---|
| XMem API | http://localhost:8000 |
Backend API |
| Postgres/pgvector | localhost:15432 |
Vector store and app metadata |
| MongoDB | localhost:27018 |
Document storage |
| Neo4j Browser | http://localhost:17474 |
Graph database UI |
| Neo4j Bolt | localhost:17687 |
Graph database connection |
Neo4j local credentials:
Username: neo4j
Password: local-password
The local template lives at:
templates/xmem.env.local
Common values:
API_PORT=8000
API_KEYS='["dev-xmem-key"]'
VECTOR_STORE_PROVIDER=pgvector
PGVECTOR_URL=postgresql://xmem:xmem@localhost:15432/xmem
APP_STORE_PROVIDER=postgres
APP_POSTGRES_URL=postgresql://xmem:xmem@localhost:15432/xmem
MONGODB_URI=mongodb://localhost:27018
NEO4J_URI=bolt://localhost:17687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=local-passwordFully local LLM routing:
FALLBACK_ORDER='["ollama"]'
EMBEDDING_PROVIDER=ollama
OLLAMA_MODEL=qwen2.5:1.5b
OLLAMA_EMBEDDING_MODEL=nomic-embed-text
PINECONE_DIMENSION=768Cloud LLM routing switches embeddings to FastEmbed:
EMBEDDING_PROVIDER=fastembed
FASTEMBED_MODEL=BAAI/bge-small-en-v1.5
PINECONE_DIMENSION=384Restart the API after changing .env.
Most users should use npm run setup and npm run start. For manual backend
startup, run:
docker compose -f docker-compose.local.yml up -d
python -m venv .venvActivate the virtual environment.
PowerShell:
.\.venv\Scripts\Activate.ps1macOS or Linux:
source .venv/bin/activateInstall dependencies and start the API:
pip install -e ".[local,dev]"
python -m uvicorn src.api.app:create_app --factory --host 0.0.0.0 --port 8000npm run setup
npm run dev
npm run start
npm run verify
npm run doctorSkip Docker startup if the containers are already running:
npm run start -- --skip-dockerSkip Ollama model pulls during setup:
npm run setup -- --skip-model-pullSkip extension dependency installation and build:
npm run setup -- --skip-node-installSkip Python dependency installation:
npm run setup -- --skip-python-installIf Docker containers do not start, make sure Docker Desktop is running, then run:
npm run setupIf Ollama is required but missing models, run:
ollama pull qwen2.5:1.5b
ollama pull nomic-embed-textIf the API starts but /health stays in loading, wait a minute for pipelines
to initialize, then run:
npm run doctorIf the Chrome extension cannot connect, confirm:
- The API is running at
http://localhost:8000 - The extension API URL is
http://localhost:8000 - The extension API key is
dev-xmem-key /healthreportspipelines_ready: true
If you changed .env, stop and restart the API.