Installation
Install Scrivr into your project and configure TypeScript.
Prerequisites
- Node.js ≥ 18 (LTS recommended)
- A package manager —
pnpm,npm, oryarn
Scrivr is written in strict TypeScript. You don't need to install separate @types/* packages — type declarations are bundled with each package.
Install the Packages
React
pnpm add @scrivr/core @scrivr/reactnpm install @scrivr/core @scrivr/reactyarn add @scrivr/core @scrivr/reactHeadless (no framework)
@scrivr/core has no framework dependency and can be used in any JavaScript environment — Node.js, vanilla JS, or as a base for a custom framework adapter.
pnpm add @scrivr/corenpm install @scrivr/coreyarn add @scrivr/coreOptional Packages
| Package | Purpose |
|---|---|
@scrivr/plugins | Real-time collaboration, AI Toolkit, and Track Changes. |
@scrivr/export | Export to paginated PDF and Markdown. DOCX coming soon. |
Setting Up Optional Features
Real-Time Collaboration
The collaboration layer syncs over WebSockets using Yjs CRDTs. You will need to run your own WebSocket backend — any Hocuspocus-compatible server works. Install @scrivr/plugins on the frontend:
pnpm add @scrivr/pluginsnpm install @scrivr/pluginsyarn add @scrivr/pluginsSet the WebSocket server URL so the frontend can connect. With Vite:
VITE_WS_URL=ws://localhost:1234The variable name depends on your bundler — Vite requires the VITE_ prefix, Next.js uses NEXT_PUBLIC_, etc.
See the Collaboration example for the full setup.
AI Toolkit
AiToolkit is bring-your-own-LLM — it provides the editor-side context and ghost text overlay, but the actual LLM call is made from your own backend endpoint. Install @scrivr/plugins on the frontend and whatever AI SDK you prefer on the backend:
# Frontend
pnpm add @scrivr/plugins
# Backend (example using Vercel AI SDK + Anthropic)
pnpm add ai @ai-sdk/anthropic# Frontend
npm install @scrivr/plugins
# Backend (example using Vercel AI SDK + Anthropic)
npm install ai @ai-sdk/anthropic# Frontend
yarn add @scrivr/plugins
# Backend (example using Vercel AI SDK + Anthropic)
yarn add ai @ai-sdk/anthropicEnvironment variable (backend only, if using Anthropic):
ANTHROPIC_API_KEY=your-key-hereSee the AI Assistant example for the full integration pattern.
Bundler Support
Scrivr has been tested with Vite (recommended), Webpack 5, and esbuild. No special plugins or aliases are required — the packages ship pre-bundled ESM.