Doc : Update Readme Docs for OpenMemory environment setup (#2913)
This commit is contained in:
@@ -38,22 +38,75 @@ We suggest you follow the instructions below to set up OpenMemory on your local
|
|||||||
Getting started with OpenMemory is straight forward and takes just a few minutes to set up on your local machine. Follow these steps:
|
Getting started with OpenMemory is straight forward and takes just a few minutes to set up on your local machine. Follow these steps:
|
||||||
|
|
||||||
### Getting started
|
### Getting started
|
||||||
First clone the repository and then follow the instructions:
|
|
||||||
|
|
||||||
|
### 1. First clone the repository and then follow the instructions:
|
||||||
```bash
|
```bash
|
||||||
# Clone the repository
|
# Clone the repository
|
||||||
git clone https://github.com/mem0ai/mem0.git
|
git clone https://github.com/mem0ai/mem0.git
|
||||||
cd mem0/openmemory
|
cd mem0/openmemory
|
||||||
|
|
||||||
# Create the backend .env file with your OpenAI key
|
|
||||||
make env
|
|
||||||
|
|
||||||
# Build the Docker images
|
|
||||||
make build
|
|
||||||
|
|
||||||
# Start all services (API server, vector database, and MCP server components)
|
|
||||||
make up
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 2. Set Up Environment Variables
|
||||||
|
|
||||||
|
Before running the project, you need to configure environment variables for both the API and the UI.
|
||||||
|
|
||||||
|
You can do this in one of the following ways:
|
||||||
|
|
||||||
|
- **Manually**:
|
||||||
|
Create a `.env` file in each of the following directories:
|
||||||
|
- `/api/.env`
|
||||||
|
- `/ui/.env`
|
||||||
|
|
||||||
|
- **Using `.env.example` files**:
|
||||||
|
Copy and rename the example files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp api/.env.example api/.env
|
||||||
|
cp ui/.env.example ui/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Using Makefile** (if supported):
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make env
|
||||||
|
```
|
||||||
|
- #### Example `/api/.env`
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
OPENAI_API_KEY=sk-xxx
|
||||||
|
USER=<user-id> # The User Id you want to associate the memories with
|
||||||
|
```
|
||||||
|
- #### Example `/ui/.env`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NEXT_PUBLIC_API_URL=http://localhost:8765
|
||||||
|
NEXT_PUBLIC_USER_ID=<user-id> # Same as the user id for environment variable in api
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Build and Run the Project
|
||||||
|
You can run the project using the following two commands:
|
||||||
|
```bash
|
||||||
|
make build # builds the mcp server and ui
|
||||||
|
make up # runs openmemory mcp server and ui
|
||||||
|
```
|
||||||
|
|
||||||
|
After running these commands, you will have:
|
||||||
|
- OpenMemory MCP server running at: http://localhost:8765 (API documentation available at http://localhost:8765/docs)
|
||||||
|
- OpenMemory UI running at: http://localhost:3000
|
||||||
|
|
||||||
|
#### UI not working on http://localhost:3000?
|
||||||
|
|
||||||
|
If the UI does not start properly on http://localhost:3000, try running it manually:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ui
|
||||||
|
pnpm install
|
||||||
|
pnpm dev
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
You can configure the MCP client using the following command (replace username with your username):
|
You can configure the MCP client using the following command (replace username with your username):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -37,6 +37,45 @@ curl -sL https://raw.githubusercontent.com/mem0ai/mem0/main/openmemory/run.sh |
|
|||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
|
### 1. Set Up Environment Variables
|
||||||
|
|
||||||
|
Before running the project, you need to configure environment variables for both the API and the UI.
|
||||||
|
|
||||||
|
You can do this in one of the following ways:
|
||||||
|
|
||||||
|
- **Manually**:
|
||||||
|
Create a `.env` file in each of the following directories:
|
||||||
|
- `/api/.env`
|
||||||
|
- `/ui/.env`
|
||||||
|
|
||||||
|
- **Using `.env.example` files**:
|
||||||
|
Copy and rename the example files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp api/.env.example api/.env
|
||||||
|
cp ui/.env.example ui/.env
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Using Makefile** (if supported):
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make env
|
||||||
|
```
|
||||||
|
- #### Example `/api/.env`
|
||||||
|
|
||||||
|
```env
|
||||||
|
OPENAI_API_KEY=sk-xxx
|
||||||
|
USER=<user-id> # The User Id you want to associate the memories with
|
||||||
|
```
|
||||||
|
- #### Example `/ui/.env`
|
||||||
|
|
||||||
|
```env
|
||||||
|
NEXT_PUBLIC_API_URL=http://localhost:8765
|
||||||
|
NEXT_PUBLIC_USER_ID=<user-id> # Same as the user id for environment variable in api
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Build and Run the Project
|
||||||
You can run the project using the following two commands:
|
You can run the project using the following two commands:
|
||||||
```bash
|
```bash
|
||||||
make build # builds the mcp server and ui
|
make build # builds the mcp server and ui
|
||||||
@@ -47,6 +86,17 @@ After running these commands, you will have:
|
|||||||
- OpenMemory MCP server running at: http://localhost:8765 (API documentation available at http://localhost:8765/docs)
|
- OpenMemory MCP server running at: http://localhost:8765 (API documentation available at http://localhost:8765/docs)
|
||||||
- OpenMemory UI running at: http://localhost:3000
|
- OpenMemory UI running at: http://localhost:3000
|
||||||
|
|
||||||
|
#### UI not working on `localhost:3000`?
|
||||||
|
|
||||||
|
If the UI does not start properly on [http://localhost:3000](http://localhost:3000), try running it manually:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ui
|
||||||
|
pnpm install
|
||||||
|
pnpm dev
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
- `api/` - Backend APIs + MCP server
|
- `api/` - Backend APIs + MCP server
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
OPENAI_API_KEY=sk-xxx
|
OPENAI_API_KEY=sk-xxx
|
||||||
|
USER=user
|
||||||
@@ -10,7 +10,7 @@ interface ProfileState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const initialState: ProfileState = {
|
const initialState: ProfileState = {
|
||||||
userId: process.env.NEXT_PUBLIC_USER_ID || 'deshraj',
|
userId: process.env.NEXT_PUBLIC_USER_ID || 'user',
|
||||||
totalMemories: 0,
|
totalMemories: 0,
|
||||||
totalApps: 0,
|
totalApps: 0,
|
||||||
status: 'idle',
|
status: 'idle',
|
||||||
@@ -36,7 +36,7 @@ const profileSlice = createSlice({
|
|||||||
resetProfileState: (state) => {
|
resetProfileState: (state) => {
|
||||||
state.status = 'idle';
|
state.status = 'idle';
|
||||||
state.error = null;
|
state.error = null;
|
||||||
state.userId = process.env.NEXT_PUBLIC_USER_ID || 'deshraj';
|
state.userId = process.env.NEXT_PUBLIC_USER_ID || 'user';
|
||||||
},
|
},
|
||||||
setTotalMemories: (state, action: PayloadAction<number>) => {
|
setTotalMemories: (state, action: PayloadAction<number>) => {
|
||||||
state.totalMemories = action.payload;
|
state.totalMemories = action.payload;
|
||||||
|
|||||||
Reference in New Issue
Block a user