Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------
# Backend Server Settings
# --------------------------------------------
OM_PORT=8080
OM_PORT=18080

# API Authentication (IMPORTANT: Set a strong API key for production!)
# Generate a secure key: openssl rand -base64 32
Expand Down
19 changes: 19 additions & 0 deletions .env.project.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# OpenMemory (project-scoped instance)
#
# Copy to `.env.project.<name>` and customize.
# Start:
# docker compose --project-name om_<name> --env-file .env.project.<name> up -d --build openmemory

OM_PORT=18080
# Generate: openssl rand -base64 32
OM_API_KEY=change-me

OM_MODE=standard
OM_TIER=hybrid
OM_EMBEDDINGS=synthetic
OM_EMBEDDING_FALLBACK=synthetic

OM_METADATA_BACKEND=sqlite
OM_VECTOR_BACKEND=sqlite
OM_DB_PATH=/data/openmemory.sqlite

18 changes: 18 additions & 0 deletions .env.team.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# OpenMemory (team-shared instance)
#
# This is an explicit shared memory instance (opt-in).
# Copy to `.env.team` and customize.

OM_PORT=18081
# Generate: openssl rand -base64 32
OM_API_KEY=change-me

OM_MODE=standard
OM_TIER=hybrid
OM_EMBEDDINGS=synthetic
OM_EMBEDDING_FALLBACK=synthetic

OM_METADATA_BACKEND=sqlite
OM_VECTOR_BACKEND=sqlite
OM_DB_PATH=/data/openmemory.sqlite

4 changes: 2 additions & 2 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
run: |
max_attempts=30
attempt=0
until curl -f http://localhost:8080/health || [ $attempt -eq $max_attempts ]; do
until curl -f http://localhost:18080/health || [ $attempt -eq $max_attempts ]; do
echo "Waiting for service to be healthy... (attempt $((attempt+1))/$max_attempts)"
sleep 2
attempt=$((attempt+1))
Expand All @@ -60,7 +60,7 @@ jobs:
fi

echo "✅ Service is healthy!"
curl -v http://localhost:8080/health
curl -v http://localhost:18080/health

- name: Show Container Logs
if: failure()
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/publish-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.js_changed == 'true' || github.event_name == 'workflow_dispatch'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4

Expand All @@ -54,10 +56,15 @@ jobs:
run: cd packages/openmemory-js && npm run build

- name: publish
if: env.NPM_TOKEN != ''
run: cd packages/openmemory-js && npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: publish skipped
if: env.NPM_TOKEN == ''
run: echo "ℹ️ NPM_TOKEN not set; skipping npm publish."

- name: notify
run: |
echo "✅ Published openmemory-js@${{ steps.version.outputs.version }}"
Expand All @@ -66,6 +73,8 @@ jobs:
needs: detect-changes
runs-on: ubuntu-latest
if: needs.detect-changes.outputs.py_changed == 'true' || github.event_name == 'workflow_dispatch'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v4

Expand All @@ -88,11 +97,16 @@ jobs:
run: cd packages/openmemory-py && python -m build

- name: publish
if: env.PYPI_TOKEN != ''
run: cd packages/openmemory-py && python -m twine upload dist/* --skip-existing
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: publish skipped
if: env.PYPI_TOKEN == ''
run: echo "ℹ️ PYPI_TOKEN not set; skipping twine upload."

- name: notify
run: |
echo "✅ Published openmemory-py@${{ steps.version.outputs.version }}"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ __pycache__
test
*.db
hits.json
debug_*.log
debug_*.log
test-results/
.DS_Store
6 changes: 3 additions & 3 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OpenMemory is a self-hosted AI memory engine implementing **Hierarchical Memory
┌───────────▼───────────┐
│ REST API SERVER │
│ (TypeScript/Node) │
│ Port: 8080
│ Port: 18080
└───────────┬───────────┘
┌────────────────────────────┼────────────────────────────┐
Expand Down Expand Up @@ -529,7 +529,7 @@ NODE_SECTOR_MAP = {

```bash
# Server
OM_PORT=8080
OM_PORT=18080
OM_DB_PATH=./data/openmemory.sqlite
OM_API_KEY= # Optional bearer token

Expand Down Expand Up @@ -683,7 +683,7 @@ docker compose up -d

Ports:

- `8080` → API server
- `18080` → API server
- Data persisted in `/data/openmemory.sqlite`

### Manual
Expand Down
89 changes: 38 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,43 @@ help: ## Show this help message

# Installation and Setup
install: ## Install all dependencies
@echo "📦 Installing backend dependencies..."
cd backend && npm install
@echo "📦 Installing JavaScript SDK dependencies..."
cd sdk-js && npm install
@echo "📦 Installing JavaScript (server + SDK) dependencies..."
cd packages/openmemory-js && npm install
@echo "📦 Installing Python SDK dependencies..."
cd sdk-py && pip install -e .
cd packages/openmemory-py && pip install -e .
@echo "✅ All dependencies installed!"

install-dev: ## Install development dependencies
@echo "🛠️ Installing development dependencies..."
cd backend && npm install
cd sdk-js && npm install
cd sdk-py && pip install -e .[dev]
cd packages/openmemory-js && npm install
cd packages/openmemory-py && pip install -e .[dev]
@echo "✅ Development dependencies installed!"

# Build
build: ## Build all components
@echo "🏗️ Building backend..."
cd backend && npm run build
@echo "🏗️ Building JavaScript SDK..."
cd sdk-js && npm run build
@echo "🏗️ Building JavaScript (server + SDK)..."
cd packages/openmemory-js && npm run build
@echo "✅ All components built!"

build-backend: ## Build backend only
cd backend && npm run build
cd packages/openmemory-js && npm run build

build-js-sdk: ## Build JavaScript SDK only
cd sdk-js && npm run build
cd packages/openmemory-js && npm run build

# Development
dev: ## Start development server
@echo "🚀 Starting development server..."
cd backend && npm run dev
cd packages/openmemory-js && npm run dev

dev-watch: ## Start development server with file watching
@echo "👀 Starting development server with watching..."
cd backend && npm run dev
cd packages/openmemory-js && npm run dev

# Production
start: ## Start production server
@echo "🚀 Starting production server..."
cd backend && npm start
cd packages/openmemory-js && npm run start

stop: ## Stop server (if running as daemon)
@echo "🛑 Stopping server..."
Expand All @@ -61,57 +56,52 @@ stop: ## Stop server (if running as daemon)
# Testing
test: ## Run all tests
@echo "🧪 Running all tests..."
@echo "Testing backend API..."
node tests/backend/api-simple.test.js
@echo "Testing JavaScript SDK..."
node tests/js-sdk/sdk-simple.test.js
@echo "Testing JavaScript (server + SDK)..."
cd packages/openmemory-js && npx tsx tests/verify.ts
@echo "Testing Python SDK..."
cd tests/py-sdk && python test-simple.py
cd packages/openmemory-py && python -m pytest -q

test-backend: ## Run backend tests only
@echo "🧪 Testing backend API..."
node tests/backend/api-simple.test.js
@echo "🧪 Testing JavaScript (server + SDK)..."
cd packages/openmemory-js && npx tsx tests/verify.ts

test-js-sdk: ## Run JavaScript SDK tests only
@echo "🧪 Testing JavaScript SDK..."
node tests/js-sdk/sdk-simple.test.js
@echo "🧪 Testing JavaScript (server + SDK)..."
cd packages/openmemory-js && npx tsx tests/verify.ts

test-py-sdk: ## Run Python SDK tests only
@echo "🧪 Testing Python SDK..."
cd tests/py-sdk && python test-simple.py
cd packages/openmemory-py && python -m pytest -q

test-integration: ## Run integration tests
@echo "🔗 Running integration tests..."
node tests/backend/api.test.js
cd packages/openmemory-js && npx tsx tests/test_omnibus.ts

# Code Quality
lint: ## Run linters
@echo "🔍 Running linters..."
cd backend && npm run lint || echo "Backend linting completed"
cd sdk-js && npm run lint || echo "JS SDK linting completed"
cd sdk-py && python -m flake8 . || echo "Python linting completed"
cd packages/openmemory-js && npx prettier --check "src/**/*.ts" "tests/**/*.ts" || echo "JS formatting check completed"
cd packages/openmemory-py && python -m black --check . || echo "Python formatting check completed"

