docx is a free, open source browsers & extensions project written in TypeScript and released under MIT. It has 5,908 GitHub stars, 608 forks and 162 open issues, and was last pushed 1 months ago. On this registry it ranks #55 of 101 tracked projects in Browsers & Extensions, with 5 head-to-head comparisons available.

What is docx?

docx is a TypeScript library, published on npm as docx under the MIT licence, that generates and modifies .docx files through a declarative JavaScript and TypeScript API and runs both in Node and in the browser.

What it is

docx is an open-source JavaScript and TypeScript library for creating and editing Word .docx documents programmatically. Its API is declarative: code describes paragraphs, tables, images, headers, footers and page settings, and the library assembles the resulting Office Open XML package. The same package targets two runtimes, so a document can be built in a Node service or generated directly in a browser tab without a server round trip. Documentation lives at https://docx.js.org/, and an interactive playground called the Docx.js Editor lets developers write code and preview the resulting document in real time.

The concrete problem it solves is that .docx is a compressed XML package with a large and unforgiving schema. Assembling that package by hand, or driving a headless office suite to produce it, is fragile and heavy. docx replaces hand-rolled OOXML string generation with a typed, composable builder. It sits in the TypeScript and Node ecosystem, is published to npm, and is consumed in browser front ends as well as in Express-based back ends, as the repository topics indicate.

Key capabilities

  • Generates new .docx files and modifies existing ones through one declarative API, in both Node and the browser.
  • Ships TypeScript types, so document structure is checked at compile time rather than at runtime.
  • Builds paragraphs and text runs, demonstrated in the RunKit examples docx-demo1 and docx-demo2.
  • Produces bullet-point lists and simple tables, shown in docx-demo3 and docx-demo4.
  • Embeds images into documents, covered by docx-demo5 and by the React image example.
  • Controls page layout: margins in docx-demo6 and landscape orientation in docx-demo7.
  • Adds headers and footers through docx-demo8, and the project publishes a CV built entirely with the library.

Who uses it and how

  • Front-end teams in Angular, React and Vue, for which the README links working StackBlitz examples, including a React case that inserts images into the generated document.
  • Plain HTML and JavaScript pages that need client-side export, demonstrated with CodePen and JSFiddle samples.
  • Node services and Express applications, where the library runs server-side to produce documents on demand.
  • Product teams at companies listed in the README's "Used by" section, including Mettzer, Wisedoc, Dabble Writer, Turbopatent, Beekast, Arity, Circadian Risk, Lexense, NovelPad, Proton and Herraizsoto.
  • Projects whose owners generate resume-style and long-form documents, for which the repository keeps a demo folder of runnable examples.

Getting started

Install the package from npm as docx and follow the usage guide at https://docx.js.org/, or try the Docx.js Editor playground to code and preview output in real time. Node users can also run the RunKit demos without installing anything.

How it compares

No comparable or paid alternative tools are named in the facts provided for this registry, so docx stands alone here rather than being contrasted against a specific commercial product. Teams evaluating it should compare it directly against whatever document pipeline they currently run.

When to use it — and when not

Because docx is a library rather than a service, adopting it means no server, database or storage layer to operate: it runs wherever JavaScript runs, and the resulting file is handed to the caller to save, download or attach. It is not the right choice for teams that need output formats other than .docx, since the project's stated scope is generating and modifying Word documents only. The repository carries 162 open issues and 608 forks, so prospective users should check the current issue tracker against their own requirements before committing.

project readme (upstream, from github) — read inline

Easily generate and modify .docx files with JS/TS. Works for Node and on the Browser.


NPM version Downloads per month GitHub Action Workflow Status Known Vulnerabilities PRs Welcome codecov Docx.js Editor

drawing

Demo

Browser

Here are examples of docx being used with basic HTML/JS in a browser environment:

Here are examples of docx working in Angular:

Here are examples of docx working in React:

Here is an example of docx working in Vue.js:

Node

Press endpoint on the RunKit website:

RunKit Instructions

More here

How to use & Documentation

Please refer to the documentation at https://docx.js.org/ for details on how to use this library, examples and much more!

Playground

Experience docx in action through Docx.js Editor, an interactive playground where you can code and preview the results in real-time.

Examples

Check the demo folder for examples.

Contributing

Read the contribution guidelines here.

Used by

drawing drawing drawing drawing drawing drawing drawing drawing drawing drawing drawing drawing drawing drawing drawing

...and many more!


patreon browserstack

Made with 💖

Frequently asked questions

Is docx free to use?

docx is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does docx do?

Easily generate and modify .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.

What is docx written in?

docx is primarily written in TypeScript. Its source is publicly available at https://github.com/dolanmiu/docx, and it has 5,908 GitHub stars.