Scrivr
Getting Started

Installation

Install Scrivr into your project and configure TypeScript.

Prerequisites

  • Node.js ≥ 18 (LTS recommended)
  • A package manager — pnpm, npm, or yarn

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/react
npm install @scrivr/core @scrivr/react
yarn add @scrivr/core @scrivr/react

Headless (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/core
npm install @scrivr/core
yarn add @scrivr/core

Optional Packages

PackagePurpose
@scrivr/pluginsReal-time collaboration, AI Toolkit, and Track Changes.
@scrivr/exportExport 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/plugins
npm install @scrivr/plugins
yarn add @scrivr/plugins

Set the WebSocket server URL so the frontend can connect. With Vite:

VITE_WS_URL=ws://localhost:1234

The 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/anthropic

Environment variable (backend only, if using Anthropic):

ANTHROPIC_API_KEY=your-key-here

See 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.


Next Steps

On this page