> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mem0.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Node SDK Quickstart

> Store and search Mem0 memories from a TypeScript or JavaScript app in minutes.

Spin up Mem0 with the Node SDK in just a few steps. You'll install the package, initialize the client, add a memory, and confirm retrieval with a single search.

## Prerequisites

* Node.js 18 or higher
* (Optional) OpenAI API key stored in your environment when you want to customize providers

## Install and run your first memory

**1. Install the SDK**

```bash theme={null}
npm install mem0ai
```

**2. Initialize the client**

```ts theme={null}
import { Memory } from "mem0ai/oss";

const memory = new Memory();
```

**3. Add a memory**

```ts theme={null}
const messages = [
  { role: "user", content: "I'm planning to watch a movie tonight. Any recommendations?" },
  { role: "assistant", content: "How about thriller movies? They can be quite engaging." },
  { role: "user", content: "I'm not a big fan of thriller movies but I love sci-fi movies." },
  { role: "assistant", content: "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future." }
];

await memory.add(messages, { userId: "alice", metadata: { category: "movie_recommendations" } });
```

**4. Search memories**

```ts theme={null}
const results = await memory.search("What do you know about me?", { filters: { user_id: "alice" } });
console.log(results);
```

**Output**

```json theme={null}
{
  "results": [
    {
      "id": "892db2ae-06d9-49e5-8b3e-585ef9b85b8e",
      "memory": "User is planning to watch a movie tonight.",
      "score": 0.38920719231944799,
      "metadata": {
        "category": "movie_recommendations"
      },
      "userId": "alice"
    }
  ]
}
```

<Snippet file="star-on-github.mdx" />

> [!NOTE]
>
> By default the Node SDK uses local-friendly settings (OpenAI `gpt-5-mini`, `text-embedding-3-small`, in-memory vector store, and SQLite history). Pass a config to swap any of them.

## Configure providers

Pass a config object to `new Memory()` to use your own LLM, embedder, and vector store:

```ts theme={null}
import { Memory } from "mem0ai/oss";

const memory = new Memory({
  llm: {
    provider: "openai",
    config: { apiKey: process.env.OPENAI_API_KEY || "", model: "gpt-4-turbo-preview" }
  },
  embedder: {
    provider: "openai",
    config: { apiKey: process.env.OPENAI_API_KEY || "", model: "text-embedding-3-small" }
  },
  vectorStore: {
    provider: "memory",
    config: { collectionName: "memories", dimension: 1536 }
  }
});
```

For the full provider catalog, history stores, and every config option, see [Configuration](https://docs.mem0.ai/open-source/configuration.md).

## What's next?

> [card] [Memory operations](https://docs.mem0.ai/core-concepts/memory-operations/add.md)
>
> Search, update, and manage memories with the full CRUD API.

> [card] [Configure for production](https://docs.mem0.ai/open-source/configuration.md)
>
> Swap in your own LLM, embedder, and vector store.

> [card] [Add to your framework](https://docs.mem0.ai/integrations.md)
>
> Wire Mem0 into LangChain, CrewAI, LangGraph, and 20+ more.

If you have any questions, please feel free to reach out:

<Snippet file="get-help.mdx" />


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.