The SDK will not work without proper authentication and document initialization.
Prerequisites
- Package manager (npm, yarn, or pnpm)
- Node.js (v14 or higher)
- React 16+, Vue 2+, Angular 12+, or vanilla HTML/JS
- A Velt account with an API key
- Optional: TypeScript types package for better development experience
Setup
Step 1: Install Dependencies
Install the required packages:Step 2: Get Your API Key
- Go to console.velt.dev and create an account
- Copy your API key from the dashboard

Step 3: Safelist Your Domain
In the Velt Console, add your app’s domain to “Managed Domains” to whitelist it for development and production use.
Step 4: Initialize Velt
Initialize the SDK and render the base collaborative components. Pick your framework and:- React: wrap your app with
VeltProvider
and pass your API key. - Angular/Vue/HTML: call the init function with your API key to bootstrap the client.
Wrap your app with
VeltProvider
and pass your API key.If using Next.js, add
‘use client’
directive at the top of files containing Velt components to ensure proper client-side rendering.Step 5: Authenticate Users
There are two ways to authenticate in Velt. Pick one based on your needs:- Auth Provider (recommended): Configure once and Velt will fetch/refresh tokens automatically. See details in the Key Concepts.
- Identify API (more personable): Call
identify(user, options)
directly where you need it for more control. If you use Identify, you must refresh tokens yourself, see Token Refresh.
Critical Authentication Requirement:
- You must authenticate the user. The recommended path is configuring
authProvider
onVeltProvider
during initialization.
During development,
generateToken
can be omitted; however, for production it is highly recommended to provide generateToken
for basic security and seamless token refresh.user
object should include the following fields: userId
, organizationId
, name
, email
, and photoUrl
.
Access control roles: Assign users as Editor or Viewer per resource (organization, folder, document) via your JWT token permissions or backend access APIs. Editors can write collaboration data (e.g., add/edit comments); Viewers are read-only. See: Access Control, APIs Generate Token, Add Permissions, Add/Update Users.
Step 6: Initialize Document
A Document represents a shared collaborative space where users can interact. ThesetDocument
method initializes this space and takes a unique documentId
and optional metadata
.
By default, users can only access documents within their own organization. Use this to set the document for the current organization the user is logged into.
Learn more about documents here.
To subscribe to multiple documents in a single call, use setDocuments
and pass an array; see here for more information.
The SDK will not work without initializing the document.
Step 7: Install Velt Feature Components
Add theVeltComments
, VeltCommentTool
, and VeltPresence
components to enable comments and presence features.
Use the tabs below to see the setup for React, Angular, Vue, and HTML.
Render the comments surface at the app root; render presence and the comment tool within the document view:
Step 8: Verify Setup
A good first step is to check if the Velt SDK has been initialized correctly. Open your browser’s developer console and run the following command:null
, check the console for any initialization errors.
To test comments functionality:
- Click the
VeltCommentTool
button, then hover over any element on the page to leave a comment - Click the
VeltCommentTool
button, then draw a box on the page to leave a comment - Try highlighting any text to leave a comment
- Test replying to comments and using the comments tool
- Open two browser tabs side by side with one in incognito mode
- Log in with different users in each tab
- You should see user avatars appear showing presence in both tabs
If you don’t see the comments tool, check your browser console for API key or network errors.
Debugging
Common issues:- Invalid API key or domain not whitelisted: Verify your API key and ensure your domain is added under “Managed Domains” in the Velt Console
- Component not rendering: Ensure the VeltProvider/script loads before your components
- No collaborative features: Verify that both authentication and document initialization are properly set up
- Users can’t see each other: Ensure both users are in the same organization and document
- Package not found: Clear npm cache and reinstall (
npm cache clean --force
) - TypeScript errors: Install the optional types package (
@veltdev/types
)
Notes
- API Key Required: Always use a valid API key from the Velt Console
- Framework Compatibility: Ensure your framework version meets the minimum requirements
- Child Components: Call authentication and document setup methods in child components, never in the same file as your VeltProvider
- Next.js ‘use client’: Add
'use client'
directive at the top of files containing Velt components for proper client-side rendering - Organization ID: Always include the
organizationId
when identifying users - this is required for proper access control - Document Required: The SDK will not work without calling
setDocument()
- this defines the collaborative space - @mention Support: To enable @mention functionality, set up user contacts here
- Location Support: For organizing users within documents, learn about Locations here
- TypeScript Support: Install the optional types package for better development experience
Complete Example
If using Next.js, add
‘use client’
directive at the top of files containing Velt components to ensure proper client-side rendering.Next Steps
Now that you’ve completed the basic setup, you can explore more advanced Velt features and concepts:- Key Concepts: For new developers we recommend reading through our curated list for an in-depth breakdown of the Velt SDK and cool features.
- Documents and Locations: Learn how to structure your app’s collaborative spaces.
- Users and User Groups: Configure and manage your users and groups.
- Access Control: Define permissions to control who can access what.
- Authentication: Explore more advanced authentication methods.
- UI Customization: Customize layouts, styling, templates, and actions for Velt components.