SuperDoc is the open source DOCX Editor and Agent SDK for reviewing, filling, and editing documents. Word-quality DOCX editing, built for your product.
Tracked changes, threaded comments, tables, headers, and footers stay DOCX structures, and pages lay out as in Word. Edits write back to OOXML without an HTML conversion step.
- Open Source. AGPLv3, with a commercial license for proprietary deployments.
- Self-hosted. Runs in the browser, on your servers, or inside your agent workflows (Node.js, Python, Rust, CLI, MCP). It does not require document content to be sent to SuperDoc.
- Custom UI. Use the built-in UI or build your own on the same Document API.
Live demo · Documentation · Editor quick start · Agent quick start · Report a bug
npm install superdocSuperDoc mounts into elements you provide:
<div id="toolbar"></div>
<div id="editor"></div>
<button id="export" type="button" disabled>Export DOCX</button>import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const superdoc = new SuperDoc({
selector: '#editor',
document: '/sample.docx',
documentMode: 'editing',
ui: { toolbar: { container: '#toolbar' } },
onReady: () => { document.querySelector('#export').disabled = false; },
});
document.querySelector('#export').addEventListener('click', async () => {
await superdoc.export({ exportType: ['docx'], exportedName: 'sample-edited' });
});document accepts a URL, a File, or a Blob. Omit it to start with a blank
DOCX. documentMode is 'editing', 'suggesting', or 'viewing'. The editor
needs no server of its own.
Next, follow the editor quick start for a complete vanilla JavaScript or React project, then configure the editor.
Use a headless SDK to let your own LLM review and edit DOCX files. This example uses the Node.js SDK with the Vercel AI SDK to change a contract's payment terms as tracked changes.
npm install @superdoc/sdk ai@6 @ai-sdk/anthropic@3
curl -fL https://raw.githubusercontent.com/superdoc/docx-editor/refs/heads/main/assets/sample-contract.docx -o sample-contract.docxSet ANTHROPIC_API_KEY and ANTHROPIC_MODEL before running it.
import { SuperDocClient, createAgentToolkit } from '@superdoc/sdk';
import { anthropic } from '@ai-sdk/anthropic';
import { generateText, jsonSchema, stepCountIs } from 'ai';
const client = new SuperDocClient({
user: { name: 'Contract assistant', email: '[email protected]' },
});
try {
await client.connect();
const doc = await client.open({ doc: './sample-contract.docx' });
const toolkit = await createAgentToolkit({
provider: 'vercel', preset: 'core', enforceChangeMode: 'tracked',
});
const tools = Object.fromEntries(toolkit.tools.map(tool => [tool.name, {
description: tool.description,
inputSchema: jsonSchema(tool.inputSchema),
execute: args => toolkit.dispatch(doc, tool.name, args),
}]));
await generateText({
model: anthropic(process.env.ANTHROPIC_MODEL),
system: toolkit.systemPrompt,
prompt: 'Change payment terms from 60 to 30 days',
tools,
stopWhen: stepCountIs(10),
});
await doc.save({ out: './sample-contract-reviewed.docx' });
} finally {
await client.dispose();
}Your LLM chooses which SuperDoc tools to call; SuperDoc runs the document
operations and, with enforceChangeMode: 'tracked', records every edit as a
tracked change. Document content sent to the model is subject to the model
provider's policies.
Before saving in production, check each edit's receipt. See Build an agent for the full loop and verification, and real-time collaboration to have agents and users edit the same document at once.
examples/: small, runnable projects for common workflows.- demos.superdoc.dev: full demo applications, including custom UIs.
SuperDoc reads, renders, edits, and writes DOCX files through their Office Open XML (OOXML) parts.
- Open. The engine parses content, styles, relationships, media, headers, footers, and the other OOXML parts into editable document state.
- Render. The layout engine paginates that state, and the browser paints the resolved pages. OOXML remains the document format.
- Edit. Editor input and headless operations update document state through the Document API: queries, targets, mutations, and receipts.
- Write. Save and export write changes back into the OOXML package instead of rebuilding a DOCX from HTML.
The same engine runs without a browser DOM, so the editor, SDKs, CLI, and MCP server share one document model.
| Package | Purpose |
|---|---|
superdoc |
Browser DOCX editor for JavaScript and TypeScript. |
@superdoc/react |
React wrapper for the editor. |
@superdoc/vue |
Vue wrapper for the editor. |
@superdoc/sdk |
Node.js SDK for headless DOCX editing and agent toolkits. |
@superdoc/cli |
superdoc command-line interface. |
@superdoc/mcp |
MCP server for AI agents and MCP clients. |
@superdoc/fonts |
Optional metric-compatible font substitutes. |
superdoc-sdk (PyPI) |
Python SDK. See the Python SDK guide. |
superdoc-sdk (crates.io) |
Rust SDK. See its README. |
Stable releases are published to npm as latest. To try fixes and features
from main before they reach stable, install the next tag, for example
npm install superdoc@next. See the
release notes.
Start with llms.txt, or copy a
starter prompt. Agents working in
this repository start with AGENTS.md.
Documentation, tool discovery, and usage rules
Machine-readable documentation:
llms.txt: index of every documentation page.llms-full.txt: all authored guides in one file.llms-reference.txt: the generated Document API reference. Prefer the focused reference pages when you need only a few operations.- Context7: the documentation indexed for retrieval.
Tool discovery:
- The MCP server serves every tool's JSON Schema, generated from the Document API contract.
getToolCatalog('core')orgetToolCatalog('legacy')in@superdoc/sdkreturns the same data for that preset. Read the advertised schema rather than a copy of it. superdoc discover "<intent>"andsuperdoc describe command <name>search and explain the CLI contract.- The custom-actions skill teaches Claude Code or Codex to extend the SDK's actions.
- Agent safety covers filesystem boundaries, content sent to model providers, and review.
Usage rules:
- The browser editor needs a browser. Use
@superdoc/sdkin Node.js API routes. - The Python SDK installs as
superdoc-sdkand importsSuperDocClientfrom thesuperdocmodule. - Document modes control editor behavior; your application manages access permissions.
- Record edits as tracked changes with
documentMode: 'suggesting'in the editor orchangeMode: 'tracked'for supported headless mutations. - Find text targets with
query.matchand pass the returned target to the mutation. Do not construct targets from OOXML IDs. - Inspect mutation receipts and errors before treating an edit as complete.
SuperDoc runs inside your infrastructure and does not require document content to be sent to or stored by SuperDoc. For enterprise reviews, a SOC 2 Type II report, architecture and data-flow materials, and a software bill of materials are available. See Trust & Security.
Report suspected vulnerabilities privately as described in SECURITY.md.
Ask questions on Discord, and follow product updates in the changelog.
Community contributions start with an issue. Bug reports, feature requests, and technical investigations are welcome. Pull requests are limited to repository collaborators. Read the contributing guide and the Code of Conduct.
Thank you to everyone who has helped us build and improve the SuperDoc editor.
AGPLv3 for open source use. A commercial license is available for proprietary deployments. For questions, contact the SuperDoc team or email [email protected].


