casset/docs
FeaturesOpen app
docs indexreference
00Overview01Thesis02Architecture03System reality04Roadmap05Investor brief06Technical brief07Full tech HTML08Casset Apps09Headless API10Playback11Audio pipeline12Commerce13Base anchoring14Hook system15Music video16Theming17Creator guide18Glossary
Headless APIDeployed · unsupported
QuickstartExamplesAPI ReferenceSDK
Advanced
React adapterStarter detailsError handlingRetries & timeoutsUse casesRequest IDs & safe loggingAPI versioningLocal sandboxLocal webhooksAvailability & limitationsFAQChangelogDesign principles
Headless API · SDK

Fetch Casset artist data from TypeScript.

Use one client to read public Artist and Catalog data. Add the separate React adapter only when you need React query state.

Fetch /connor

import { createCassetClient } from "@casset/apps"

const casset = createCassetClient({
  baseUrl: "http://127.0.0.1:3000",
})

const [artist, catalog] = await Promise.all([
  casset.getArtist("connor"),
  casset.getCatalog("connor"),
])

Both packages are version 0.2.0-alpha.0, repository-local, and vendored into the generated starter. Neither package is published to npm. The example uses a local Casset origin because the deployed public v1 routes are not supported for production use.

Alpha availability

Do not run pnpm add @casset/apps orpnpm add @casset/react. Use the generated archive, or workspace dependencies while working inside this repository. The public v1 GET routes are deployed and unauthenticated, but they may intentionally fail closed with 503 ResourceUnavailable. No uptime, availability, or production-use commitment is offered; production developer credentials remain unavailable.

Client options

createCassetClient options
OptionDefaultAcceptedBehavior
baseUrlRequiredHTTPS, or HTTP on localhost / 127.0.0.1 / ::1Rejects credentials, query strings, fragments, and non-loopback HTTP.
credentialNoneNon-empty stringAdds a Bearer header. Intended only for the local sandbox in this alpha.
fetchglobalThis.fetchFetch-compatible functionInject one fetch implementation, or a transport—not both.
transportFetch transportCassetTransportMakes deterministic tests and mocks possible without network calls.
timeoutMs8,0001–60,000Applies per attempt through AbortController.
maxRetries20–5Retries after the initial GET; default maximum is three total attempts.
maxRetryAfterMs5,0000–30,000Caps Retry-After and exponential delays.
requestIdFactoryGenerated sdk-* IDFunction returning a valid request IDOne ID is reused across every attempt and must be mirrored by the response.
sleepsetTimeoutAsync duration functionInjectable for deterministic retry tests.

Methods

Casset client methods
MethodReturnsNotes
getArtist(handle, options?)PublicArtistResponseGET only. Validates the handle before transport.
getCatalog(handle, options?)PublicCatalogResponseGET only. Returns an empty tracks array when a public artist has no active Tracks.

Per-request options accept requestId and an externalAbortSignal. An external abort is terminal and is not retried.

Strict response parsing

The parsers require every documented field, reject unknown fields, verify schema names, enforce bounded strings and track counts, and reject unsafe public links. A malformed 2xx response becomes a non-retryableIntegrationFailure in the client. Direct parser calls throwCassetContractError with structured issues.

Request ID protocol

  • IDs are 8–120 characters from letters, digits, period, underscore, colon, and hyphen.
  • Secret-shaped values, JWT-like values, whitespace, and line breaks are rejected.
  • The response x-request-id must exactly match the request ID.
  • A missing or mismatched response ID becomes a non-retryable IntegrationFailure.

React adapter

React adapter exports
ExportPurposeBoundary
CassetClientProviderMakes one CassetClient available to descendants.Does not create or configure a client.
useCassetClient()Reads the configured client.Throws when no provider exists.
useCassetArtist(handle)Loads and shares an artist query store per client and handle.Returns idle, loading, ready, or error plus reload().
useCassetCatalog(handle)Loads and shares a Catalog query store per client and handle.Returns the exact public Catalog contract.
CassetHostProvider / useCassetHostSnapshotNative App host bindings exported by the same package.For Casset Apps, not Headless HTTP playback control.

Exact mocks

const transport = createCassetMockTransport({ state: "empty" })
const casset = createCassetClient({
  baseUrl: "https://sandbox.casset.test",
  transport,
  requestIdFactory: () => "test-request-001",
})

await casset.getArtist("aurora-fields") // Built-in SDK mock identity

Mock states cover ready, empty, permission denied, entitlement required, invalid credential, rate limit, unavailable resource, and integration failure. They use the same schemas and request-ID rules as the client.

Mock-only 404 edge

An unknown mock path returns 404 RESOURCE_UNAVAILABLE withretryable: true. The client still does not retry it because 404 is not a transient retry status. Real public unknown, private, and unpublished Artist responses use retryable: false; do not infer production privacy behavior from the mock fallback flag.

Related reference

  • Exact React exports and query states
  • Typed errors and safe user-facing handling
  • Exact retry and timeout policy
  • Generated starter security boundary
© Casset 2026
Trust & PrivacyTerms