Skip to content

About

SuperDoc - DOCX Editor and Agent SDK for reviewing, filling, and editing documents. Fully customizable.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1.1k stars

Watchers

7 watching

Forks

Latest commit

 

History

8,817 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SuperDoc

SuperDoc npm version SuperDoc monthly npm downloads License: AGPLv3 Join the SuperDoc Discord community

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

Quick start: DOCX editor

SuperDoc DOCX Editor and toolbar and sidepanel showing an editable document pages with tracked changes and comments

npm install superdoc

SuperDoc 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.

Quick start: DOCX agent

SuperDoc agent workflow showing an LLM using the SDK to add a risk review comment to a DOCX contract.

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.docx

Set 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: 'assistant@example.com' },
});

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.

Demos and examples

How SuperDoc works

SuperDoc reads, renders, edits, and writes DOCX files through their Office Open XML (OOXML) parts.

  1. Open. The engine parses content, styles, relationships, media, headers, footers, and the other OOXML parts into editable document state.
  2. Render. The layout engine paginates that state, and the browser paints the resolved pages. OOXML remains the document format.
  3. Edit. Editor input and headless operations update document state through the Document API: queries, targets, mutations, and receipts.
  4. 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.

Packages

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.

For AI agents

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:

Tool discovery:

  • The MCP server serves every tool's JSON Schema, generated from the Document API contract. getToolCatalog('core') or getToolCatalog('legacy') in @superdoc/sdk returns the same data for that preset. Read the advertised schema rather than a copy of it.
  • superdoc discover "<intent>" and superdoc 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/sdk in Node.js API routes.
  • The Python SDK installs as superdoc-sdk and imports SuperDocClient from the superdoc module.
  • Document modes control editor behavior; your application manages access permissions.
  • Record edits as tracked changes with documentMode: 'suggesting' in the editor or changeMode: 'tracked' for supported headless mutations.
  • Find text targets with query.match and 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.

Security

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.

Community and contributing

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.

Contributors

Thank you to everyone who has helped us build and improve the SuperDoc editor.

SuperDoc contributors across V1 and V2

License

AGPLv3 for open source use. A commercial license is available for proprietary deployments. For questions, contact the SuperDoc team or email q@superdoc.dev.

About

SuperDoc - DOCX Editor and Agent SDK for reviewing, filling, and editing documents. Fully customizable.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1.1k stars

Watchers

7 watching

Forks

Releases

Used by

Contributors

Languages