Skip to content

Commit b5b6f59

Browse files
Initial version (#1)
* Initial commit * SDK embedding working * Remove server/node_modules * Remove unused tests and CSS * Small tweaks in server * Remove unnecessary files * Removed legacy CSS import, create npm script to start server * Remove unnecessary files, formatting * Implement Nicolò's patch to simplify CORS setup * Add comments around hardcoded user in backend, remove unused logo
1 parent 65d8b75 commit b5b6f59

File tree

15 files changed

+25874
-0
lines changed

15 files changed

+25874
-0
lines changed

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# FRONTEND
2+
PORT=3100
3+
REACT_APP_METABASE_INSTANCE_URL="http://localhost:3000"
4+
REACT_APP_JWT_PROVIDER_URI="http://localhost:9090/sso/metabase"
5+
6+
# BACKEND
7+
BACKEND_PORT=9090
8+
METABASE_INSTANCE_URL= "http://localhost:3000"
9+
METABASE_JWT_SHARED_SECRET="XXX"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.env
2+
client/node_modules
3+
server/node_modules

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Metabase Embedding SDK for React sample
2+
3+
You'll need a Pro or Enterprise version of Metabase 50 up and running. If you're not sure where to start, sign up for [Pro Cloud](https://www.metabase.com/pricing).
4+
5+
> [!IMPORTANT]
6+
> The SDK is currently only compatible with Metabase 50
7+
8+
## Create .env file
9+
```sh
10+
cp .env.example .env
11+
```
12+
13+
## Adjust URLs
14+
In `.env`, make sure `REACT_APP_METABASE_INSTANCE_URL` and `METABASE_INSTANCE_URL` point to your Metabase instance URL, e.g. `http://localhost:3000`.
15+
16+
## Set up your Metabase
17+
18+
### Enable SSO with JWT
19+
20+
From any Metabase page, click on the **gear** icon in the upper right and select **Admin Settings** > **Settings** > **Authentication**.
21+
22+
On the card that says **JWT**, click the **Setup** button.
23+
24+
### JWT Identity provider URI
25+
26+
In **JWT IDENTITY PROVIDER URI** field, paste `localhost:9090/sso/metabase`.
27+
28+
### String used by the JWT signing key
29+
30+
Click the **Generate key** button. Copy the key and paste it in your `.env` file into the env var `METABASE_JWT_SHARED_SECRET`.
31+
32+
## Running the server
33+
34+
### Move into the directory
35+
36+
```sh
37+
cd server
38+
```
39+
40+
### Install packages
41+
42+
```sh
43+
npm install
44+
```
45+
46+
### Starting the server
47+
48+
```sh
49+
npm start
50+
```
51+
52+
## Start the client
53+
54+
### Move into the directory
55+
56+
In a different terminal
57+
```sh
58+
cd client
59+
```
60+
### Install dependencies
61+
62+
```sh
63+
npm install
64+
```
65+
66+
### Start the app
67+
68+
```sh
69+
npm start
70+
```
71+
Your browser should automatically open the app. By default, it runs on [http://localhost:3100](localhost:3100).
72+
73+
## Set up groups and data sandboxing
74+
75+
Check out our [quick start guide](https://www.metabase.com/learn/customer-facing-analytics/interactive-embedding-quick-start) to set up interactive embedding with JWT and data sandboxing.
76+
77+
## Reporting issues
78+
79+
Please report bugs or feature requests as issues in this repository. Please do not report security vulnerabilities on the public GitHub issue tracker. Our Security Policy describes [the procedure](https://github.com/metabase/metabase/security#reporting-a-vulnerability) for disclosing security issues.
80+
81+
## Author
82+
83+
[Metabase](https://metabase.com)
84+
85+
## License
86+
87+
This project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.

client/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

0 commit comments

Comments
 (0)