format: ## Format code
@echo "🎨 Formatting code..."
cd backend && npm run format || echo "Backend formatting completed"
cd sdk-js && npm run format || echo "JS SDK formatting completed"
cd sdk-py && python -m black . || echo "Python formatting completed"
cd packages/openmemory-js && npm run format || echo "JS formatting completed"
cd packages/openmemory-py && python -m black . || echo "Python formatting completed"

type-check: ## Run type checking
@echo "🏷️ Running type checks..."
cd backend && npx tsc --noEmit
cd sdk-js && npx tsc --noEmit
cd packages/openmemory-js && npx tsc --noEmit

# Database
db-reset: ## Reset database
@echo "🗄️ Resetting database..."
rm -f backend/database/*.db
rm -f packages/openmemory-js/data/*.sqlite
@echo "✅ Database reset!"

db-backup: ## Backup database
@echo "💾 Backing up database..."
mkdir -p backups
cp backend/database/*.db backups/ || echo "No database files found"
cp packages/openmemory-js/data/*.sqlite backups/ || echo "No database files found"
@echo "✅ Database backed up!"

# Docker
Expand All @@ -121,36 +111,33 @@ docker-build: ## Build Docker image

docker-run: ## Run Docker container
@echo "🐳 Running Docker container..."
docker run -p 8080:8080 openmemory
docker run -p 18080:18080 openmemory

docker-dev: ## Run development environment with Docker
@echo "🐳 Starting development environment..."
docker-compose up --build
docker compose up --build openmemory

docker-stop: ## Stop Docker containers
@echo "🐳 Stopping Docker containers..."
docker-compose down
docker compose down

run: docker-dev ## Alias for docker-dev

# Cleanup
clean: ## Clean build artifacts
@echo "🧹 Cleaning build artifacts..."
rm -rf backend/dist/
rm -rf sdk-js/dist/
rm -rf sdk-js/node_modules/.cache/
rm -rf backend/node_modules/.cache/
rm -rf packages/openmemory-js/dist/
rm -rf packages/openmemory-js/node_modules/.cache/
find . -name "*.pyc" -delete
find . -name "__pycache__" -type d -exec rm -rf {} + || true
@echo "✅ Cleanup complete!"

clean-all: clean ## Clean everything including node_modules
@echo "🧹 Deep cleaning..."
rm -rf backend/node_modules/
rm -rf sdk-js/node_modules/
rm -rf sdk-py/build/
rm -rf sdk-py/dist/
rm -rf sdk-py/*.egg-info/
rm -rf packages/openmemory-js/node_modules/
rm -rf packages/openmemory-py/build/
rm -rf packages/openmemory-py/dist/
rm -rf packages/openmemory-py/*.egg-info/
@echo "✅ Deep cleanup complete!"

# Examples
Expand All @@ -173,4 +160,4 @@ quick-test: build test-backend ## Quick test after build
@echo "⚡ Quick test complete!"

full-check: clean install build lint test ## Full check before commit
@echo "✅ Full check complete - ready to commit!"
@echo "✅ Full check complete - ready to commit!"
Loading