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 users add or remove reactions:- The SDK uses your configured
ReactionAnnotationDataProviderto handle storage - Your data provider implements three key methods:
get: Fetches reactions from your databasesave: Stores reactions and returns success/errordelete: Removes reactions from your database
- The SDK first attempts to save/delete the reaction on your database
- If successful:
- The SDK updates Velt’s servers with minimal metadata
- The
PartialReactionAnnotationobject is updated with the reaction details including emoji, user, and metadata - When the reaction is saved, this information is stored on your end
- Velt servers only store necessary identifiers, not the actual reaction content
- If the operation fails, no changes are made to Velt’s servers and the operation is retried if you have configured retries.
Implementation Approaches
You can implement reaction self-hosting using either of these approaches:- Config-Based: Provide endpoint URLs and let the SDK handle HTTP requests
- Custom Methods: Implement
get,save, anddeletemethods yourself
Config-Based Approach
Instead of implementing custom methods, you can configure endpoints directly and let the SDK handle HTTP requests.getConfig
Config-based endpoint for fetching reactions. The SDK automatically makes HTTP POST requests with the request body.- Type:
ResolverEndpointConfig - Request body format:
GetReactionResolverRequest - Response format:
ResolverResponse<Record<string, PartialReactionAnnotation>>
- React / Next.js
- Other Frameworks
saveConfig
Config-based endpoint for saving reactions. The SDK automatically makes HTTP POST requests with the request body.- Type:
ResolverEndpointConfig - Request body format:
SaveReactionResolverRequest - Response format:
ResolverResponse<T>
- React / Next.js
- Other Frameworks
deleteConfig
Config-based endpoint for deleting reactions. The SDK automatically makes HTTP POST requests with the request body.- Type:
ResolverEndpointConfig - Request body format:
DeleteReactionResolverRequest - Response format:
ResolverResponse<T>
- React / Next.js
- Other Frameworks
Config-Based Complete Example
- React / Next.js
- Other Frameworks
Custom Methods Approach
Implement custom methods to handle data operations yourself.get
Method to fetch reactions from your database. On error we will retry.- Param:
GetReactionResolverRequest - Return:
Promise<ResolverResponse<Record<string, PartialReactionAnnotation>>>
- Frontend Example
- Backend Endpoint Example (MongoDB)
- Backend Endpoint Example (PostgreSQL)
save
Save reactions to your database. Return a success or error response. On error we will retry.- Param:
SaveReactionResolverRequest - Return:
Promise<ResolverResponse<T>>
- Frontend Example
- Backend Endpoint Example (MongoDB)
- Backend Endpoint Example (PostgreSQL)
delete
Delete reactions from your database. Return a success or error response. On error we will retry.- Param:
DeleteReactionResolverRequest - Return:
Promise<ResolverResponse<T>>
- Frontend Example
- Backend Endpoint Example (MongoDB)
- Backend Endpoint Example (PostgreSQL)
config
Configuration for the reaction data provider.- Type:
ResolverConfig. Relevant properties:resolveTimeout: Timeout duration (in milliseconds) for resolver operationsgetRetryConfig:RetryConfig. Configure retry behavior for get operations.saveRetryConfig:RetryConfig. Configure retry behavior for save operations.deleteRetryConfig:RetryConfig. Configure retry behavior for delete operations.
Custom Methods Complete Example
- React / Next.js
- Other Frameworks
Sample Data
- Reaction annotation stored on your database
- Stored on Velt servers (reaction collection)
- Stored on Velt servers (comments collection)
Debugging
You can subscribe todataProvider events to monitor and debug get, save, and delete operations. The event includes a moduleName field that identifies which module triggered the resolver call, helping you trace data provider requests.
Type: ReactionResolverModuleName
- React / Next.js
- Other Frameworks

