Install and set up Velt in minutes in React, Angular, Vue, or HTML.
Get Velt up and running in your app with comments, presence, and real-time collaboration features. You’ll install the package, configure authentication, set up documents, and see collaborative features working immediately.
The SDK will not work without proper authentication and document initialization.
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.
This confirms the SDK is loaded and ready for adding features in later steps.See the tabs below for your specific implementation:
React / Next.js
Angular
Vue.js
HTML
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.
Copy
Ask AI
'use client'; // MAKE SURE TO INCLUDE 'use client' for Next.js implementationimport { VeltProvider } from '@veltdev/react';export default function App() { return ( <VeltProvider apiKey="YOUR_VELT_API_KEY"> {/* Your app content */} </VeltProvider> );}
Step 1: Add schemas: [CUSTOM_ELEMENTS_SCHEMA] to allow Angular to render Velt’s custom elements (web components).Step 2: Boot the Velt client by calling initVelt with your API key.
Copy
Ask AI
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';import { BrowserModule } from '@angular/platform-browser';import { AppRoutingModule } from './app-routing.module';import { AppComponent } from './app.component';@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, AppRoutingModule ], providers: [], bootstrap: [AppComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA], // Add this line})export class AppModule { }
Step 1: Register Velt’s custom elements by setting Vue.config.ignoredElements = [/velt-*/].Step 2: Boot the Velt client by calling initVelt with your API key.
Copy
Ask AI
import Vue from 'vue';import App from './App.vue';// Allow Velt elementsVue.config.ignoredElements = [/velt-*/];new Vue({ render: h => h(App),}).$mount('#app');
Call Velt.init('YOUR_VELT_API_KEY') to bootstrap the client before rendering Velt components.
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.
You must authenticate the user. The recommended path is configuring authProvider on VeltProvider 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.
You first need to create a user object with the required user information. The user object should include the following fields: userId, organizationId, name, email, and photoUrl.
Copy
Ask AI
// Example user objectconst user = { userId: 'user-123', organizationId: 'org-abc', name: 'John Doe', email: '[email protected]', photoUrl: 'https://i.pravatar.cc/300',};
Then, you need to provide a function that generates a Velt JWT token from your backend. See the JWT Token Setup. Tokens expire after 48 hours, handle renewals as shown in Token Refresh.
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.
A Document represents a shared collaborative space where users can interact. The setDocument 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.
// In your script tagasync function loadVelt() { await Velt.init("YOUR_VELT_API_KEY"); // Set document for current organization Velt.setDocuments([ { id: 'unique-document-id', metadata: { documentName: 'Document Name' } } ]);}
Add the VeltComments, VeltCommentTool, and VeltPresence components to enable comments and presence features.Use the tabs below to see the setup for React, Angular, Vue, and HTML.
React / Next.js
Angular
Vue.js
HTML
Render the comments surface at the app root; render presence and the comment tool within the document view:
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:
Copy
Ask AI
await Velt.getMetadata()
This should return the document metadata you’ve set. If it returns an error or 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
To test presence functionality:
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.