Skip to content

Shawn5cents/mem0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mem0 Cloud Implementation

A cloud-based implementation of Mem0 using Cloudflare Workers, D1, and Pages for cross-device memory access.

Architecture

  • Frontend: Static web app hosted on Cloudflare Pages
  • Backend: Cloudflare Workers for API endpoints
  • Storage: Cloudflare D1 (SQLite-compatible database)
  • Deployment: Automated through GitHub and Cloudflare Pages

Prerequisites

  • Node.js installed locally
  • Cloudflare account
  • Wrangler CLI (npm install -g wrangler)
  • Git

Local Development Setup

  1. Clone the repository:
git clone https://github.com/Shawn5cents/mem0.git
cd mem0
git checkout cloud-implementation
  1. Install dependencies:
npm install
  1. Login to Cloudflare:
wrangler login
  1. Create D1 database:
wrangler d1 create mem0-db
  1. Update wrangler.toml with your database ID:
[[d1_databases]]
binding = "DB"
database_name = "mem0-db"
database_id = "your-database-id"  # Replace with your D1 database ID
  1. Apply database schema:
wrangler d1 execute mem0-db --file=src/worker/schema.sql
  1. Start local development:
npm run dev

Development Workflow

  1. Make changes to the codebase
  2. Test locally using npm run dev
  3. Commit changes and push to GitHub
  4. Cloudflare Pages will automatically deploy changes

API Endpoints

POST /api/memories

Add a new memory

{
  "text": "Memory content",
  "user_id": "user-uuid"
}

POST /api/memories/search

Search memories

{
  "query": "search term",
  "user_id": "user-uuid"
}

Deployment

The application is automatically deployed through Cloudflare Pages when changes are pushed to the main branch.

Manual Deployment

npm run deploy

Security

  • All API endpoints use CORS headers for security
  • User data is isolated by user_id
  • Cloudflare Workers provide edge security
  • D1 database is only accessible through Workers

Contributing

  1. Create a feature branch
  2. Make changes and test locally
  3. Push changes and create a pull request
  4. Wait for review and merge

License

MIT License - See LICENSE file for details