Skip to content

Add document generation to your TypeScript application.

Dokus provides separate packages for document structure, blueprints, server requests, and browser viewing. Install only the packages your code needs.

  • ESM
  • Node.js server client
  • Browser WASM viewer

Name every input in the render request.

The API key stays on the server. The render request names a document version, a blueprint, and the data for that run.

Server exampleTypeScript
import { createDokusClient } from "@dokus/client";
import { defineBlueprint, input, values } from "@dokus/blueprint";

const dokus = createDokusClient({
  apiKey: process.env.DOKUS_API_KEY!
});

const blueprint = defineBlueprint({
  inputSchema,
  rules: [values({ "customer.name": input("customerName") })]
});

await dokus.documents.render({
  documentId,
  versionId,
  blueprint,
  data: { customerName: "Northstar Logistics" },
  generatePdf: true
}, { idempotencyKey });

Each package has one job.

@dokus/dksd

Create documents, inspect exact snapshots, and build ordered document changes.

@dokus/blueprint

Define accepted input, bind values to fields, and add show and repeat rules that target blocks, tables, rows, and cells.

@dokus/client

Import documents, manage versions and blueprints, start renders, and inspect runs from your server.

@dokus/document-viewer

Render exact document and font bytes in the browser and select text, fields, blocks, tables, rows, and cells. Read-only.

The server and the browser keep different jobs.

Keep credentials and persistence on the server

Use @dokus/client only in trusted Node.js code. Your server owns authorization, transport, storage decisions, and retries.

Keep the browser viewer read-only

Pass authorized document and font bytes to the viewer. It renders and selects; it does not edit, save, or hold API keys.

Start with one document and one typed field.