Self-Host Data
Comments
Self-host your comments data while using Velt’s components. Keep comment storage on your infrastructure with minimal metadata stored on Velt servers.
- This feature is currently in beta and is subject to change.
- This is currently only compatible with
setDocuments
method. - Ensure that the data providers are set prior to calling
identify
method. - The data provider methods must return the correct status code (e.g. 200 for success, 500 for errors) and success boolean in the response object. This ensures proper error handling and retries.
Overview
Velt supports self-hosting your comments and related data:
- Comments can be stored on your own infrastructure, with only necessary identifiers on Velt servers.
- Velt Components automatically hydrate comment data in the frontend by fetching from your configured data provider.
- This gives you full control over comment data while maintaining all Velt collaboration features.
- This automatically also ensures that the in-app notifications content is not stored on Velt servers. The content is generated using the comments data in the frontend.
How does it work?
- When comments are created, updated, deleted or requested, the SDK uses your configured
CommentAnnotationDataProvider
to handle storage and retrieval - The data provider implements
get
,save
, anddelete
methods to interact with your database - Velt handles the data mapping and realtime synchronization while delegating persistence of actual content to your infrastructure
- The data provider works at the Comment Annotation (Thread) level not at the individual Comment (Message) level.
- For write requests (save, delete), the operation is first performed on your database and only if we get a success response, the SDK will perform the operation on the Velt server. If the operation fails on your database, the SDK will not perform the operation on the Velt server.
- You can configure retries, timeouts, etc. for the data provider.
Here are the methods that you need to implement on the data provider:
get
Method to fetch comments from your database. On error we will retry.
- Param:
GetCommentResolverRequest
- Return:
Promise<ResolverResponse<Record<string, PartialCommentAnnotation>>>
save
Save comments to your database. Return a success or error response. On error we will retry.
- Param:
SaveCommentResolverRequest
- Note in the
SaveCommentResolverRequest
object, you will receive the event name that triggered the save.
- Note in the
- Return:
Promise<ResolverResponse<T>>
delete
Delete comments from your database. Return a success or error response. On error we will retry.
- Param:
DeleteCommentResolverRequest
- Return:
Promise<ResolverResponse<T>>
config
Configuration for the comment data provider.
- Type:
ResolverConfig