A cloud-based implementation of Mem0 using Cloudflare Workers, D1, and Pages for cross-device memory access.
- 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
- Node.js installed locally
- Cloudflare account
- Wrangler CLI (
npm install -g wrangler
) - Git
- Clone the repository:
git clone https://github.com/Shawn5cents/mem0.git
cd mem0
git checkout cloud-implementation
- Install dependencies:
npm install
- Login to Cloudflare:
wrangler login
- Create D1 database:
wrangler d1 create mem0-db
- 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
- Apply database schema:
wrangler d1 execute mem0-db --file=src/worker/schema.sql
- Start local development:
npm run dev
- Make changes to the codebase
- Test locally using
npm run dev
- Commit changes and push to GitHub
- Cloudflare Pages will automatically deploy changes
Add a new memory
{
"text": "Memory content",
"user_id": "user-uuid"
}
Search memories
{
"query": "search term",
"user_id": "user-uuid"
}
The application is automatically deployed through Cloudflare Pages when changes are pushed to the main branch.
npm run deploy
- 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
- Create a feature branch
- Make changes and test locally
- Push changes and create a pull request
- Wait for review and merge
MIT License - See LICENSE file for details