← DocumentationCornerstone SDK

Framework-independent clients for Cornerstone services.

Use the SDK transport and domain clients outside UI code while keeping credentials and environment policy in the consuming application.

@cornerstonestack/sdk is currently a private workspace package. This guide documents its reviewed contract; it does not claim a public npm release.

Contract principles

Public package exports

@cornerstonestack/sdk
@cornerstonestack/sdk/client
@cornerstonestack/sdk/errors
@cornerstonestack/sdk/experience-studio
@cornerstonestack/sdk/spark
@cornerstonestack/sdk/spark/types

Create clients

import {
  createExperienceStudioApi,
  createHttpClient,
  createSparkApi,
} from '@cornerstonestack/sdk'

const client = createHttpClient({
  baseUrl: featureDataUrl,
  getAccessToken,
  requireAccessToken: true,
})

const sparkApi = createSparkApi({ client })
const experienceStudioApi = createExperienceStudioApi({ client })

Add an endpoint

  1. Add request and response boundary types to the domain types file.
  2. Add a clearly named domain method to the domain API factory.
  3. Send requests through createHttpClient; do not repeat token, JSON, status, or error parsing logic.
  4. Test the action and path, request body, response selection, abort behavior, and failure mapping.

Domain boundaries

Spark exposes snapshot operations for personal and shared scopes.

Experience Studio exposes explicit Project, Program, Course, Module, and Activity operations.

Requests use object arguments, forward abort signals, and share the client authentication and normalized error contract.

Wire DTOs, persisted domain entities, and view models remain separate when their shapes differ.