@synap-core/sdk
v1.0.0
Published
Type-safe tRPC client SDK for Synap data pods
Downloads
172
Readme
@synap-core/sdk
Type-safe tRPC client for Synap data pods. Connect any JavaScript/TypeScript app to your personal data pod with full autocomplete on all 47+ routers.
Install
npm install @synap-core/sdk
# or
pnpm add @synap-core/sdkQuick start
import { createSynapClient } from "@synap-core/sdk";
const synap = createSynapClient({
podUrl: "https://your-pod.synap.live", // your data pod URL
apiKey: "sk_live_...", // from Workspace → Settings → API Keys
workspaceId: "ws_...", // your workspace ID
});
// Fully typed — autocomplete works on all procedures
const entities = await synap.entities.list.query({ limit: 20 });
const workspace = await synap.workspaces.get.query();
// Create an entity
await synap.entities.create.mutate({
profileSlug: "note",
title: "My first note",
properties: { content: "Hello from the SDK!" },
});Authentication
API key (server-side / external apps)
const synap = createSynapClient({
podUrl: "https://your-pod.synap.live",
apiKey: "sk_live_...", // Bearer token — generate in workspace settings
workspaceId: "ws_...",
});Session cookie (browser — after Kratos login)
const synap = createSynapClient({
podUrl: "https://your-pod.synap.live",
workspaceId: "ws_...",
// omit apiKey — credentials: "include" is set automatically
});Type helpers
import type { RouterInputs, RouterOutputs } from "@synap-core/sdk";
type EntityListInput = RouterInputs["entities"]["list"];
type EntityListOutput = RouterOutputs["entities"]["list"];React
For React apps use @synap-core/react which wraps this SDK with TanStack Query hooks.
API reference
Full procedure reference: docs.synap.live/reference/api-reference
