SDK & Client Libraries
No SDK is required — any HTTP client works. For convenience, Wriven ships optional, isomorphic packages: a typed delivery client, a React rich-text renderer, and Next.js webhook helpers.
The packages
| Param | Type | Description |
|---|---|---|
| @wriven-ai/client | core | createClient, getEntry, getEntries. Typed, zero-dependency, runs in Node, browsers, and edge. |
| @wriven-ai/react | react | <WrivenRichText> renderer for richtext fields, with per-node component overrides. |
| @wriven-ai/next | next | createWebhookRoute (verify + revalidate) and verifyWrivenSignature for Next.js. |
0.1.0). They are optional — the Delivery API is plain HTTP, so a raw fetch works too — but the SDK adds typed responses, automatic retries on 5xx, a request timeout, and a typed WrivenError.Install
npm install @wriven-ai/client
# optional:
npm install @wriven-ai/react # richtext renderer (React peer)
npm install @wriven-ai/next # webhook + signature helpers (Next peer)Usage
Create a client with your project id and a delivery token, then read entries:
import { createClient } from '@wriven-ai/client';
const wriven = createClient({
projectId: process.env.WRIVEN_PROJECT_ID,
token: process.env.WRIVEN_TOKEN, // wrk_live_… (published) or wrk_preview_… (drafts)
// baseUrl: 'https://api.wriven.com', // default
// retries: 2, timeoutMs: 10000,
});
// list
const { items, total } = await wriven.getEntries('blog_post', {
sort: '-publishedAt', limit: 10,
});
// one by slug
const post = await wriven.getEntry('blog_post', 'hello-world', { include: 1 });A preview token (wrk_preview_…) automatically returns drafts, so the same client powers both production and preview. Failed requests throw a typed WrivenError with status and code matching the response envelope.
Other frameworks
Because the core client uses only the global fetch, it runs anywhere — Astro, Vite, Remix, mobile, servers, edge workers. Render richtext fields with <WrivenRichText> in any React app; in non-React stacks, walk the ProseMirror JSON directly as shown in the Rich Text guide. See the Next.js guide for the full SSR + webhook loop.