Learning Bold BI Dashboard Embedding with Multi‑Tenant Data Architecture – Part 1: Separate Database per Customer
Introduction
Modern SaaS applications are built to serve multiple customers (organizations) from a shared infrastructure while ensuring that each customer’s data remains completely isolated and secure. A widely adopted approach to achieve this is database-level multi‑tenant architecture, where all customer databases reside on a single database server, but each customer owns an independent database.
In this model, the application determines which customer is logged in and dynamically connects to the corresponding database. The same architectural principle must be followed in analytics and reporting so that each customer views only their own data, even when dashboards are shared.
This Knowledge Base explains:
- How SaaS companies store multi‑customer data using separate databases on a single server
- How this data architecture is reflected in analytics
- How Bold BI can consume this architecture to create one reusable dashboard while ensuring customer‑specific data isolation
Multi‑Tenant Database Architecture Explained
In a typical SaaS setup, a single organization (for example, Bold Corp) hosts one database server. This server contains multiple independent databases, each mapped to a customer:
alpha_electronics_sales_analysisbeta_enterprise_sales_analysisgamma_industries_sales_analysisdelta_industries_sales_analysis
Each database:
- Belongs exclusively to one customer
- Uses the same schema structure (tables, columns, relationships)
- Is physically isolated from other customer data
Although all databases run on a single server instance, data is never shared between customers. From the database perspective, each customer operates as if they are the only one using the system.
Building a Unified Sales Analysis Dashboard
In the Bold Corp SaaS model example, multiple customers such as Alpha Electronics, Beta Enterprise, Gamma Industries, and Delta Industries use the same application. Each customer’s data is stored in a separate database on the same database server, following the multi‑tenant architecture explained earlier.
The business requirement is to:
- Build one unified
Sales Analysisdashboard - Embed this dashboard into the Bold Corp application
- Ensure each logged‑in customer sees data only from their own database
This must be achieved without creating multiple dashboards, without duplicating datasets, and without changing the dashboard design per customer.
Key Challenge: Static Data Source Configuration
While creating a data source in Bold BI, connection information must be provided, such as:
- Server name
- Database name
- User name
- Password
- Other provider‑specific properties
By default, these values are hard coded at design time.
If the embedding application follows this static approach:
- The Sales Analysis dashboard becomes tightly bound to one database
- Separate dashboards or data sources are required for each customer
- Managing dashboards for Alpha, Beta, Gamma, Delta, and future customers becomes unscalable
This directly conflicts with their goal of build once, reuse everywhere.
Bold BI Solution: Custom Attributes for Dynamic Connections
Custom Attributes: Introduction
Let us begin by understanding the concept of a custom attribute.
A custom attribute refers to a parameter that operates as a segment of code, which users can substitute within queries, custom expressions, or the Data Source Connection interface. These attributes are individually stored for each user and dynamically utilized to render dashboards.
Custom attributes can be configured at three hierarchical levels:
- User Level
- Group Level
- Site Level
The user-level attribute holds the highest priority, superseding the other levels. Attributes defined at the group and site levels can be overridden by those specified at the user level. Moreover, group-level attributes have the capability to override site-level attributes.
For a comprehensive understanding of custom attributes and their practical applications, please consult the help documentation.
Custom Attributes enables to:
- Define a single data source template
- Keep common values shared across all customers
- Dynamically inject customer‑specific values (such as database name) at runtime during embedding
This functionality is specifically designed for multi‑database SaaS architectures like Bold Corp’s setup.
Step by Step Guide: Unified Sales Analysis Dashboard Preparation
This section explains how Bold Corp can build **one unified Sales Analysis dashboard, publish it once, and embed it into the application so that each customer sees data from their own database, using Custom Attributes in Bold BI.
Step 1: Create the Custom Attribute with a Default Value
In the provided example, we are creating a custom attribute to dynamically pass database values, as these values vary for each customer:
In this example, we assume the creation of a custom attribute named sales_analysis_db with a default value of alpha_electronics_sales_analysis. The subsequent steps will demonstrate how this attribute can be modified during embedding to support dynamic value passing.
Step 2: Create the Data Source Using the Custom Attribute
Within the Bold BI dashboard designer, initiate the process of creating a new data source.
In the New Data Source connection properties pane, rather than utilizing hardcoded values for the database configuration, opt to set up a custom attribute as illustrated below.
In this specific example, only the database value has been configured using the custom attribute. However, based on your unique use case scenarios, it is possible to configure additional fields that require dynamic modifications during embedding. These configurations should leverage custom attributes instead of relying on static, hardcoded values.
Step 3: Create and Publish the Sales Analysis Dashboard
Design your dashboard using the data source created in the previous step and publish it to Bold BI. Since the data source is dynamic, the same dashboard can be reused across multiple tenants.
Important: Creating separate dashboards for each customer is unnecessary. By default, the dashboard uses the database value configured for the custom attribute. During embedding, values will be dynamically passed based on the user—a process that will be explained in the upcoming steps.
Step by Step Guide: Embedding the Dashboard into the Application
Step 1: Generate the Embed Token with Custom Attribute Values
To embed a Bold BI dashboard securely in your application, you must generate an Embed Token. From Bold BI v14.1, we introduced an object model structure to generate a token by calling the token generation endpoint via a POST API call, which makes it easier to provide the necessary details.
Important:The Embed Secret Key is required to securely embed Bold BI resources within external applications. This key can be generated from the Bold BI Server by an administrator.
For step-by-step instructions, security considerations, and configuration details, refer to the official Bold BI documentation: Bold BI User Guide – Embed Settings
When a user logs into the Bold Corp embedded sample application:
- Identify the customer associated with the user in your embedding application logic.
- Determine the corresponding database name:
- Alpha Electronics →
alpha_electronics_sales_analysis - Beta Enterprise →
beta_enterprise_sales_analysis - Gamma Industries →
gamma_industries_sales_analysis - Delta Industries →
delta_industries_sales_analysis
- Alpha Electronics →
- Generate the embed token for the dashboard.
- While generating the token, pass the custom attribute value:
DatabaseName = <customer database name>
[HttpPost]
[Route("TokenGeneration")]
public string TokenGeneration()
{
// Get logged-in user email from your application authentication context
string userEmail = UserContext.GetEmail();
// Resolve tenant associated with the logged-in user
string userTenant = UserContext.GetTenant(userEmail);
// Resolve database name based on tenant
// (Hard-coded for sample understanding; replace with DB/config lookup in production)
string userDatabaseName;
if (userTenant == "Alpha Electronics")
userDatabaseName = "alpha_electronics_sales_analysis";
else if (userTenant == "Beta Enterprise")
userDatabaseName = "beta_enterprise_sales_analysis";
else if (userTenant == "Gamma Industries")
userDatabaseName = "gamma_industries_sales_analysis";
else if (userTenant == "Delta Industries")
userDatabaseName = "delta_industries_sales_analysis";
var embedDetails = new
{
serverurl = "http://localhost:52206/bi/",
siteidentifier = "site/site1",
email = "[email protected]",
embedsecret = "<Embed Secret Key>",
customattributes = new List<object>
{
new {
name = "sales_analysis_db", // Name of the custom attribute
value = userDatabaseName, // Value for the custom attribute assigned from your business logic
@operator = "" // optional
}
}
};
//Post call to Bold BI server
var client = new HttpClient();
var requestUrl = $"{embedDetails.serverurl}/api/{embedDetails.siteidentifier}/embed/authorize";
var jsonPayload = JsonConvert.SerializeObject(embedDetails);
var httpContent = new StringContent(jsonPayload, Encoding.UTF8, "application/json");
var result = client.PostAsync(requestUrl, httpContent).Result;
var resultContent = result.Content.ReadAsStringAsync().Result;
return JsonConvert.DeserializeObject<dynamic>(resultContent).Data.access_token;
}
This step dynamically binds the dashboard to the correct database.
Step 2: Embed the Dashboard in the Front End Application
- Once an embed authorization token has been generated on the backend server side, use it on the frontend to securely render a Bold BI dashboard.
- Add a container with a unique ID where the dashboard will be rendered.
- Use the embed SDK to create a Bold BI instance with your server details, dashboard ID, and the embed token retrieved from your backend.
Note: To identify the Dashboard ID in Bold BI, refer to the following knowledge base article, which explains the available methods in detail:
How to Get the Dashboard ID in Bold BI
<div id="dashboard_container_id"></div>
<script>
var boldbiEmbedInstance = BoldBI.create({
serverUrl: "http://localhost:52206/bi/",
dashboardId: "<Dashboard Id>",
embedContainerId: "dashboard_container_id", // Div ID where dashboard will render
embedToken: "<Embed token generated from backend server>" //Discussed in Previous section
});
boldbiEmbedInstance.loadDashboard();
</script>
- Load the Sales Analysis dashboard using the Bold BI embedding SDK.
- Bold BI reads the custom attribute value from the token.
- The dashboard connects to the specified customer database and renders the data.
Resulting Behavior
- Bold Corp maintains one Sales Analysis dashboard
- Each customer sees only their own sales data
- Database selection happens at runtime
- No dashboard duplication or manual configuration changes are required
Sample Demo Web Application
An embedded demo application site has been made available to illustrate the functionality of custom attributes and filter parameters for dynamic data filtering tailored to the logged-in user.
By switching the logged-in user in the page, the dashboard will dynamically adjust according to the custom attribute values and the user permissions specified within the DataSource.
Benefits for Orgnizations
By using Custom Attributes in Bold BI, the orgnizations like Bold Corp achieves:
- One unified Sales Analysis dashboard
- No dashboard or data duplication
- Clean separation between dashboard design and customer context
- Native alignment with database‑level multi‑tenant architecture
- Effortless onboarding of new customers (only a new database is required)
Summary
In the Bold Corp SaaS example embedded application, Custom Attributes act as the bridge between:
- A shared dashboard design, and
- customer‑specific databases
This allows Organizations to embed a single Sales Analysis dashboard and dynamically serve the correct data to every customer, making the analytics layer as scalable and secure as the underlying SaaS architecture.
Additional References
Getting Started with Bold BI
- User Guide Documentation: Bold BI Evaluation Quick Start
- User Guide Documentation: Creating Dashboards
- User Guide Documentation: Working with Data sources
Bold BI Embedding Concepts