{"id":47917262,"url":"https://github.com/metabase/metabase-nodejs-modular-embedding-sample","last_synced_at":"2026-04-04T05:44:30.073Z","repository":{"id":335301189,"uuid":"1144545184","full_name":"metabase/metabase-nodejs-modular-embedding-sample","owner":"metabase","description":"Modular Embedding Sample App","archived":false,"fork":false,"pushed_at":"2026-02-04T16:01:10.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T05:44:21.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metabase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-28T19:31:25.000Z","updated_at":"2026-02-04T16:04:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/metabase/metabase-nodejs-modular-embedding-sample","commit_stats":null,"previous_names":["metabase/metabase-nodejs-embedjs-embedding-sample"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/metabase/metabase-nodejs-modular-embedding-sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmetabase-nodejs-modular-embedding-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmetabase-nodejs-modular-embedding-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmetabase-nodejs-modular-embedding-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmetabase-nodejs-modular-embedding-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metabase","download_url":"https://codeload.github.com/metabase/metabase-nodejs-modular-embedding-sample/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metabase%2Fmetabase-nodejs-modular-embedding-sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31389391,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T04:26:24.776Z","status":"ssl_error","status_checked_at":"2026-04-04T04:23:34.147Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-04T05:44:29.488Z","updated_at":"2026-04-04T05:44:30.068Z","avatar_url":"https://github.com/metabase.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Metabase Embed.js Sample (Node.js + Express)\n\nA minimal sample demonstrating Metabase embedding using **embed.js** with Node.js and Express. This sample shows how easy it is to integrate Metabase dashboards into your application without any frontend framework.\n\n## Features\n\n- **Single file setup** - Just `server.js` with Express\n- **Guest Embed** - Anonymous access using signed JWT tokens\n- **SSO Embed** - Authenticated user sessions with JWT SSO\n- **No framework required** - Pure HTML with embed.js web components\n\n## Prerequisites\n\n- Node.js 18+\n- Optionally Docker and Docker Compose (for running with a pre-configured Metabase instance)\n- A Metabase Enterprise license\n\n## Quick Start\n\n### Running with Docker\n\n1. Copy the environment file and add your Metabase license:\n\n```bash\ncp .env.docker.example .env.docker\n# Edit .env.docker and add your MB_PREMIUM_EMBEDDING_TOKEN\n```\n\n2. Start the containers:\n\n```bash\nnpm run docker:up\n```\n\n3. Open http://localhost:4400 in your browser\n\n### Running locally with an existing Metabase instance\n\nBefore running, ensure your Metabase instance is configured following the [guest embedding setup guide](https://www.metabase.com/docs/latest/embedding/guest-embedding) and [SSO authentication guide](https://www.metabase.com/docs/latest/embedding/authentication).\n\n1. Copy the environment file:\n\n```bash\ncp .env.example .env\n# Edit .env with your Metabase instance URL, JWT secrets, and dashboard ID\n```\n\n2. Install dependencies and start the server:\n\n```bash\nnpm install\nnpm start\n```\n\n3. Open http://localhost:3100 in your browser\n\n## Project Structure\n\n```\n├── server.js              # Express server with all routes\n├── package.json           # Dependencies\n├── Dockerfile             # Container build\n├── docker-compose.yml     # Docker orchestration\n├── metabase/\n│   └── config.yml         # Metabase initial configuration\n└── e2e/                   # Cypress E2E tests\n```\n\n## How It Works\n\n### Guest Embed (Signed JWT)\n\nGuest embeds use signed JWT tokens to provide anonymous access to specific dashboards or questions. The server signs a token containing the resource ID and parameters, which is then passed to the `\u003cmetabase-dashboard\u003e` component. See the [guest embedding docs](https://www.metabase.com/docs/latest/embedding/guest-embedding) for more details.\n\n```javascript\n// Server generates a signed token\nconst payload = {\n  resource: { dashboard: 1 },\n  params: {},\n  exp: Math.round(Date.now() / 1000) + 10 * 60,\n};\nconst token = jwt.sign(payload, MB_EMBEDDING_SECRET_KEY);\n```\n\n```html\n\u003c!-- Client uses the token --\u003e\n\u003cmetabase-dashboard token=\"\u003csigned-token\u003e\" with-title=\"true\"\u003e\u003c/metabase-dashboard\u003e\n\n\u003cscript\u003e\n  defineMetabaseConfig({\n    isGuest: true,\n    instanceUrl: \"http://localhost:3000\",\n  });\n\u003c/script\u003e\n```\n\n### SSO Embed (JWT Authentication)\n\nSSO embeds authenticate users via JWT, creating a full user session in Metabase. The server returns a JWT containing user information when the embed.js client requests authentication. See the [authentication docs](https://www.metabase.com/docs/latest/embedding/authentication) for more details. This method enables end users to drill-through on charts, build their own visualizations, and ask questions to Metabase’s AI service. See a complete list of differences between SSO and guest embeds [in this doc](https://www.metabase.com/docs/latest/embedding/introduction#comparison-of-embedding-types).\n\n```javascript\n// Server returns user JWT at /auth/sso endpoint\nconst ssoPayload = {\n  email: \"rene@example.com\",\n  first_name: \"Rene\",\n  last_name: \"Descartes\",\n  groups: [\"Customer\"],\n  exp: Math.round(Date.now() / 1000) + 10 * 60,\n};\nconst ssoToken = jwt.sign(ssoPayload, MB_JWT_SHARED_SECRET);\nres.json({ jwt: ssoToken });\n```\n\n```html\n\u003c!-- Client uses SSO authentication --\u003e\n\u003cmetabase-dashboard\n  dashboard-id=\"1\"\n  with-title=\"true\"\n\u003e\u003c/metabase-dashboard\u003e\n\n\u003cscript\u003e\n  defineMetabaseConfig({\n    instanceUrl: \"http://localhost:3000\",\n    jwtProviderUri: \"http://localhost:3100/auth/sso\",\n  });\n\u003c/script\u003e\n```\n\n## Environment Variables\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `PORT` | Server port | `3100` |\n| `MB_INSTANCE_URL` | Metabase URL | `http://localhost:3000` |\n| `MB_JWT_SHARED_SECRET` | JWT signing secret for SSO authentication | - |\n| `MB_EMBEDDING_SECRET_KEY` | JWT signing secret for guest embeds | - |\n| `MB_DASHBOARD_ID_TO_EMBED` | ID of the dashboard to embed | `1` |\n| `MB_PREMIUM_EMBEDDING_TOKEN` | Metabase Enterprise license | - |\n\n## Running E2E Tests\n\n```bash\n# Start Docker containers\nnpm run docker:up\n\n# Run Cypress tests\ncd e2e\nnpm install\nnpm run cypress:run\n```\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fmetabase-nodejs-modular-embedding-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetabase%2Fmetabase-nodejs-modular-embedding-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetabase%2Fmetabase-nodejs-modular-embedding-sample/lists"}