MemorySync
SDKs · Node.js

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

ItemContract
Installnpm install memorysync-sdk@1.9.1
RuntimeNode.js 18+
ModulesCommonJS and ESM
TypesBundled TypeScript declarations
ClientsMemorySyncClient, 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

clients.ts
import {
MemorySyncClient,
ControlPlaneClient,
MemorySyncError,
AuthError,
ValidationError,
NotFoundError,
RateLimitError,
ServerError,
type AddResponse,
type MemoryRecord,
type QueryResponse,
} from "memorysync-sdk";

The Node.js memory loop

Node.js memory loop
  1. 01

    Create

    Initialize one client from trusted server configuration.

  2. 02

    Add

    Await the Add result and branch on created or skipped.

  3. 03

    Query

    Retrieve candidates from the same trusted scope.

  4. 04

    Select

    Use only records relevant to the current task.

  5. 05

    Handle

    Narrow typed failures and keep writes recoverable.

TypeScript conventions

  • Methods and fields use camelCase, such as bulkAdd, endUserId, and memoryIds.
  • 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

Was this page helpful?