Skip to main content

Installation

Requirements​

  • Node.js 18 or later (uses native fetch, FormData, Blob). Node 22 is recommended.
  • A service key for your app.
  • Server-side code only. The SDK is not browser-safe.

Install the package​

The SDK is private for now

@scenid/cloud-sdk is not publicly available yet. To get it, contact Scenid at hello@scenid.com.

yarn add @scenid/cloud-sdk

ESM and CommonJS​

The package ships both formats.

ESM
import sdk, { initScenid } from '@scenid/cloud-sdk'
CommonJS
const { default: sdk, initScenid } = require('@scenid/cloud-sdk')

Initialise once​

Call initScenid once when your process starts, then use the sdk singleton anywhere.

index.js
import sdk, { initScenid } from '@scenid/cloud-sdk'

import serviceKey from './service-key.json' with { type: 'json' }

initScenid(serviceKey)

Service key from an environment variable​

On platforms without files (containers, serverless), store the JSON in a secret and parse it:

initScenid(JSON.parse(process.env.SCENID_SERVICE_KEY))

Local development against a local stack​

Set cloud_stack and ssl: false in the key to talk to a local Scenid stack over http:

{
"client_id": "…",
"client_secret": "…",
"token_uri": "http://auth.scenid-cloud.local:8080/oauth/token",
"cloud_stack": "scenid-cloud.local:8080",
"ssl": false
}

Debug logging​

Set DEBUG=scenid:* to log every request and response. See Debugging.