Install DocStudio
Install the docstudio npm package, add the optional peer dependencies for the designer and the PDF server, and check that the import resolves.
Install the package from npm:
npm install docstudioThis is enough to compile templates and render HTML in Node, in a browser or in a worker. The package is ESM only and has one runtime dependency, @cfworker/json-schema. It runs no install scripts.
For the visual designer
The designer is a React component. React, React DOM and @dnd-kit/core are optional peer dependencies, so install them in the app that embeds the designer:
npm install docstudio react react-dom @dnd-kit/coreFor server-side PDF output
The PDF service uses Playwright and a Chromium browser. Both are optional peers and are never installed for you:
npm install docstudio playwright
npx playwright install chromiumCheck the install
import { renderDocument } from 'docstudio';
const result = renderDocument(
{ schemaVersion: '1.0.0', body: [{ id: 'hello', type: 'text', content: ['Hello'] }] },
{},
);
console.log(result.ok);Run it with node check.mjs. It prints true.
Other package managers
The package has nothing npm-specific. pnpm add docstudio and yarn add docstudio install the same files. See requirements for supported versions.