Guides

SDK and API entrypoints

Documentation version: 858adedd187db2e94614b1dfd389e4bf98e6e202:ac5d527caaa1f97eee9d71262e7c843ae7b24000e01ba5b44931108b2b489c0d

The private @astrogate/sdk source package composes native clients and generated HTTP transport models. It does not implement a second query language, another authentication engine or an AI-only command API.

Choose an execution context

ImportIntended callerSupported responsibility
@astrogate/sdk/managementTrusted consumer serverProjects/environments, repositories, deployments, resources, placement, schedules, workspaces and durable operations
@astrogate/sdk/browserApplication browserNative scoped database/auth clients and authorized file client
@astrogate/sdk/reactReact applicationNative schema-inferred database hooks
@astrogate/sdk/serverApplication serverRequest-scoped database/file/job sessions and supported native server composition
@astrogate/sdk/operatorTrusted operator serverIndependently authorized read-only cross-product inventory

Use explicit imports in examples. Management and operator entrypoints are server-only and cannot be bundled for the browser. A product management token does not authenticate as an application user or as an infrastructure operator.

Install the reviewed source release

This package has not been published to a public npm registry. Obtain the exact reviewed infrastructure source release through your authorized installation owner. Preserve the repository-relative SDK/native-client package layout and frozen lockfiles. From that checkout, prepare the maintained clients, identity package and SDK with the release's supported Node/npm toolchain:

node modules/instantdb/integration/clients/prepare.mjs
npm --prefix modules/instantdb/integration/clients ci
npm --prefix modules/instantdb/integration/clients run build
npm --prefix modules/identity ci
npm --prefix sdk ci
npm --prefix sdk run build

The current integration fixtures consume this built SDK and native dependency graph. A standalone distributable package/registry release needs its own package assembly and compatibility checks; copying only sdk/dist is insufficient. Do not advertise npm install @astrogate/sdk as an available public release.

Management setup

import { createManagement } from '@astrogate/sdk/management';

const management = createManagement({
  endpoint: installation.managementUrl,
  tenant: installation.tenantId,
  token: protectedManagementToken,
  deadlineMs: installation.requestDeadlineMs,
  maxAttempts: installation.requestAttempts,
});

const projects = await management.projects.list();

The installation supplies these values; they are not browser configuration. The server independently checks credential scope, current grants, revisions, quotas and capacity. Paginated lists expose nextCursor; a page size is not a resource quota. A missing dependency is not an empty successful response.

Use a stable persisted idempotency key for one logical mutation. Preserve the same body on transport retry. A changed request needs a new decision and key. Cancellation stops the client wait, not already accepted durable work. See operation behavior and the generated management API reference.

Application clients

The database guide documents actual createClient, schema, query/transaction and server-session signatures. Identity uses Better Auth's real configured client. Storage and jobs own their scoped methods and error behavior. Native factories preserve inferred types from the pinned engine and configured plugins; the API reference does not replace those native type models.

Browser bindings contain public endpoints/resource identifiers. Server issuer, provider, PostgreSQL and secret-manager credentials stay out of browser builds. SSR request sessions must not be stored in a shared global client. Native method availability does not authorize a blocked route or an unconfigured plugin.

API and agent reference

The HTTP reference is generated from api/openapi.json, also used by Go and SDK transport type generation. Read management, application access, operator inventory and schema definitions. The same selected pages are available as Markdown, search, exports and documentation MCP reads. The MCP contains documentation tools only; a consuming product's action MCP calls the same management SDK under that product's independently checked credentials.

On this page