This repository replicates an example backend that will play well with the Metabase Embedding SDK. We've used Kotlin and Spring Boot for this example to show that the Metabase SDK doesn't require any specific backend infrastructure, but rather just one endpoint.
From any Metabase page, click on the gear icon in the upper right and select Admin Settings > Settings > Authentication.
On the card that says JWT, click the Setup button.
In JWT IDENTITY PROVIDER URI field, paste localhost:8081/login
.
Click the Generate key button. Copy the key.
Ensure that you've cloned this repository to your local machine first.
This method is by far the easiest (due to JetBrains creating IntelliJ and Kotlin). You'll need to install IntelliJ, then use Open an existing project
at the root of the local version of this repo. Then, go to:
src/main/kotlin/com/metabase/mbkotlinspringexample/MbSdkJavaBeExampleApplication.kt
You'll see a green play button to the left of fun main
. Click that, and click Run MbSdkJavaBeExampleApplication
.
Then, go to Making sure it works
Ensure that you have the gradle
package, which you can download from the gradle website. Alternatively, on MacOS, you can install the package with brew
using
brew install gradle
Check that your installation was successful by running:
gradle -v
It should give you some information on its version if installed successfully.
Now, just run gradle build
to build the app, then run gradle run
.
Go to localhost:8081
. The /
endpoint will redirect you to localhost:3004
if the server is working correctly.
You'll want to make sure that your environment variables are set up to connect with your frontend application and your Metabase instance.
METABASE_CLIENT_APP_URL
This URL should point to your frontend application. This app uses this variable to make sure that CORS is set up properly to accept requests from your FE.
METABASE_SITE_URL
Your Metabase instance's URL
METABASE_JWT_SHARED_SECRET
The JWT shared secret that you can find in your Metabase Admin Settings, in
Settings > Authentication > JWT > String used by the JWT signing key
If you want to hardcode your variables, go to application.properties
to set them.