|
1 | | -# embedding-reference-apps |
2 | | -Reference applications for common web frameworks showing how to embed Metabase charts |
| 1 | +# Embedding Metabase dashboards: reference web apps |
3 | 2 |
|
4 | | -# Running the apps |
5 | | -1. Run the metabase server with `java -jar metabase.jar` from the `/metabase` directory |
6 | | -2. Run the relevant reference application |
| 3 | +This repo contains example applications for common web frameworks to demonstrate how [Metabase](https://www.metabase.com/) dashboards can be embedded in your application. |
7 | 4 |
|
8 | | -For the Django application |
9 | | -`./manage.py runserver` |
| 5 | +This README will walk you through getting Metabase up and running, as well as a simple web app, to show you a live example of an embedded dashboard. |
10 | 6 |
|
11 | | -For the Node application |
12 | | -`node index.js` |
| 7 | +Here's a simple Metabase dashboard in action: |
13 | 8 |
|
14 | | -For the rails application |
15 | | -`rails server -p 3001` |
16 | | -(Note that we're binding to a nonstandard port as Metabase also runs on 3000) |
| 9 | + |
17 | 10 |
|
18 | | -# Helpful info |
19 | | -Admin login is |
20 | | -user: plucky@admin.com |
21 | | -password: Metabase123 |
| 11 | +## Premium embedding |
| 12 | + |
| 13 | +Embedding Metabase charts will always be free, but we include a "Powered by Metabase" graphic when using the open source version. |
| 14 | + |
| 15 | +If you'd like to remove the "Powered by Metabase" attribution, check out our [Enterprise Edition](https://www.metabase.com/enterprise/) which lets you do so so as well as white-label the application. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +- Java version 8.x or 11.x. [Install OpenJDK](https://openjdk.java.net/install/). |
| 20 | + |
| 21 | +## Set up Metabase |
| 22 | + |
| 23 | +We'll first need to set up a running instance of Metabase to serve the embedded dashboards. |
| 24 | + |
| 25 | +1. If you already have an instance of Metabase running on your machine, shut it down. |
| 26 | + |
| 27 | +2. Open up a terminal and clone this repo to your machine. |
| 28 | + |
| 29 | +3. `cd` into embedding-reference-apps. |
| 30 | + |
| 31 | +3. Run the the prepare script. |
| 32 | + |
| 33 | +```shell |
| 34 | +./prepare.sh |
| 35 | +``` |
| 36 | + |
| 37 | +The prepare.sh script downloads the latest version of Metabase to this repository's [metabase](/metabase) directory, changes into that directory, and runs the jar:`java -jar metabase.jar`. |
| 38 | + |
| 39 | +Metabase will log its progress in the terminal as the jar runs. Once you see the line, "Metabase Inititalization COMPLETE", open your browser to [localhost:3000](http://localhost:3000) to see that Metabase is up and running. |
| 40 | + |
| 41 | +## Running the apps |
| 42 | + |
| 43 | +To see an embedded Metabase dashboard in action, [set up Metabase](#set-up-metabase), and follow the instructions in the README for the relevant app. If you're not sure which one to try, check out the [Node app](/node/README.md). |
| 44 | + |
| 45 | +- [Node](/node/README.md) |
| 46 | + |
| 47 | +- [Django](/django/embedded-analytics/README.md) |
| 48 | + |
| 49 | +- [Rails](/rails/embedded-analytics/README.md) |
| 50 | + |
| 51 | +- [Laravel](/laravel/embedded-analytics/README.md) |
| 52 | + |
| 53 | +## Embedding charts or dashboards |
| 54 | + |
| 55 | +There are two ways to embed charts or dashboards in web applications: |
| 56 | + |
| 57 | +### Public embeds |
| 58 | + |
| 59 | +The Public embedding method is to simply use the public URLs inside of an iframe, or really anywhere you can insert HTML. The embedded dashboard has a secure URL, so a user can only look at the contents of the dashboard being shared. An end user never has information they can use to modify the URL and gain access to any other resources on your Metabase instance. |
| 60 | + |
| 61 | +### Signed embeds |
| 62 | + |
| 63 | +With signed embedding, all embedded charts and dashboards have to be signed using a secret key. This allows you to build dynamic dashboards with a parameter that can be be locked down on the client side. You should sign embedded charts and dashboards on your server, which allows you to embed dashboards accessible to specific organizations, accounts, or users. |
| 64 | + |
| 65 | +The web applications go into more detail about embedding, and provide examples. Start up the [Node app](/node/README.md) and explore the app. |
| 66 | + |
| 67 | +## Documentation on embeds |
| 68 | + |
| 69 | +You can also learn more about embedding dashboards by reading [Metabase's documentation](https://www.metabase.com/docs/latest/). |
| 70 | + |
| 71 | +- [Quick search: embed](https://www.metabase.com/search.html?query=embed). |
| 72 | + |
| 73 | +Article links: |
| 74 | + |
| 75 | +- [Embedding Metabase components in other applications](https://www.metabase.com/docs/latest/administration-guide/13-embedding.html) |
| 76 | +- [Embedding all of Metabase in your web app](https://www.metabase.com/docs/latest/enterprise-guide/full-app-embedding.html) |
| 77 | +- [Sharing and embedding dashboards or questions](https://www.metabase.com/docs/latest/administration-guide/12-public-links.html) |
| 78 | + |
| 79 | +## Helpful info |
| 80 | +Credentials for Metabase should auto-populate, but here they are for reference: |
| 81 | + |
| 82 | +- user: plucky@admin.com |
| 83 | +- password: Metabase123 |
| 84 | + |
| 85 | +## Run into trouble? |
| 86 | + |
| 87 | +Check out the [Metabase discussion forum](https://discourse.metabase.com/) and search for your issue. If you don't find any answers, please [create an issue](https://github.com/metabase/embedding-reference-apps/issues/new/choose) for this repository. |
0 commit comments