Capxul Docs
Package reference

Client factory reference

Exact input and result contracts for createCapxulClient.

createCapxulClient

function createCapxulClient(input: CapxulClientInput): Promise<CapxulResult<CapxulClient>>;

The factory resolves application bootstrap and production adapters, then returns a Core SDK client. Bootstrap and adapter failures are returned as a failed result.

The standard production client composes backend-backed Organization lifecycle, Member, Role, and treasury reads. Organization onboarding uses one sponsored founder-Account batch for the settled Solo setup. Missing data and provider failure remain typed failures; the client does not substitute empty lists, synthesized roles, a zero treasury, or an inferred Owner label for the authenticated viewer's backend-projected active role.

CapxulClientInput

interface CapxulClientInput {
  readonly publishableKey: string;
  readonly observability?: HostObservability;
  readonly requirement?: AccountRequirement;
  readonly signer?: CapxulSigner;
}
FieldRequiredMeaning
publishableKeyyesIdentifies the application and resolves platform configuration.
observabilitynoOne host-owned product/failure module, normally built with postHogObservability around the host's initialized client.
requirementnonone, counterfactual, or deployed; defaults to none.
signernoConsumer-held signer for Node, injected-wallet, or deterministic proof paths. Browser production otherwise resolves Openfort lazily.

No other public fields exist. origin, bootstrapBaseUrl, authBaseUrl, runtime, authCache, lower-level telemetry ports, fetch, signal, otpTtlMs, invokeTimeoutMs, bootstrap resolutions, and port bundles are internal production/testing seams.

Engineering logs and traces are configured only by the validated versioned bootstrap response. Application code does not pass OTLP endpoints, tokens, service names, or test-run markers.

Return

type CapxulResult<T> =
  { readonly ok: true; readonly value: T } | { readonly ok: false; readonly error: CapxulError };

Use the ok discriminant before reading value or error.

CapxulError

CapxulError contains a stable code and safe public message. Expected domain failures are values. Do not parse provider messages or depend on internal causes.

Cancellation

Most method calls accept { signal?: AbortSignal } as the final argument. A pre-aborted signal resolves a failed result with code CANCELLED.

Lifecycle

A client owns resources created during production assembly. Long-running apps normally keep one client for their bounded application lifetime. Short-lived processes may call await client._internal.close?.() during teardown.

Everything else under _internal is implementation substrate and is excluded from the consumer contract.

On this page