This is the sample code for Metabase's Edumation interactive embedding demo, which showcases Metabase's interactive embedding capabilities.
Metabase is the easy, open-source way for everyone in your company to ask questions and learn from data.
Interactive embedding makes implementing multi-tenant, self-service analytics in your app easy.
Use this option to run the demo alongside Metabase locally in two Docker containers without installing any dependencies.
You need to have Docker installed and running on your machine.
- Insert your Metabase license token in the docker-compose.yaml file
- Run the command:
docker compose up
- When the containers finish loading, check that everything works by opening localhost:8080
- You can sign into the local Metabase instance to explore using the usernames
[email protected]
or[email protected]
and passwordMetapass123!
- Metabase runs on localhost:3000
In case you get an error like this:
Bind for 0.0.0.0:3000 failed: port is already allocated
You might consider changing the ports where the containers are exposing their services:
- in this case Metabase on port 3000 (change the line to 3001:3000) or
- or the web app on port 8080 (change the line to 8081:8080)
These instructions are to run the embedding app locally pointing to a separate Metabase instance. The Metabase instance needs certain state and this is not covered here (users, data, dashboards, ...).
In order to run the embedding demo on your local machine, you need to have installed:
You also need a Metabase instance with a Pro/Enterprise license.
-
Open the .env.local file
-
Add your JWT shared secret as follows:
METABASE_JWT_SHARED_SECRET="edumation-MB-instance-shared-secret"
-
Update all
.env.*
files relevant properties to match your Metabase instance:METABASE_APP_ID="edumation" METABASE_APP_DOMAIN="metabase.com"
⚠️ Warning: avoid committing the.env.local
file, as that file contains your instance's JWT shared secret that needs to stay secret.
- Using the terminal, go to the root of the project
- Run the command
yarn
to install the Node packages - Run the command
yarn dev
to start the app - Go to localhost:3003 to check that it is working
Please read the documentation regarding Metabase session samesite cookie if your Metabase instance and application are running on different domains, e.g. embedding Metabase cloud from another domain or from localhost.
A custom cookie can be set in your instance env vars.