@hocuspocus/extension-sqlite
v4.0.0
Published
a generic Hocuspocus persistence driver for the sqlite
Readme
@hocuspocus/extension-sqlite
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-sqliteUsage
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-sourceNeeds 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.
