Docs · SDK & client
SDK & client
For teams embedding Closure Forms, Experiences, and GraphQL inside an existing product — a standalone Next.js, React, Vue, Angular, or Node app that talks to Closure the same way partners do.
Building in Cursor / Claude Code / VS Code? See Build in your IDE — MCP is the agent craft path; this SDK is for runtime product embeds.
Packages
| Package | Role |
|---|---|
@closure-sdk/core | Framework-agnostic ClosureClient — GraphQL, Experiences, workflows, runs |
@closure-sdk/react | ClosureProvider, useExperience, useSubmitRun, and friends |
@closure-sdk/next | App Router BFF: createClosureBffHandlers for /api/closure/* |
pnpm add @closure-sdk/core @closure-sdk/react @closure-sdk/nextVue / Angular: use @closure-sdk/core from your composition or services layer today; framework wrappers can land later without changing the HTTP contract.
Two connection modes
| Mode | When | Paths |
|---|---|---|
| `bff` (default) | Your host owns /api/closure/* and proxies with server credentials | /api/closure/graph, /api/closure/workflows/:id, /api/closure/runs/submit, … |
| `platform` | Browser or server talks to the console directly (same-origin, or API key) | /api/graphql, /api/experience/:slug, /api/workflows/:id, /api/runs/submit, … |
Never put vault secrets in the browser. Prefer bff for product hosts — your frontend talks to your own routes, and credentials stay server-side (see Auth & API keys).
Quick start (Next.js)
BFF route — app/api/closure/[...path]/route.ts:
import { createClosureBffHandlers } from "@closure-sdk/next";
export const { GET, POST, PUT, PATCH, DELETE } = createClosureBffHandlers({
platformUrl: process.env.CLOSURE_API_URL || "https://closureapps.com/console",
// login or apiKey — server-side env only
});Client component:
"use client";
import { ClosureProvider } from "@closure-sdk/react";
export function App() {
return (
<ClosureProvider mode="bff">
<ExperienceHost slug="my-console" />
</ClosureProvider>
);
}Your app now renders a live Experience from the org graph, submits Forms into governed workflow runs, and reads product data over GraphQL — without owning any of the persistence, audit, or vault.
@closure-platform/client (monorepo)
Thin re-export of @closure-sdk/* plus ClosureRunForm (Forms + workflow seal). Prefer depending on @closure-sdk/* directly in new hosts.
Package map (Platform monorepo)
| Package | Role |
|---|---|
graph | Workflow Graph model |
runtime | Executor + durable runs |
semantic | Product object store + GraphQL helpers |
forms / forms-react | Web form projection |
experiences / experiences-react | UI graph + renderer |
integrations | Connector catalog + adapters |
knowledge | Skills + Files retrieve |
mcp-server | IDE control plane (platform_* tools) |
sdk | Fixtures + public barrels |
client | Re-exports closure-sdk + Forms embed |
Forms embed
Publish from Closure Workflows → Ship. Embed packaging mounts wizard or monolith into a host page — not a third form layout.