# document-engine-core
[](https://www.npmjs.com/package/@phuong-tran-redoc/document-engine-core) 
A **framework-agnostic** document editor core built on [Tiptap](https://tiptap.dev/) and [ProseMirror](https://prosemirror.net/). It packages the custom extensions, nodes, schema kit, and headless helpers that power the Document Engine, with no framework dependency.
---
## 🎯 Overview
`document-engine-core` is the heart of the Document Engine. It contains the editor schema (the canonical extension/node set), business extensions (dynamic fields, restricted editing, styled tables, indentation, text case), a headless HTML serializer, and a small document-migration system — all as plain ESM TypeScript that runs in the browser or in Node.
### Key Features
- **Framework-agnostic ESM:** pure TypeScript, usable from Angular, React, Vue, or headless Node.
- **Ready-made schema kit:** `defaultExtensions` — the canonical node/mark/structure set the editor ships with.
- **Business extensions:** Dynamic Fields (`{{customer_name}}`), Restricted Editing (editable regions), Styled Tables, Indent, Text Case, custom Ordered List.
- **Headless serialization:** `generateHTML(doc)` renders a ProseMirror JSON document to HTML on the server (env-aware) or in the browser.
- **Document migrations:** `EditorDocument` wrapper + `migrateDoc()` to version and upgrade stored content.
- **JSON-first data model:** documents are ProseMirror JSON, not raw HTML.
---
## 📦 Installation
```bash
npm install @phuong-tran-redoc/document-engine-core
# or
pnpm add @phuong-tran-redoc/document-engine-core
```
Published publicly on npm under the MIT license.
### Peer Dependencies
Only one peer dependency — Tiptap/ProseMirror ship as bundled dependencies and are installed automatically:
```json
{
"lodash-es": "^4.17.10"
}
```
> Built against `@tiptap/* ^3.26.0` (bundled). If your app also uses Tiptap directly, align on the same major to share a single ProseMirror instance.
---
## 🚀 Quick Start
### Build an editor with the default schema
```typescript
import { Editor } from '@tiptap/core';
import { defaultExtensions } from '@phuong-tran-redoc/document-engine-core';
const editor = new Editor({
element: document.querySelector('#editor')!,
extensions: [...defaultExtensions],
content: '