a. Multi-tenant deployments

This section describes useful features if your product serve multiple customers.

Dynamic initial position

A frequently asked question is, should I create one visualization for each customer? Our recommendation typically leans towards consolidation, which makes it easier to add more information or refine the design of your visualizations over time.

One of the challenges in keeping one or few visualizations is how to handle the initial position. One customer may have a facility in Virginia and another in Texas. To overcome that you can dynamically set the initial position in Hopara based on a layer and a row id.

In the example below we tell Hopara to use the customer facility location as the initial position.

Hopara.init({
  visualizationId: 'my-hopara-viz',
  ...
  initialRow: {
    layerId: 'ae45ac-facilities'
    rowId: '$customerFacilityId'
  }
})

You can get the layer id can be by going to the advanced mode in the layers panel. The layer ID cannot be changed.

Customization by customers

If your deployment allows customization by customers (i.e. access to the settings and layers), you can use the combination of visualizationId and fallbackVisualizationId to avoid unnecessary duplications.

Using this configuration Hopara will first try to fetch the visualization defined by visualizationId and if not found will fetch the visualization defined by the fallbackVisualizationId. When your customer saves any change in settings or layers a new visualization will be created identified by the visualizationId.

Hopara.init({
  visualizationId: '$customerId-facilities',
  fallbackVisualizationId: 'facilities',
  ...
})

Security considerations

In multi-tenant deployments, when generating a token you should add a filter called tenantId. This will isolate all data Hopara saves internally (e.g. asset positions), preventing one customer to access data from customers using API calls.

{
  "clientId": "my-client-id",
  "clientSecret": "my-secret",
	
  "filters": [ { 
    "column":"tenantId", "values":["$customerId"]
  } ] 
}