Files
upstream-mirror e0c588ca1c
Some checks failed
build / lint (22) (push) Failing after 17s
build / test (22) (push) Failing after 8s
build / lint (23) (push) Failing after 2s
build / build (22) (push) Has been skipped
build / build (23) (push) Has been skipped
build / test (23) (push) Failing after 4s
docsearch / docsearch (push) Failing after 1s
snapshot of https://github.com/ueberdosis/hocuspocus.git @ cf3cfa355b4d3bb61c6b6c80071f71783e32470e (2026-09-15)
2026-09-15 17:21:35 +05:00
..

@hocuspocus/extension-sqlite

Version Downloads License Sponsor

Persist Hocuspocus documents to a local SQLite database. Zero-config storage for development, self-hosted single-instance deployments, and small production setups. Uses better-sqlite3.

Installation

npm install @hocuspocus/extension-sqlite

Usage

import { Server } from "@hocuspocus/server"
import { SQLite } from "@hocuspocus/extension-sqlite"

const server = new Server({
  extensions: [
    new SQLite({ database: "db.sqlite" }),
  ],
})

server.listen()

database accepts:

  • a filename (persisted to disk, e.g. "db.sqlite")
  • ":memory:" for an in-memory database
  • "" for an anonymous on-disk database

Omit the option entirely to default to ":memory:".

Troubleshooting

Could not locate the bindings file

better-sqlite3 ships prebuilt native addons, but they don't always cover the newest Node.js release on day one. Rebuild from source in your server project:

npm rebuild better-sqlite3 --build-from-source

Needs a C++ toolchain (Xcode Command Line Tools on macOS, build-essential on Debian/Ubuntu, Visual Studio Build Tools on Windows).

Documentation

Schema, custom fetch/store, and migration guides: tiptap.dev/docs/hocuspocus/server/extensions/sqlite.

License

MIT — see LICENSE.md.