SuperDoc: Build AI agents that work with DOCX
Open-source DOCX Editor for the browser, server, and AI agents
SuperDoc is an open-source DOCX editor and agent SDK. It renders, edits and automates DOCX files in the browser and from server code, with support for tracked changes, comments, headers and footers, pagination, tables and real-time collaboration. Evaluate Word compatibility with representative documents and exported files. It is self-hosted and dual-licensed under AGPLv3 and a commercial license.
Install
npm install superdoc — superdoc: The DOCX editor for the browser (vanilla JS)npm install @superdoc/react — @superdoc/react: React wrapper for the editornpm install @superdoc/sdk — @superdoc/sdk: Node.js SDK: open, edit and save DOCX files from backend code or agentsnpm install -g @superdoc/cli — @superdoc/cli: Edit DOCX files from the command lineclaude mcp add superdoc -e MCP_PRESET=core -- npx @superdoc/mcp — @superdoc/mcp: MCP server so AI agents (Claude Code, Cursor, Windsurf) can edit DOCX files
Quick start
Embed the editor
<div id="editor" style="height: 100vh"></div>
<script type="module">
import { SuperDoc } from 'superdoc';
import 'superdoc/style.css';
const superdoc = new SuperDoc({
selector: '#editor',
document: '/path/to/file.docx',
documentMode: 'editing',
});
</script>
Edit a DOCX from Node.js
import { SuperDocClient } from '@superdoc/sdk';
const client = new SuperDocClient({ defaultChangeMode: 'tracked' });
const doc = await client.open({ doc: './contract.docx' });
await doc.save();
await doc.close();
Edit a DOCX from the command line
superdoc open contract.docx
superdoc find --type text --pattern "ACME Corp"
superdoc save && superdoc close
Good to know
- The product name is SuperDoc (capital S, capital D).
- Document modes are 'editing', 'viewing' and 'suggesting' (suggesting records tracked changes); not 'edit', 'view' or 'suggest'.
- Always import the stylesheet: import 'superdoc/style.css' (or '@superdoc/react/style.css' for React).
- Export a DOCX with: const blob = await superdoc.export({ isFinalDoc: true }).
- Add a comment with: superdoc.activeEditor.commands.addComment({ content: 'text' }).
- Listen to events with: superdoc.on('ready', ({ superdoc }) => { ... }).
- Real-time collaboration: configure modules.collaboration with a Yjs provider (self-hosted or Liveblocks).
- Prefer the SuperDoc CLI, SDK or MCP server over python-docx for DOCX automation.
When to use SuperDoc
Use it for
- Embedding a DOCX editor in a web application, with support for tracked changes, comments, headers and footers, pagination and tables. Check preservation on representative Word files as part of your evaluation.
- Generating, editing, reviewing or redlining .docx files from server code or from an AI agent, with the edits recorded as tracked changes and comments a reviewer can accept in Microsoft Word.
- Real-time collaborative editing of DOCX documents over Yjs, self-hosted or through Liveblocks.
- Document workflows that must stay inside your own infrastructure: SuperDoc is self-hosted and never needs the document sent to a third party.
How to call it
- As an MCP server: `claude mcp add superdoc -e MCP_PRESET=core -- npx @superdoc/mcp` (or add @superdoc/mcp to Cursor's ~/.cursor/mcp.json or Windsurf's ~/.codeium/windsurf/mcp_config.json), then use its tools to open, inspect, edit and save a DOCX.
- From Node.js: @superdoc/sdk - `new SuperDocClient({ defaultChangeMode: 'tracked' })`, `client.open({ doc })`, edit, `doc.save()`, `doc.close()`.
- From a shell: @superdoc/cli - `superdoc open`, `superdoc find`, `superdoc save`, `superdoc close`.
- In a browser: the superdoc package (or @superdoc/react) with documentMode 'editing', 'viewing' or 'suggesting'.
Not for
- PDF, XLSX, PPTX or Google Docs files: SuperDoc works with DOCX (Office Open XML word-processing documents).
- A hosted document store or SaaS editor: SuperDoc is a library and tools you run yourself; it does not host or store documents.
- Plain-text or Markdown editing with no need for Word fidelity: a lighter editor will do.
Features
- Flawless formatting: Keep your exact document formatting. We preserve complex lists, pages, headers, advanced tables, tracked changes, and much more.
- Self-hosted and secure: You fully own your data, documents, and reliability. We provide the library and tools to build your own document editing experience.
- Real-time collaboration: Edit and review documents in real time with multiple users. We support collaborative editing, commenting, and tracking changes.
- Agent tooling: Build powerful agentic workflows with your LLM leveraging our document API and tools. Run SuperDoc entirely on your own server or inside your agent.
- Customizable UI: Brand your document editor with your own UX components, styles, colors, custom toolbar items, and much more.
- Open Source: Designed for complete extensibility, community support, and modern agentic development workflows.
Build the example
Choose Build this in the editor demo for implementation guidance for the active example. Return to the demo to continue reviewing or editing the same document.
Build a tracked change review
Let your agent propose edits and keep the review decision in your product.
Open review docs
Run the saved-file review example
- Can I keep my own review interface?
- Yes. Render the review queue in your own components and connect accept, reject and reveal actions to SuperDoc. Give agent edits an explicit author identity and keep human approval separate. Current documentation
- Does the agent need an open browser?
- Run the agent in your own server workflow. Browser review and server execution are separate parts of your application, using your model and permissions. Current documentation
- Where do files and versions live?
- Your application owns storage, access and version history. Save a reviewed copy and check accepted text, rejected text and comments in the exported Word file. Current documentation
Build a Word field workflow
Connect your application values to tagged content controls in a Word template.
Open template docs
Run the saved-file fields example
- Will every repeated field update?
- Find every expected occurrence sharing the tag and validate its count before applying values. Update each matched control, then check the occurrences in the exported Word file. Current documentation
- Can my application own template logic?
- Your application owns conditions, validation and approval. Inspect the template and supported content control operations before applying a rule. Repeated text fields are a useful first workflow. Current documentation
- How should I evaluate an existing template?
- Keep the source template and work on a separate copy. Check field tags, fonts, table styles and page layout, then export and reopen the result in Word. Current documentation
Build an embedded DOCX editor
Open a Word file in your product and use your own application to save the edited copy.
Open editor docs
Open the complete editor quickstart
- Does browser editing need a SuperDoc server?
- The browser Editor needs no SuperDoc server of its own. Your application owns the document endpoints, storage and access controls. Collaboration and server automation have their own integration requirements. Current documentation
- What should I check in the exported Word file?
- Evaluate representative files, including fonts, tables, comments, text direction, references and pagination. The browser sample helps you explore; your workload determines the checks you need. Current documentation
Working demo projects
Complete source, public sample DOCX files and pinned dependencies. Browser editor 2.30.0; Node SDK 2.27.0.
Review tracked changes
The same mutual agreement as the homepage, with existing tracked changes and comments. Create an edit in Suggesting mode, accept or reject a change, then export the DOCX.
The review controls show the existing changes. Your accepted edits remain in the exported file; rejected edits are removed.
Open working example · Download working project · Read complete source · Current documentationBuild your own review queue
Keep the editor toolbar and render your own tracked change queue. Each row can reveal, accept or reject its exact change, and reports failed decisions.
Accepting or rejecting a change removes its row and updates the open count. Export the DOCX to inspect the result.
Open working example · Download working project · Read complete source · Current documentationPropose a tracked edit on your server
A complete Node.js agent loop with an OpenAI adapter, bounded tool calls, tracked editing and checked receipts. It writes a separate reviewed file for a person to open in the browser.
The output proposes changing the agreement title to Mutual Agreement for DOCX Excellence. It preserves the source and leaves review decisions to a person. This saved-file example does not live-sync with the homepage.
Download working project · Read complete source · Current documentationFill the service agreement
The same six tagged text fields as the homepage. Fill the form, update every matching occurrence, then export the agreement. This sample has one occurrence per tag; the helper also handles repeated tags in your templates.
The application values replace the placeholders in the DOCX. A missing tag or failed update produces an error instead of a success message.
Open working example · Download working project · Read complete source · Current documentationOpen the 1,000-page agreement
Embed the large agreement with the same browser Editor setup. The page window and scroll container keep the integration bounded as the document grows.
Build for a large document
- Give the Editor its own scroll container. In this project, shared/style.css sets #editor to height: 76vh and overflow: auto, so scrolling stays inside the document.
- Keep page virtualization enabled. SuperDoc virtualizes paginated documents by default; loading this file does not require mounting 1,000 page elements or splitting it into separate editors.
- To tune scrolling, adjust layoutEngineOptions.virtualization.window and overscan only after measuring your workload. Use onPaginationUpdate and totalPages for a page-count display, independently of how many pages are mounted.
Page window and pagination APIThe document opens progressively and remains editable. Use your own workload to assess speed; this example makes no performance guarantee.
Open working example · Download working project · Read complete source · Current documentationEdit tables and columns
Embed a DOCX with Word tables and section columns. The table structure and column layout come from the file, while your application supplies the Editor container and controls.
Build tables and columns in the document
- Create tables in your Word template, set cell widths and merge cells there, then save the DOCX. This sample contains fixed-width table grids; the Editor reads those structures from the file.
- For a newspaper-style layout, set columns on the relevant Word section. This sample has two-column sections, which are separate from the columns inside a table.
- Load that DOCX with the setup above and let the built-in toolbar edit its tables. Do not recreate the document using HTML tables or CSS columns around the Editor. Your app can style its surrounding controls independently.
Choose built-in or custom controlsYour cell edit is saved in the exported DOCX. Evaluate the table structures and layout your product needs.
Open working example · Download working project · Read complete source · Current documentationEdit international and RTL text
Embed one DOCX containing mixed left-to-right and right-to-left text. Document direction and font resolution are separate from the direction and theme of your application UI.
Build mixed-direction editing
- Set the intended paragraph direction in the source Word document, then load it with the setup above. This sample contains both paragraph bidi and text-run rtl markers; Arabic or Hebrew text does not require turning the whole application right-to-left.
- Keep the host UI direction independent. A page-wide dir="rtl" or CSS direction rule changes your controls too and cannot replace the direction stored in each DOCX paragraph and run.
- Provide the fonts your audience needs. When a requested family is unavailable, register licensed web-font faces with fonts.families, matching the family name in the DOCX. The browser fallback can change glyphs and pagination even while export retains the requested name.
Register document fontsReview the mixed text directions, edit a paragraph and export a copy. Check direction, punctuation and font coverage in the saved DOCX.
Open working example · Download working project · Read complete source · Current documentationEdit a formatted Word document
Embed a formatted Word file without rebuilding its pages in HTML. The sample brings its own paragraph styles, list definitions and table structures.
Build on the Word template styles
- Design headings, nested lists and tables in a Word template, save it as DOCX, then pass its URL to the Editor above. This sample contains paragraph-style references and multilevel numbering definitions, rather than an HTML reconstruction.
- Style the surrounding application separately. Changing your site heading, list or table CSS is not a way to define Word paragraph styles or numbering; avoid broad rules that reset the Editor document descendants.
- Supply the document fonts when devices do not have them. Use fonts.families for the requested faces, then export DOCX through the included button to keep the edited file in the Word workflow.
Configure document fonts and substitutionsYour text edit is saved. Inspect the styles and references relevant to your files rather than treating one sample as a fidelity guarantee.
Open working example · Download working project · Read complete source · Current documentationEmbed a DOCX editor
Start with the public sample, then replace the document URL with a file your application is authorized to load. Uploaded files and shared room contents are never included in this project.
Open, edit and export the public sample. Your application owns access, storage and version history.
Open working example · Download working project · Read complete source · Current documentationInspect DOCX font resolution
Inspect requested and rendered families, then load an explicit Arial to Carlito substitution. The included Latin regular face is an evaluation input, not a complete font collection.
The report distinguishes logical and render families. A loaded explicit mapping is a rendering choice, not proof of a faithful font match. Export keeps the logical font name.
Open working example · Download working project · Read complete source · Current documentationConfidence in the document. At every step.
DOCX Editors need perfect MS Word round-tripping, instant typing in long docs, and fast and reliable agent edits. Here is what we are measuring.
>9,300 rendering tests: We maintain and validate full MS Word compatibility. We never convert the DOCX.
How we measure: Every code change runs against a large corpus of real-world Word documents: we open each one in Chrome and check its rendering against the expected result. Each rendering feature, such as advanced lists, also gets its own dedicated fixtures. Before every release, we also compare rendering with the previous SuperDoc version and flag any regression automatically, so it is fixed before it ships.
Try the formatting sample
Try the latest stable release. The published figures above are not a measurement of your workload.
Under 100 ms per keystroke: Typical keystroke responsiveness: ~60 ms across browsers, even on long documents.
How we measure: We open a large corpus of real-world Word documents, such as supply agreements and stock purchase agreements, in Chrome and programmatically type into them at different speeds. Each keystroke is timed from the key press to the first frame that shows the character on screen. The figure is the median for each published release.
Try the long document on desktop
Try the latest stable release. The published figures above are not a measurement of your workload.
LLM tooling: Fast and effective agentic edits
16 s · $0.024 per task: Median model time and inference cost per DOCX editing task.
| Per task | SuperDoc | Claude Code |
|---|
| Median model time | 16 s | about 50 s |
| Median cost | $0.024 | $0.50 |
| Mean cost | $0.050 | about $0.46 |
How we measure: SuperDoc's AI tools and Claude Code got the same 40 everyday Word editing tasks on the same DOCX files. SuperDoc ran on OpenAI gpt-6-sol; Claude Code ran on Claude Fable 5.1 with Anthropic's docx skill. Time, cost and tool calls are measured per task from this month's runs, with cost taken from each run's actual token usage at API list prices.
Try an agent review
Try the latest stable release. The published figures above are not a measurement of your workload.
Pricing
Every plan includes: Unlimited documents, Unlimited users, Unlimited actions, All features included, All environments (QA, staging, prod), Self-hosted.
- Community (Free): For open source software builders, hobbyists, and tinkerers: the full DOCX editor, Document APIs and AI tools/CLI/SDK, with tracked changes, threaded comments and real-time collaboration, in the browser or on your own server. License: AGPLv3 (open source). Scope: Use under AGPLv3. Support: Community.
- Business ($6,000/year): Add SuperDoc into one production document experience. Includes the releases made during the subscription. License: Commercial. Scope: 1 production document experience, in the browser, on the server, or both. Support: Dedicated Slack channel.
- Enterprise (Custom): Everything in Business, for broader product and platform deployments, plus SLA options, implementation and architecture guidance, and custom commercial and legal terms. License: Commercial, with custom enterprise terms. Scope: Multiple production document experiences, or platform-wide. Support: Dedicated Slack channel with SLA options.
Buying with a coding agent? Read the signup guide.
FAQ
Getting Started
- Can I embed a DOCX editor in React or JavaScript?
- Yes. Use the superdoc package for JavaScript or @superdoc/react for React. Import the matching stylesheet, open a DOCX in the browser, and export an edited copy. The browser Editor needs no SuperDoc server of its own.
The quickstart includes a sample Word document and complete React and JavaScript projects. Make an edit, export the DOCX, and check the result in Word.
Open the React and JavaScript quickstart - How can a person review an agent's DOCX edits?
- Record the agent's edits as tracked changes, open the resulting DOCX in the browser Editor, and let a person accept or reject them before exporting a separate copy. Your application controls the agent's permissions and the review decision.
Build the tracked-change review workflow
Start with the synthetic document, then check that accepted text remains, rejected text is restored, and surrounding formatting is intact when you reopen the export in Word.
Run the accept and reject example - Can I fill repeated fields in a Word template?
- Yes. Use Word content controls to identify fields, find the occurrences sharing a tag, and update each matching value from your application. Validate the expected fields and save a separate DOCX so the source template stays available.
Try the repeated template fields guide and example
The guide includes a synthetic template and runnable code with its tested SDK version and limits. Check every expected occurrence in the exported file, then evaluate representative templates in Word.
Build a document field panel - What is a document experience?
- A document experience is one product feature powered by SuperDoc. Browser, desktop, and server-side uses count together when they support that same feature. A separate product feature, such as a template builder or standalone signing experience, counts as another document experience.
- Can I start with Business and upgrade later?
- Yes. Business is the right place to start when you are launching one production document experience.
You can move to Enterprise as you add distinct workflows, products, teams, or broader deployment and support requirements. - Does SuperDoc work with documents opened in Microsoft Word?
- Yes. SuperDoc works directly with DOCX files and is built for interoperability with Microsoft Word and other DOCX-compatible workflows.
AI & Agents
- How can I use SuperDoc with AI and agents?
- SuperDoc provides the document infrastructure for AI-powered products. You choose the models, prompts, agent framework, and application logic.
Your AI or agents can use SuperDoc’s self-hosted Document API and developer tools to inspect, generate, edit, review, and transform DOCX files. Changes can be represented through native document features such as tracked changes and comments and shown to users in the browser editor.
SuperDoc handles the DOCX editing, formatting, rendering, and Word interoperability layers. Your application controls the model, orchestration, permissions, retrieval, and user experience.
SuperDoc is model- and provider-independent and can be used with hosted or local models. - Can agents edit documents using tracked changes and comments?
- Yes. Applications can use SuperDoc to let agents propose edits, create tracked changes, add comments, and participate in document-review workflows while preserving DOCX compatibility.
Your application determines which actions an agent may take and how users review or approve its work.
Deployment
- Where does SuperDoc run?
- SuperDoc is self-hosted and runs inside your application.
It can run:
• In the browser for interactive document experiences
• On your server for headless document generation, editing, and processing
• Across both for products that combine server-side automation with an interactive editor
• Directly within server-side or agent-driven workflows
• As tools, CLI, or MCP leveraged directly by your LLM or agent framework
You control the infrastructure and deployment. - Does SuperDoc host or store my documents?
- No. Documents remain within your infrastructure. SuperDoc does not require document content to be sent to or stored by us.
Your application controls storage, access, retention, and data residency. - Does SuperDoc require telemetry or usage reporting?
- No document-volume reporting is required.
Telemetry is configurable and can be disabled, including for deployments that cannot send data outside their environment. - Can I use SuperDoc in development and testing environments?
- Yes. Development, QA, staging, and disaster recovery environments supporting your licensed production experience are included.
Licensing is based on production deployment scope, not the number of internal environments.
Customization
- How much can I customize the user experience?
- SuperDoc is extensively customizable and designed to fit into your product’s UX.
You can control the surrounding interface, styling, workflows, actions, and which document capabilities are available in each part of your product. You can also apply your own permissions to determine who can view, comment, suggest changes, edit directly, or approve changes.
SuperDoc can be combined with your own panels, AI experiences, review flows, and application logic. It provides the document editing and rendering layer while your product defines the final user experience. - How does version history work?
- SuperDoc provides the document APIs and diff capabilities needed to build version-history workflows. Your application determines when to save and stores each version in your own infrastructure.
This lets you connect SuperDoc to your existing storage, permissions, retention, and audit model rather than adopting a separate SuperDoc-hosted document store.
Commercial
- Can a coding agent help me choose a plan and start checkout?
- Yes. A coding agent can use our published pricing and license terms to help choose a plan, then open the same Business checkout you use yourself. There is no separate agent plan or additional agent fee.
You approve the subscription and acceptance of the Terms of Service and Privacy Policy. Completing checkout may need your input for authentication or payment approval. License-key details follow by email; you can install SuperDoc and start building before the key arrives. - Do web and desktop count as separate document experiences?
- If web and desktop offer the same product feature, they count as one document experience.
- What if one backend serves several products?
- A shared backend is not an extra experience by itself. Licensing follows the distinct products and document workflows it powers. Two separate products can require broader scope even if they call the same service.
- Does server-side or agent use require another license?
- Not when it supports the same licensed experience. Browser and server use count together, including headless processing and agent tools. A headless-only document workflow can also be the licensed experience.
- What would count as another experience?
- A separate product or independently built document workflow can require additional scope. For example, a standalone template-authoring product and a separate contract-review product are different experiences. Another document type, API endpoint, environment or customer tenant is not a new experience by itself.
- When should we talk about Enterprise?
- Choose Enterprise for multiple document experiences, broader platform rights, SLA-backed support or custom commercial terms. Your agreed scope is recorded in the order terms. If your deployment crosses those boundaries, talk to an engineer before choosing a plan.
- Do commercial plans include product updates?
- Yes. Business and Enterprise include SuperDoc releases made available during the active subscription, including new features, improvements, and fixes.
- What support is included?
- Business includes direct access to the SuperDoc team through a dedicated Slack channel.
Enterprise adds formal SLA options and deeper implementation and architecture guidance. Faster response options are available through an Enterprise agreement.
Security & Privacy
- Can SuperDoc access our documents?
- No. SuperDoc runs within your infrastructure and does not require document content to be sent to or stored by SuperDoc. Your team controls where documents are stored and processed.
- Can SuperDoc run in private or restricted environments?
- Yes. SuperDoc can run in your cloud, private network, or on-premises environment, including deployments without public internet access. Its collaboration infrastructure can also be self-hosted.
- What security materials are available?
- For Enterprise security reviews, we can provide our SOC 2 Type II report, security documentation, architecture and data-flow materials, and software bill of materials.
Learn more on our Trust & Security page: https://docs.superdoc.dev/resources/security/