π δΈζη
An open-source rich-text collaborative editor that puts your data back in your hands β real-time sync, knowledge base management, text-to-diagram, spreadsheets, and multi-format export.
- Rich text editing: headings, lists, blockquotes, task lists, code blocks (syntax highlighting), tables, images, links, text styling, and more
/slash command: type/to open the command palette with fuzzy search β supports pinyin abbreviations for Chinese users- Floating toolbar: auto-appears on text selection, all formatting actions within two centimeters of your cursor
- Block drag-and-drop: hover the left edge of any paragraph to reveal a drag handle β reorder content like building blocks
- Collapsible sections: fold away sections you're not working on; collapse state persists across sessions
- Auto heading numbering: one-click toggle β H1βH4 headings automatically maintain hierarchical numbering (
1.1.11.1.1) - Keyboard shortcuts:
β₯β/βmove blocks,βDduplicate blocks,ββ₯1/2/3/0switch heading levels
Write Mermaid or PlantUML source code directly in your document. Diagrams render in place. Double-click to edit, fullscreen view, pinch-to-zoom β no more export-import-replace cycles with draw.io.
- Mermaid: flowcharts, sequence diagrams, class diagrams, Gantt charts, state diagrams, and more
- PlantUML: sequence diagrams, class diagrams, use case diagrams, component diagrams, and more
A full spreadsheet engine embedded in your documents:
- Formula evaluation, cell formatting
- Freeze panes, sort & filter
- Cell merge / split
- CSV import / export
Use it inline as a content block, or pop it out as a standalone full-screen spreadsheet.
- Knowledge Base β Folders (nestable) β Documents β a three-level structure
- Drag-and-drop reordering, renaming, and moving in the sidebar
- Whole-KB ZIP export preserving folder hierarchy, with bundled images
- Lossless native
.doco.ziptransfer for a document, folder, or whole knowledge base
Built on the Yjs CRDT algorithm:
- No save button β changes sync automatically
- Offline-first: browser IndexedDB is the primary store; the server holds a snapshot. Edit without a network, merge automatically when reconnected
- Seamless device switching: close your laptop, pick up your phone, keep writing
| Format | Import | Export |
|---|---|---|
| Doco native package | β Document / folder / KB | β Lossless document / folder / KB |
| Markdown | β Paste / file upload | β Single doc & KB bundle |
| Word (DOCX) | β | β |
| β | β | |
| HTML | β | β |
| WeChat Official Account | β | β (with theme preview) |
| Images (in-document) | β (paste / drag-drop) | β (bundled in ZIP) |
A full REST API (OpenAPI 3.1 spec, Bearer Token auth, ETag versioning). Turn your docs into programmable assets β script your own backups, let an agent organize your knowledge base, pipe docs from your publishing workflow to your blog.
Built-in API documentation page, ready to use out of the box.
| Layer | Technology |
|---|---|
| Frontend Framework | React 18 + Vite + TypeScript |
| CSS | Tailwind CSS v4 |
| Editor | Tiptap v3 (ProseMirror) |
| Collaboration | Yjs (CRDT) + Hocuspocus |
| Diagrams | Mermaid + PlantUML |
| Backend | Node.js + Express + Hocuspocus Server |
| Database | better-sqlite3 (SQLite, WAL mode) |
| UI Components | Radix UI, Lucide React, Tippy.js |
- Node.js >= 18
- pnpm
# Install frontend dependencies
pnpm install
# Install backend dependencies
cd backend && npm install && cd ..
# Start the frontend dev server (Vite, default :5173)
pnpm run dev
# In another terminal, start the backend (Express + WebSocket, default :8000)
cd backend
npm run devOpen http://localhost:5173 β it will auto-connect to the backend WebSocket service.
The complete self-hosted package includes a Caddy frontend, Node.js collaboration backend, persistent SQLite storage, health checks, and a same-origin WebSocket proxy. The public images support both linux/amd64 and linux/arm64.
git clone https://github.com/songofhawk/doco.git
cd doco
cp .env.docker.example .env.docker
# Review .env.docker first, then start with prebuilt Docker Hub images
docker compose --env-file .env.docker up -d
# Verify the deployment
docker compose --env-file .env.docker ps
curl --fail http://localhost:8080/healthzOpen http://localhost:8080 by default. Set ALLOWED_ORIGINS, COOKIE_SECURE, Google OAuth, and SMTP values in .env.docker for your environment. These values are injected when the containers start and are not baked into the images. Application data is stored in the doco-data named volume.
Docker Hub: songofhawkg/doco-frontend Β· songofhawkg/doco-backend
To build the same images from source instead:
docker compose --env-file .env.docker up -d --buildSee the Docker deployment guide for all configuration options, HTTPS, logs, backup, restore, and upgrades. Do not run docker compose down -v unless you intend to delete the database and attachments.
# Frontend build
pnpm run build # output β dist/
pnpm run deploy # deploy to Cloudflare Pages
# Backend (production)
cd backend
npm startdoco/
βββ src/
β βββ main.tsx # App entry point
β βββ App.tsx # Root component, routing, import/export
β βββ components/
β β βββ Sidebar.tsx # KB sidebar (document tree)
β βββ editor/ # Editor module
β βββ index.ts # Entry, exports DocoEditor component
β βββ DocoEditor.tsx # Editor core (Yjs/Hocuspocus init, extension registration)
β βββ types.ts # DocoEditor Props/Ref type definitions
β βββ components/
β βββ BubbleMenu.tsx # Selection floating toolbar
β βββ BlockHandle.tsx # Block drag handle
β βββ SlashCommand.ts # / command palette
β βββ CommandList.tsx # Command palette UI
β βββ suggestions.ts # Command menu data
β βββ CollapseExtension.ts # Block collapse extension
β βββ DocSettings.tsx # Document settings (heading numbering, background)
β βββ MermaidBlock.ts # Mermaid node definition
β βββ MermaidComponent.tsx # Mermaid renderer
β βββ PlantUMLBlock.ts # PlantUML node definition
β βββ PlantUMLComponent.tsx # PlantUML renderer
β βββ CalloutBlock.ts # Callout block definition
β βββ CalloutComponent.tsx # Callout renderer
β βββ SpreadsheetBlock.ts # Spreadsheet node definition
β βββ SpreadsheetComponent.tsx # Spreadsheet renderer
β βββ spreadsheetEngine.ts # Spreadsheet calculation engine
β βββ WeChatExportDialog.tsx # WeChat Official Account export
β βββ KeyboardShortcuts.ts # Keyboard shortcuts
β βββ TableOfContents.tsx # Table of contents
β βββ CodeBlockComponent.tsx # Code block (highlight + copy)
β βββ ImageComponent.tsx # Image renderer
βββ backend/
β βββ server.js # Entry: Express + Hocuspocus + export routes
β βββ database.js # better-sqlite3 init & schema
β βββ api.js # KB / folder / document REST API
β βββ auth.js # Auth (OAuth + Email + API Token)
β βββ markdown.js # YDoc β Markdown server-side export
β βββ permissions.js # Permission management
β βββ quota.js # Quota management
β βββ openapi.js # OpenAPI spec definition
β βββ tests/ # Backend tests
βββ docs/ # Design docs & proposals
import { DocoEditor } from './editor'
import type { DocoEditorRef } from './editor/types'
const editorRef = useRef<DocoEditorRef>(null)
<DocoEditor
ref={editorRef}
docId="doc-001"
userId="user-001"
collaboration={{
websocketUrl: 'ws://localhost:8000',
}}
onTitleChange={(docId, title) => console.log('Title changed:', title)}
placeholder="Start writingβ¦"
/>
{/* Call export methods via ref */}
<button onClick={() => editorRef.current?.exportMarkdown()}>Export MD</button>Browser IndexedDB (y-indexeddb) β local primary store
β
Browser Y.Doc β @hocuspocus/provider (WebSocket)
β Yjs binary delta messages
Server @hocuspocus/server β SQLite ydoc_state (one merged snapshot per doc)
- The browser IndexedDB is the primary store; the server snapshot is auxiliary. If the server snapshot is lost, simply open the document in the browser to repopulate it.
- Offline editing works seamlessly; changes sync automatically when the network returns.
- Collaborative cursors: supported by the framework, not enabled by default.
Both single documents and KB bundles support Markdown export, generated on-the-fly from YDoc on the server:
# Single document export
curl http://localhost:8000/api/docs/{id}/export.md
# KB ZIP bundle
curl http://localhost:8000/api/kb/{id}/export.zipCustom nodes (Mermaid, PlantUML, Callout, etc.) have corresponding serialization rules in backend/markdown.js. When adding new custom nodes, update the server-side serializer accordingly.
Use Export Doco File in a document, folder, or knowledge-base menu. The resulting .doco.zip contains the original Yjs state, hierarchy, document settings, standalone spreadsheets, and attachments. Importing always creates a copy with fresh resource and attachment IDs, so it can safely move between independent Doco deployments without colliding with existing data.
Use the upload button beside the knowledge-base heading to import a whole knowledge base. To import a document or folder package, choose Import Doco File from the destination knowledge base or folder menu.
MIT