Node.js SDK
Use the official memorysync-sdk package with Node.js 18 or newer. The package ships CommonJS, ES modules, and TypeScript declarations for the memory and control-plane clients.
Package at a glance
| Item | Contract |
|---|---|
| Install | npm install memorysync-sdk@1.9.1 |
| Runtime | Node.js 18+ |
| Modules | CommonJS and ESM |
| Types | Bundled TypeScript declarations |
| Clients | MemorySyncClient, ControlPlaneClient |
Choose a client
Which operation family do you need?
Store or retrieve application memory
The call represents an application workload and an opaque end user.
Use: MemorySyncClient with a server-side API key.
Manage accounts or organizations
The call works with sessions, billing, projects, exports, integrations, API keys, or webhooks.
Use: ControlPlaneClient with a bearer access token.
Run directly in a browser
A browser bundle can expose credentials to end users.
Use: Call MemorySync from your trusted server instead.
Import the public surface
import {MemorySyncClient,ControlPlaneClient,MemorySyncError,AuthError,ValidationError,NotFoundError,RateLimitError,ServerError,type AddResponse,type MemoryRecord,type QueryResponse,} from "memorysync-sdk";
The Node.js memory loop
- 01
Create
Initialize one client from trusted server configuration.
- 02
Add
Await the Add result and branch on created or skipped.
- 03
Query
Retrieve candidates from the same trusted scope.
- 04
Select
Use only records relevant to the current task.
- 05
Handle
Narrow typed failures and keep writes recoverable.
TypeScript conventions
- Methods and fields use camelCase, such as
bulkAdd,endUserId, andmemoryIds. - Every operation returns a Promise.
- The package translates documented wire naming; application code uses the exported TypeScript types.
- Optional response fields can be null or absent; narrow before using them.
Build with Node.js
Install, configure, add, and query in one program.
See all 31 memory methods and result types.
Narrow success unions and typed exceptions.
Use all 43 named control-plane methods, including public credential exchanges and bearer-authenticated administration.