dev-tools 5 min read

HawkDoc – Open-Source Notion-Style Editor Built on Lexical

HawkDoc is a high-performance, open-source document editor built on Meta's Lexical framework with template variables, slash commands, PDF export, and self-hosted deployment.

By
Share: X in
HawkDoc document editor interface

TL;DR

TL;DR: HawkDoc is an MIT-licensed, self-hosted document editor built on Meta’s Lexical framework. It ships with slash commands, template variables, PDF/HTML/Markdown export, and a PostgreSQL + Redis backend — deploy it on your own server for full data ownership.

Source and Accuracy Notes

⚠️ This section is MANDATORY. All links must be verified from actual source, not guessed.

What Is HawkDoc?

HawkDoc is a document editor focused on performance and template rendering, built on Lexical — Meta’s open-source editor framework that powers Facebook, Instagram, and WhatsApp’s rich text experiences.

The project targets users who want Notion-style editing with full data ownership. Unlike cloud-only editors, HawkDoc is designed to be self-hosted. The current MVP stage includes the core editor, with collaboration, authentication, and a DOCX export pipeline planned.

Setup Workflow

Prerequisites

  • Node.js 18+
  • Docker and Docker Compose (for PostgreSQL and Redis)
  • Git

Step 1: Clone and Install

git clone https://github.com/hawk-doc/hawkdoc.git
cd hawkdoc
npm install

Step 2: Start Database Services

docker compose up -d

This starts PostgreSQL and Redis as defined in the project’s docker-compose.yml.

Step 3: Configure Environment

cp apps/api/.env.example apps/api/.env
cp apps/web/.env.example apps/web/.env

Generate a JWT secret and paste it into apps/api/.env:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Step 4: Start Development Servers

npm run dev

Both the API server and web frontend start together. The web interface is available at http://localhost:3000.

Deeper Analysis

Architecture

HawkDoc splits into two parts:

  • apps/web — the frontend editor built on Lexical
  • apps/api — the backend API server (Node.js, likely Express or Fastify from the monorepo structure)

PostgreSQL stores document data and user state; Redis handles session management and real-time auto-save debouncing.

Editor Features

The Lexical foundation gives HawkDoc a modern editing experience:

  • Block types: H1, H2, H3, paragraph, bullet list, ordered list, code block, quote, divider
  • Slash / command menu: type / to insert blocks with keyboard navigation
  • Bubble menu: select text to get a floating toolbar with Bold, Italic, Underline, Strikethrough, inline code, and link formatting
  • Template variables: type {{variable_name}} to insert styled placeholder chips — useful for templated documents
  • Auto-save: 800ms debounce — documents persist automatically without manual saves
  • Code blocks: with copy-to-clipboard button
  • Image upload: images persist after page refresh and are included in PDF exports

Export Options

The toolbar includes an Export menu with:

  • PDF export (with watermark in MVP)
  • Markdown export
  • HTML export

MVP Limitations

The README explicitly flags these as not yet implemented:

  • Real-time collaboration
  • User authentication
  • DOCX export pipeline

These are on the roadmap. If you need collaboration today, HawkDoc is not ready.

Practical Evaluation Checklist

  • [ ] Clone and run npm run dev successfully
  • [ ] Verify PostgreSQL and Redis start cleanly via docker compose up -d
  • [ ] Create a new document and use slash commands (/h1, /code, /quote)
  • [ ] Insert a template variable ({{name}}) and observe the placeholder chip rendering
  • [ ] Type text, wait 800ms, refresh — content should persist
  • [ ] Select text and confirm bubble menu appears
  • [ ] Test PDF export from the toolbar
  • [ ] Copy a code block — verify copy button works

Security Notes

  • JWT secrets must be generated for the API server; do not use defaults
  • PostgreSQL and Redis run locally in the MVP setup; network exposure depends on your Docker networking configuration
  • Image uploads are stored through the API — consider adding file type validation and size limits before exposing HawkDoc publicly

FAQ

Q: How does HawkDoc compare to Notion? A: HawkDoc is a self-hosted alternative with a similar block-based editor. It lacks Notion’s database views, collaboration, and mature ecosystem. The tradeoff is full data ownership versus convenience.

Q: Can I use HawkDoc without Docker? A: The MVP setup requires PostgreSQL and Redis. You can point to external instances instead of using Docker Compose, but there is no single-binary or managed cloud offering yet.

Q: Is there a hosted version? A: Not currently. HawkDoc is only available as a self-hosted option. A managed service is not announced.

Q: What happens to the watermark in PDF export? A: The current MVP adds a watermark to PDF exports. This is expected to be configurable or removable in future versions.

Conclusion

HawkDoc fills a specific niche: users who want a Notion-like editing experience on their own infrastructure. The Lexical foundation means the editing behavior is solid — slash commands, bubble menus, and auto-save all work as expected. The MVP stage means real-time collaboration and DOCX export are still missing, but the core editor is functional.

If you need a self-hosted document editor today and are comfortable with an MVP, HawkDoc is worth a spin. Watch the GitHub for the collaboration and DOCX features landing in upcoming releases.