Skip to main content

Getting started

Requirements

  • Node.js 18 or later, and npm 8 or later
  • TypeScript 5 or later, recommended rather than required

Runtime dependencies are deliberately thin: a Cognito client and protocol buffers for provisioning. The SDK pulls in no MQTT client, no HTTP client and no connectivity module of its own; those arrive as adaptors.

Install

npm install @espressif/rainmaker-neo-base-sdk

Configure

Get the deployment details from your published client configuration (rmng-client-outputs.json). The URL and QR code are in Deployment Details.

Client outputs keySDK configuration
rmng-base → ApiGatewayUrlbaseUrl
espuser-base → EspUserApiUrluserApiBase
rmng-base → StackRegionawsRegion
rmng-base → IoTEndpointUrliotEndpoint
import { ESPRMNeoBase } from "@espressif/rainmaker-neo-base-sdk";

ESPRMNeoBase.configure({
baseUrl: "https://<api-id>.execute-api.<region>.amazonaws.com/prod",
userApiBase: "https://<user-api-id>.execute-api.<region>.amazonaws.com/prod",
awsRegion: "<region>",
iotEndpoint: "<iot-endpoint-host>",
mqttAdapter: myMqttAdapter,

// Optional
customStorageAdapter: myStorageAdapter,
provisionAdapter: myProvisionAdapter,
});
note

Configure the SDK before you start using it. configure() must run before any other SDK call.

NameUsageOptional
baseUrlMain API base URL (include the API Gateway stage on a default execute-api host; a trailing slash is stripped)No
userApiBaseUser and auth API base URLNo
awsRegionAWS region, such as us-east-1No
iotEndpointIoT endpoint hostNo
mqttAdapterMQTT client for device communication — required for live updates and control over MQTTNo
customStorageAdapterPersist sessions and tokens on the deviceYes
provisionAdapterBLE or SoftAP provisioningYes

init() is a back-compat alias that forwards to configure().

Handle configuration failures

import { ESPConfigError } from "@espressif/rainmaker-neo-base-sdk";

try {
ESPRMNeoBase.configure(config);
} catch (error) {
if (error instanceof ESPConfigError) {
console.error(error.code, error.message);
}
throw error;
}

Every SDK error carries a stable code you can branch on; Errors lists the classes and their codes.