Skip to main content
This tutorial will get you up and running with a working embedded dashboard in just 5 minutes. We’ll use a sample token and dashboard so you can see results immediately.

What You’ll Build

By the end of this tutorial, you’ll have:
  • ✅ A working embedded DataBrain dashboard
  • ✅ Understanding of the core embedding concepts
  • ✅ A foundation to build upon for production

Prerequisites

  • Node.js 14+ installed
  • A React, Vue, or vanilla JavaScript project
  • 5 minutes of your time ⏱️

Step 1: Install the Package

Step 2: Import the Plugin

Add this import to your component or main file:

Step 3: Run and View

Start your development server and you should see the sample dashboard! 🎉
Congratulations! You’ve embedded your first DataBrain dashboard. The dashboard you’re seeing is a sample with demo data.

Understanding What You Built

Let’s break down the code:

The Component

The Token

This is a guest token - a temporary access token that allows viewing the dashboard. In production, you’ll generate these from your backend.

The Dashboard ID

This identifies which dashboard to display. Each dashboard in DataBrain has a unique ID.

Next: Make It Production-Ready

The sample above works great for testing, but for production you need to:

1. Create Your Own Dashboard

  1. Create your own dashboard at app.usedatabrain.com
  2. Connect your database as a data source
  3. Build your metrics and dashboards
  4. Create a Data App for embedding
  5. Generate tokens from your backend (see below)

Complete Setup Guide

Follow the full setup process

2. Generate Tokens from Your Backend

Security First: Never expose your API token in frontend code. Always generate guest tokens from your backend.
Here’s how token generation works: Token Flow:

Backend Example (Node.js)

Frontend Example (React)

Guest Token API

Complete token generation API docs

3. Customize the Dashboard

Add options to customize appearance and behavior:

Component Options

Explore all customization options

Embed a Single Metric

You can also embed individual metrics instead of full dashboards:

Common Customizations

Framework-Specific Guides

Get detailed integration guides for your framework:

React

React integration guide

Next.js

Next.js with SSR support

Vue

Vue 3 integration

Angular

Angular setup guide

Svelte

Svelte integration

Vanilla JS

Plain JavaScript

Troubleshooting

Check:
  • Plugin is imported before component renders
  • Token is valid and not expired
  • Dashboard ID is correct
  • No console errors
Solution: Generate a fresh token from your backend. Guest tokens can be set to expire after a certain time.
Fix: Ensure your domain is whitelisted in the Data App settings. Or generate tokens from your backend instead of frontend.
Try:
  • Check for CSS conflicts
  • Use custom theme options
  • Wrap in a container div
  • Check z-index values

Troubleshooting Guide

Complete troubleshooting reference

What’s Next?

You’ve successfully embedded a DataBrain dashboard! Here’s what to explore next:

Complete Setup

Production-ready setup guide

Security & Auth

Multi-tenancy and access control

Customization

Advanced customization options

API Reference

Complete API documentation

Need Help?

Interactive Playground

Experiment with live examples

Community & Support

Get help from our team