Self-Host Data
Reactions
Self-host your reactions data while using Velt’s components. Keep reaction 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 reactions and related data:
- Reactions can be stored on your own infrastructure, with only necessary identifiers on Velt servers.
- Velt Components automatically hydrate reaction data in the frontend by fetching from your configured data provider.
- This gives you full control over reaction data while maintaining all Velt collaboration features.
- This automatically also ensures that the in-app notifications content related to reactions is not stored on Velt servers. The content is generated using the reactions data in the frontend.
How does it work?
- When reactions are created, updated, deleted or requested, the SDK uses your configured
ReactionAnnotationDataProvider
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
- 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 reactions from your database. On error we will retry.
- Param:
GetReactionResolverRequest
- Return:
Promise<ResolverResponse<Record<string, PartialReactionAnnotation>>>
save
Save reactions to your database. Return a success or error response. On error we will retry.
- Param:
SaveReactionResolverRequest
- Return:
Promise<ResolverResponse<T>>
delete
Delete reactions from your database. Return a success or error response. On error we will retry.
- Param:
DeleteReactionResolverRequest
- Return:
Promise<ResolverResponse<T>>
config
Configuration for the reaction data provider.
- Type:
ResolverConfig