-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Describe your use case
JavaScript/TypeScript developers need a simple, practical client example to integrate PowerMem's intelligent memory capabilities into their web applications or Node.js backends. This example will demonstrate how to interact with the PowerMem HTTP API Server using native fetch API or popular HTTP libraries, enabling JavaScript/TypeScript applications to leverage PowerMem's memory management features.
Describe the solution you'd like
Create a simple JavaScript/TypeScript client example that demonstrates:
-
Basic HTTP client setup:
- Configuration for API base URL and API key
- HTTP client initialization (using native
fetchor minimal library) - Request/response handling with proper JSON serialization/deserialization
-
Core memory operations:
- Create memory (
POST /api/v1/memories) - Search memories (
POST /api/v1/memories/search) - List memories (
GET /api/v1/memories) - Update memory (
PUT /api/v1/memories/{memory_id}) - Delete memory (
DELETE /api/v1/memories/{memory_id})
- Create memory (
-
Project structure:
- Simple Node.js project structure
- TypeScript support (optional but recommended)
- Main example file demonstrating all operations
- PowerMem client class/module
- Type definitions for requests/responses
- Configuration management
- Error handling examples
-
Deliverables:
examples/javascript/orexamples/typescript/directory with:client.tsorclient.js- PowerMem client classexample.tsorexample.js- Main example demonstrating all operationstypes.tsortypes.d.ts- TypeScript type definitions (if using TS)package.json- Node.js package configurationtsconfig.json- TypeScript configuration (if using TS)README.md- Usage instructions and examples
- Basic error handling
- Example output showing successful operations
- Support for both CommonJS and ES modules (optional)
The solution should:
- Use Node.js 18+ or modern browser with fetch support
- Minimize dependencies (prefer native
fetch, optionally addaxiosif needed) - Follow JavaScript/TypeScript best practices and conventions
- Include clear comments and JSDoc/TSDoc
- Handle 64-bit integer IDs properly (memory_id as string to avoid precision loss)
- Support both JSON request/response handling
- Include example usage in README
- Work in both Node.js and browser environments (if possible)
Describe alternatives you've considered
- Using a full-featured HTTP client library - but we want to keep it simple and demonstrate core concepts
- Creating a complete SDK - but that's too complex for a 2-hour coding session
Additional context
- The PowerMem HTTP API Server is already available and documented at
docs/api/0005-api_server.md - Base URL:
http://localhost:8000/api/v1 - API Key authentication via
X-API-Keyheader - All endpoints return JSON responses
- Memory IDs are 64-bit integers that should be handled as strings in JSON to avoid precision loss (see
docs/guides/1000-other_notes.md) - The example should demonstrate async/await patterns
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Projects
Status
Todo