VeltProvider into your app layout — no manual configuration required.
When to Use the CLI
- You want to add Velt to a Next.js project quickly from the command line
- You prefer a non-interactive, flag-driven workflow
- You want to scaffold specific features (comments, notifications, CRDT) in one step
- You are setting up Velt without an AI coding assistant
If you are using an AI coding agent like Claude Code or Cursor, see the MCP Installer for an AI-assisted setup experience.
Prerequisites
- Node.js 18+
- Next.js 13.4.0+ (App Router or Pages Router)
- React 18.2.0+
- Package manager: npm, yarn, or pnpm
- A Velt API key
Quickstart
Run the CLI in your Next.js project directory:@veltdev/react, @veltdev/types) and generates core components. To include specific features, add flags:
.env.local:
components/velt/VeltInitializeDocument.tsx— replace the placeholder document ID with your own (e.g., from a route parameter)components/velt/VeltInitializeUser.tsx— replace the placeholder user object with your real user context
Configuration
API Key
The CLI wiresVeltProvider to read your API key from the NEXT_PUBLIC_VELT_API_KEY environment variable. Add it to .env.local:
Document ID
Updatecomponents/velt/VeltInitializeDocument.tsx with your document ID source:
User Authentication
Updatecomponents/velt/VeltInitializeUser.tsx with your user retrieval logic:
Options
Feature Flags
| Flag | Description |
|---|---|
--comments | Add inline comments (VeltComments, VeltCommentsSidebar, VeltCursor) |
--notifications | Add notifications (VeltNotificationsTool, VeltCursor) |
--presence | Add presence indicators (VeltPresence) |
--cursors | Add live cursors (VeltCursor) |
CRDT Type Flags (choose one)
| Flag | Description |
|---|---|
--reactflow-crdt | Canvas collaboration with ReactFlow |
--tiptap-crdt | Rich text editor collaboration with Tiptap |
--codemirror-crdt | Code editor collaboration with CodeMirror |
Combined Flag
| Flag | Description |
|---|---|
--all | Enable comments + notifications + CRDT (requires a CRDT type flag) |
Installation Flags
| Flag | Description |
|---|---|
--force, -f | Force overwrite existing files |
--legacy-peer-deps | Use legacy peer deps (npm only) |
--help, -h | Show help message |
What the CLI Does
The CLI performs these steps automatically:- Detects your project — finds
next.config.js/next.config.ts, determines App Router vs Pages Router, and identifies your package manager (npm, yarn, or pnpm with workspace support) - Installs dependencies — adds
@veltdev/reactand@veltdev/types, plus feature-specific packages (e.g.,yjsfor CRDT) - Generates components — creates files under
components/velt/for collaboration, document initialization, and user authentication - Copies assets — adds icon SVGs to
public/icons/when features like notifications are selected
VeltProvider. See the Troubleshooting section for the required code.
Generated Files
Core (always created)
With features enabled
When you use--comments, --notifications, or CRDT flags, the CLI also generates:
VeltTools into your page:
Examples
Troubleshooting
Dependency conflicts
If installation fails due to peer dependency issues:--force and --legacy-peer-deps as fallbacks.
Existing files
Use--force to overwrite previously generated files:
Multiple CRDT types
Only one CRDT type can be selected at a time:--all without a CRDT type
The --all flag requires a CRDT type:
Manual VeltProvider setup
After running the CLI, wrap your app withVeltProvider in your layout file:
Next Steps
- Quickstart: Manual step-by-step Velt setup (without the CLI)
- Agent Skills: Teach your AI coding agent correct Velt patterns
- MCP Installer: AI-assisted Velt installation through MCP
- Comments Overview: Learn about commenting features
- CRDT Setup: Set up collaborative editing
- Key Concepts: Understand documents, locations, users, and access control

