---
title: "Process documents in Node.js with Document Authoring"
canonical_url: "https://www.nutrient.io/sdk/document-authoring/getting-started/using-nodejs/"
md_url: "https://www.nutrient.io/sdk/document-authoring/getting-started/using-nodejs.md"
last_updated: "2026-08-25T16:27:50.849Z"
description: "Use the Document Authoring headless Node.js entry point to import, edit, and convert DOCX, DocJSON, and other documents on the server — no browser required."
---

# Install for Node.js

Run Document Authoring headlessly in Node.js to import, edit, and convert documents on the server — converting DOCX files to PDF, filling templates programmatically, or processing documents in a queue. The Node.js entry point exposes the same document API as the browser library, without the visual editor.

## Requirements

- Node.js 22 or 24.

- The `@nutrient-sdk/document-authoring` package.

Edge runtimes (such as Cloudflare Workers or Vercel Edge Functions) and alternative Node-compatible runtimes aren’t supported. Use a standard Node.js server runtime.

Document Authoring for Node.js is a licensed feature. [Contact Sales](https://www.nutrient.io/contact-sales/) to enable it for production use.

## Adding to your project

Install the package:

```bash

npm install @nutrient-sdk/document-authoring

```

The Node.js entry point is the `/node` subpath of the package and supports both ESM `import` and CommonJS `require`. It uses the same document API as the browser library. See [working with documents](https://www.nutrient.io/guides/document-authoring/working-with-documents/overview.md) for import and export formats and [programmatic editing](https://www.nutrient.io/guides/document-authoring/editing-content/programmatic-editing.md) for changing document content.

No asset setup is required to get started. The engine and support files load from the installed package, and built-in fonts load from Nutrient’s content delivery network (CDN) when they’re needed. For an offline or self-hosted deployment, see [Node.js in production](https://www.nutrient.io/guides/document-authoring/deploy-and-production/nodejs-in-production.md).

## Importing, editing, and converting a document

Save the following code as `process-document.mjs`, and place a DOCX file next to it as `input.docx`. It processes a document end to end:

```js

import { createDocAuthSystem } from '@nutrient-sdk/document-authoring/node';
import { readFile, writeFile } from 'node:fs/promises';

const system = await createDocAuthSystem();

try {
	// `Buffer` extends `Uint8Array`, so it can be passed directly.
	const document = await system.import(await readFile('input.docx'), {
		format: 'docx',
	});

	await document.transaction(async ({ draft }) => {
		const paragraph = draft.body().content().addParagraph();
		paragraph.asTextView().setText('Processed on the server.');

		return true;
	});

	const pdf = await document.export({ format: 'pdf' });
	await writeFile('output.pdf', new Uint8Array(pdf));
} finally {
	system.destroy();
}

```

A few details worth noting:

- Binary inputs accept `Buffer` and other `Uint8Array` values directly, as well as `Blob`, `ArrayBuffer`, and `Response` values.

- `system.import()` can detect a format from the content or a `fileName` hint. Passing `format` skips detection when you already know the input format.

- Call `system.destroy()` when the process shuts down or when the system is no longer needed.

## Run it

```bash

node process-document.mjs

```

`output.pdf` appears next to the script: the imported DOCX with the added paragraph, converted to PDF on the server. From here, the same document API covers every import and export format and the full programmatic editing surface.

## TypeScript configuration

The Node.js entry uses the shared [`DocAuthSystem` API](https://www.nutrient.io/api/document-authoring/types/docauthsystem/). Its `createEditor()` method is browser-only and throws if called in Node.js.

Because the shared type definitions also describe the browser API, a Node-only TypeScript project might report that types such as `HTMLElement` or `Document` can’t be found. These are TypeScript errors, not missing Node.js runtime dependencies.

Configure the fix in your project’s `tsconfig.json` file, usually found at the project root. Add `"DOM"` to the existing `compilerOptions.lib` array so TypeScript knows about the browser types referenced by the shared API declarations:

```json

{
	"compilerOptions": {
		"lib": ["ES2022", "DOM"]
	}
}

```

The `lib` setting only makes these type declarations available to the TypeScript compiler. It doesn’t add browser code or browser APIs to the Node.js runtime.

Alternatively, you can tell TypeScript not to check declaration files from dependencies:

```json

{
	"compilerOptions": {
		"skipLibCheck": true
	}
}

```

This still type-checks your application code, but it skips errors inside dependency declaration files.

## Next steps

**[Node.js in production](https://www.nutrient.io/guides/document-authoring/deploy-and-production/nodejs-in-production.md)**\
The scaling model, worker threads, and asset configuration for servers.

**[Programmatic editing](https://www.nutrient.io/guides/document-authoring/editing-content/programmatic-editing.md)**\
Transactions and the document editing API — identical in the browser and Node.js.

**[Working with documents](https://www.nutrient.io/guides/document-authoring/working-with-documents/overview.md)**\
Import and export formats.
---

## Related pages

- [Getting started with Document Authoring](/sdk/document-authoring/getting-started.md)
- [Install from a CDN](/sdk/document-authoring/getting-started/using-cdn.md)
- [or](/sdk/document-authoring/getting-started/using-npm.md)
- [or](/sdk/document-authoring/getting-started/using-other-setups.md)
- [or](/sdk/document-authoring/getting-started/using-vite.md)

