Embedding Metabase in Next.js: when the modular SDK fits
A product team that wants Metabase dashboards, saved questions and the query builder inside its own Next.js application should use the modular embedding SDK. It is the route Metabase documents for this case, and it lets the product keep its own pages, navigation and user session while Metabase supplies the analytics components. The SDK covers dashboards, questions, the query builder and collection browsing, so a team can choose which of these surfaces appear in the product rather than handing users the whole Metabase interface. Metabase documents Next.js as a host application for the SDK, and the SDK requires React 18 or 19 and Node.js 20 or higher. Confirm these versions against the SDK documentation at the time you start, because the supported range can change between releases and your application's own React and Node.js versions must fall inside it.
The fit depends on how users sign in. SSO-based embedding requires a Pro or Enterprise plan, and the modular SDK relies on SSO-based authentication for signed-in product users, so a team that plans to show analytics to its customers through the SDK should confirm plan requirements and the user counting model before committing to an architecture. The Metabase embedding introduction compares modular embedding, full app embedding, public links and guest authentication, and the comparison is the right first read if your product needs anonymous or per-customer views. Guest authentication works on every plan, including open source, but it is a different trust model. If your team cannot run an SSO-capable plan, or the components you need are not in the SDK, treat the SDK as the wrong fit and check the alternatives before you write any integration code.
Which embedding route fits which product
The modular embedding SDK places individual Metabase components, such as dashboards, questions, the query builder and collection browsing, inside your own React or Next.js pages. It fits a product where your users should feel they are inside your application and where you want to control layout and navigation around the analytics. Authentication runs through your application: your server issues the session for each signed-in user, so the people viewing the content are identified users of your product. Because SSO-based embedding requires a Pro or Enterprise plan, confirm the plan before you commit to this route.
- Audience: Signed-in users of your product who expect analytics as a native part of the interface.
- Login model: Your application authenticates the user and the SDK uses that identity through an authentication endpoint.
- Plan requirement: SSO-based embedding requires Pro or Enterprise.
- Build effort: You own the React or Next.js integration, theming and version alignment.
- Best fit: Product teams building custom analytics pages with controlled navigation.
Before committing, confirm with your licensing contact which plan covers the number of identified viewers you expect.
Full app embedding places the whole Metabase application inside an iframe in your product. It suits power users who need the complete exploration interface, including the query builder, the browse pages and the admin-style tools that individual components do not expose. The trade-off is limited control over the surrounding experience, because the iframe carries Metabase's own navigation and layout. Viewers sign in through the SSO model used for embedded access, so this route also falls under the Pro or Enterprise requirement for SSO-based embedding.
- Audience: Internal or advanced users who need broad access to Metabase features.
- Login model: SSO-based sign-in inside the iframe, with the parent page configured for authorized origins.
- Plan requirement: Pro or Enterprise for SSO-based embedding.
- Control: Less control over layout and navigation than the SDK provides.
- Best fit: Teams that want the full Metabase experience with minimal front-end work.
Check whether the iframe approach meets the layout and browser cookie requirements of your product before you choose it over the SDK.
Guest embeds show a dashboard or question to viewers who do not have Metabase accounts. Your server signs a JWT that defines what the viewer may see, and Metabase renders the content for that signed request. Guest authentication works on all plans, including the open source edition, so it is the route to check first when your budget or plan rules out SSO-based embedding. The security model depends on locking parameters correctly, because the signed token is the only thing that scopes the data.
- Audience: External customers or viewers who should not hold Metabase accounts.
- Login model: Server-signed JWT per request, with no Metabase user account for the viewer.
- Plan requirement: Available on all plans, including open source.
- Data scoping: Depends on locked parameters in the signed token and on how your server builds it.
- Best fit: Read-only reporting for customers when individual accounts are not needed.
Review the guest embed parameter locking carefully, and confirm with the Metabase embedding documentation which features are available for guest viewers on your version.
Public links create a URL that anyone with the link can open without signing in. They are the simplest route and require no authentication work in your application, but the content is visible to anyone who holds the URL. Public links are appropriate only for data that is safe to publish broadly, such as a non-sensitive public dashboard. They do not provide per-user access control, so they should not carry customer or internal data that needs scoping.
- Audience: Anyone who holds the link, with no identity check.
- Login model: None. Access is controlled only by possession of the URL.
- Plan requirement: Available on the open source edition as well as paid plans.
- Data protection: No per-viewer scoping; filters on a public dashboard do not protect data.
- Best fit: Publishing non-sensitive reports to a broad audience.
If you use public links, confirm how to turn sharing off on your self-hosted instance and who is allowed to create public links.
Static embedding is deprecated in Metabase's embedding options, so it should not be the basis for a new build. Teams with an existing static embed should plan a move to a supported route. The supported options are the modular embedding SDK, full app embedding, guest embeds and public links, each with a different login model and plan requirement. Migration planning matters because the replacement route depends on who your viewers are and whether they need accounts.
- Status: Deprecated, so avoid it for new work.
- Existing embeds: Inventory them and map each one to a supported route.
- Replacement logic: Choose by audience, login model and plan requirement.
- Version check: Confirm the deprecation status against the current embedding documentation.
- Best fit: Teams already running static embeds that need a planned migration.
Before starting a migration, confirm the current status of static embedding in the Metabase embedding introduction.
Set up the SDK in a Next.js app
This sequence takes a Next.js application from version checks to a working Metabase modular embed, with a server-side endpoint issuing sessions and a provider wrapping the embedded components. Each step ends with a check so your team knows the integration is ready for review before you add more embeds.
Confirm runtime and framework versions
Your engineers check that the Next.js application runs React 18 or 19 and Node.js 20 or higher, as the SDK requires both. Confirm the Node.js version in your build and hosting environments, not only on a developer laptop, and record the versions in your repository. Done means the app builds and starts cleanly under the confirmed versions.
Install the SDK package
Add the Metabase embedding SDK for React to the application using your package manager, following the install steps in the Metabase Next.js guide. Pin the exact package version in your lockfile so that it can be matched to your Metabase instance later. Done means the dependency resolves, the lockfile is committed, and the build still passes.
Configure the instance URL and authorized origins
Set the Metabase instance URL as an environment variable and confirm the origins of your application are authorized for embedding on that instance. Your platform team owns the instance settings, and your application team owns the environment configuration for each stage. Done means a test request from the development origin reaches the instance and the settings are documented for each environment.
Build the server-side authentication endpoint
Create a server-only route in Next.js that checks your own user session and then requests a Metabase session for that user. The API key or signing secret used for this call stays in server environment variables and never reaches the browser bundle. Done means an authenticated request returns a session for the test user and an unauthenticated request is refused.
Wrap components in the provider
Place the SDK provider in a client component and point it at your authentication endpoint, then render embedded dashboards or collections inside it. Keep the provider out of server components so the SDK code is only shipped to the browser where it runs. Done means the page renders the provider without hydration errors in the browser console.
Verify server and client rendering
Load the page with JavaScript disabled and with it enabled, then confirm the server output contains only your shell and the SDK components render after hydration. Check that the SDK module loads only from client components and that no secret values appear in the page source or client bundle. Done means both checks pass in a production build.
Confirm the expected collection for a signed-in user
Sign in with a test user from each relevant group and confirm the collection browser shows only the content that user is permitted to see. Compare the results with the permissions your administrators configured in Metabase. Done means each test account sees its expected collections and a user without access sees nothing restricted.
How a Next.js request reaches Metabase through your auth endpoint
The request starts in the browser, where the SDK components render on the client. When the SDK needs a session, it calls your Next.js authentication route on the server, which checks the signed-in user against your identity source and asks Metabase for a session. The Metabase secret and any signing key stay on the server side of the trust boundary, never in client bundles. Check that the route is the only path that can mint a session and that the browser never receives those secrets.
Trust boundary between the browser, your Next.js server and self-hosted Metabase.
Client-side rendering constraints in Next.js
The interactive components of the modular embedding SDK must run in the browser. Dashboards, questions, the query builder and collection browsing depend on client state, event handlers and browser APIs, so they cannot be produced on the server as static markup. In a Next.js application using the App Router, that means the component tree that imports the SDK needs a client component boundary, marked with the "use client" directive at the top of the file that renders the SDK. Server components can still fetch data, check the user's session and decide which page to render, but they should pass only serializable props down to the client boundary. Confirm the exact directive and router behavior against the Next.js version you run, because the rules for server and client modules have changed across releases. The SDK's own setup guidance is the next read: Metabase docs: Modular embedding SDK with Next.js.
Two runtime problems follow from that boundary. First, server rendering and hydration must produce the same markup on both sides. If the SDK component reads window, local storage or a session cookie during the first render, the server output and the browser output can differ, and React reports a hydration mismatch. The usual fix is to render the SDK only after mount, or to wrap it in a client-only component that skips server rendering entirely, typically through a dynamic import with server rendering turned off. Second, streaming and Suspense boundaries will delay the embed in ways your team must test, not assume. Plan a loading state for each embed, and test with the production build, not only the development server, because hydration errors often appear only there.
The trade-off is initial load and search visibility. Client-only rendering means the HTML the server sends contains a placeholder instead of charts, and the analytics only appear after the JavaScript bundle loads and the SDK authenticates the user. For authenticated analytics pages this is usually acceptable, because search engines should not index content behind a login and the data is user specific. It does affect perceived performance on slow networks, and it adds a second round trip for the authentication endpoint that the SDK calls. Measure the page with the production build on the networks your customers use, decide which pages can show a static shell first, and keep the SDK out of pages that do not need it so the bundle cost stays with the pages that do.
Security decisions in the authentication endpoint
The authentication endpoint is the one place where your application tells Metabase who a user is and what they may see. Each decision below moves a trust boundary to a place you control, and each has a concrete check you can run before go-live.
Keep signing secrets on the server
The secret used to sign embedding and SSO tokens must live only in server-side environment configuration, never in a client component, a NEXT_PUBLIC_ variable or a bundled file. Anyone holding that secret can mint a session for any Metabase user. Check the built client bundle and browser network traffic for the key, and confirm that only your route handler reads it. Rotate it if it has ever appeared in logs, source control or a shared build artifact.
Derive identity on the server
The endpoint should decide the user's email, tenant, groups and attributes from your session store or database, not from fields the browser posts. A request body that says role: admin or tenant: acme is only a claim until the server checks it. Map each authenticated application user to a fixed Metabase identity in code you review, and reject requests where the signed-in user and the requested identity disagree.
Limit origins that can load the SDK
Restrict which domains may load the embedding SDK and receive Metabase content by listing only your production and approved staging origins. Wildcards and leftover development hosts widen the surface that can display embedded data. Confirm the allowed origins in the Metabase admin settings and test from an unlisted origin to verify that the request is refused. Repeat this check whenever a new subdomain or preview deployment is added.
Set session lifetime and refresh
Decide how long a Metabase session issued through your endpoint stays valid and when the SDK must request a new one. Short lifetimes limit the damage from a stolen token but add refresh traffic, while long lifetimes outlast a user's removal from your application. Make the endpoint re-check the application session on each refresh, so that a revoked user cannot obtain a new Metabase session. Test logout and account deactivation end to end.
Log authentication events
Record each token request with the user identifier, tenant, timestamp, requesting origin and outcome, including refusals. Keep these records in your central logging system, separate from the Next.js application's ordinary output, so that someone reviewing access can trace who was given a Metabase session and when. Do not write the signed token or the secret to logs. Confirm the retention period with your compliance team before you finalize the schema.
Review what the app can read
The credentials your Next.js server uses to call the Metabase API should have only the permissions the endpoint needs, and no more. Review which API calls the application makes, which data each one returns, and whether any route forwards Metabase responses to the browser without filtering. Plan the review as part of each release, because a new feature that calls an admin endpoint can expose more than the embed displays. Document the result so that your security team can verify it.
Configuration choices and when each fits
This table compares the four configuration decisions that shape a Next.js embed: where data is prepared, how users are signed in, how each embed is styled and localized, and how SDK and instance versions are pinned. Read each row as a choice to make before build starts, and confirm the trade-off column against the current Metabase SDK documentation and your own environment.
| Option | When it fits | Trade-off to confirm |
|---|---|---|
| Client-only rendering | Dashboards and questions where the SDK components load in the browser and the page has no sensitive server-side data to prepare | Confirm how the SDK behaves during server rendering in your Next.js version, and whether loading states and hydration errors are acceptable for your pages |
| Server-prepared data | Pages that need data from your own backend before the embed renders, such as tenant or account context passed into the page | Confirm which values must stay on the server, and that the server component or route handler cannot leak the Metabase session or secret to the browser |
| SSO session via your authentication endpoint | Embedded users who already have an account in your application and should see their own Metabase permissions | Confirm that JWT SSO is available on your plan, since SSO-based embedding requires Pro or Enterprise, and that your endpoint returns the expected user attributes and groups |
| Guest tokens | Viewers who should see one published dashboard without a Metabase account, with parameters locked per customer | Confirm that guest embedding fits your data isolation needs, because the token must be signed server side and parameter locking must cover every sensitive filter |
| Theme and locale per embed | Products that need different colors, fonts or languages across customer pages or tenants | Confirm which theme options your plan includes, and that translation dictionaries and per-embed overrides do not drift between environments |
| Package pinning | Production builds where the SDK version must match the Metabase instance version and changes go through review | Confirm the release process for bumping both packages together, and test each upgrade in a non-production instance before rollout |
| Floating version ranges | Early development or internal prototypes where fast access to SDK fixes matters more than repeatable builds | Confirm that lockfiles are committed and that an unplanned minor update cannot break components against an older instance |
Questions teams ask before building a Metabase SDK embed
How much effort does a Next.js embed of Metabase take?
Effort depends mostly on how many Metabase components the product shows, how much of the authentication flow your team builds, and how much styling must match your product. A single dashboard inside an authenticated page is a much smaller job than a product with a query builder, collection browsing, and per-customer permissions. The main drivers are:
- The number of embedded components and the pages that host them
- The authentication endpoint, including how user identity and groups are passed to Metabase
- Theming, locale and any per-customer configuration
- Testing across the Node.js and React versions your application uses
The SDK requires React 18 or 19 and Node.js 20 or higher, so check those versions in your application before estimating. Ask any partner to show the estimate broken down by these drivers.
Can a small team build a Metabase SDK embed alone?
A small team with strong React and Next.js experience can build a basic embed alone, provided it has someone who understands the authentication design and can run the Metabase instance. The harder parts are the server-side authentication endpoint, which must be correct for every request, and the ongoing work of keeping SDK and instance versions aligned. Teams without a developer who has shipped a server-side authentication flow usually find that the security review takes longer than the build. If you want a second opinion on your plan, DeployOpen can review the scope in writing before any work starts, and most engagements are fixed-scope.
What does the embed need from our identity and infrastructure team?
Your identity and infrastructure team needs to define how your application signs users into Metabase and where the Metabase instance runs. The identity side covers which claims or attributes identify the user, how groups map to Metabase permissions, and who owns the signing secret. The infrastructure side covers the hosting of Metabase, its application database, TLS, and the network path from your Next.js servers to Metabase. Ask them to confirm:
- Where the Metabase instance runs and how it is reached from your application
- Who rotates and stores the signing secret
- How cookies and origins are configured if Metabase and your application sit on different domains
- Who approves changes to the Metabase version
Does SSO embedding require a paid Metabase plan?
Yes. According to the Metabase pricing page, SSO-based embedding requires the Pro or Enterprise plan, while the Open Source and Starter plans do not include it. Metabase's embedding documentation states that all SSO-based embedding requires Pro or Enterprise, and guest authentication works on all plans, including open source. Confirm the current plan terms with Metabase before you commit to an architecture, because licensing terms can change. Pro is listed at $575 per month, or $517.50 per month billed yearly, with the first 10 users included, and Enterprise is priced by quote starting at $20,000 per year.
How should we handle Metabase version upgrades with an SDK embed?
Keep the SDK version and the Metabase instance version aligned, and upgrade them as one planned change. Metabase LTS versions are supported for 14 months, while non-LTS versions usually reach end of life after 2 months, so a version chosen today may need replacing within the year. A safe upgrade process includes:
- Back up the application database before every upgrade
- Test the SDK version against the target Metabase version in a non-production environment
- Upgrade release by release if the instance is older than version 40
- Keep a rollback plan that restores the pre-upgrade database backup
Upgrade migrations run automatically on startup, so schedule the change in a window your support team can cover.
What should we ask for in a quote for this work?
Ask for a written scope that names every embedded component, every page that hosts one, and the authentication design, including who builds and owns the endpoint. The quote should also list the environments covered, the testing approach, the version alignment process, and the handover documentation. Ask which items are one-time, such as the initial build and theming, and which recur, such as upgrades, monitoring and support. Request the assumptions behind each line, including the Metabase plan you expect to need and the number of users it covers. DeployOpen does not publish a price list, and a quote follows from the written scope.
When should we use guest embeds instead of the SDK?
Choose guest embeds when viewers should see fixed analytics without creating a Metabase account, and when you do not need interactive components like the query builder or collection browsing. Guest authentication works on all plans, including open source, which can lower the licensing cost for public or customer-facing views. The SDK is the better fit when users need to explore data inside your product under their own identity and permissions, because that requires SSO-based embedding and a paid plan. Guest embeds still need careful signing and locked parameters, so review that design before you choose it.
Limits to confirm in your environment
Several of these limits are set by the SDK, your Metabase plan and your hosting layout rather than by the code you write. Confirm each one before the build starts, because a mismatch usually surfaces late as a broken login or a blank dashboard.
SDK support for your versions
The modular embedding SDK documents use in Next.js applications and requires React 18 or 19 and Node.js 20 or higher. Check your exact Next.js and React versions against the current SDK documentation, not against an older example project. Record the SDK package version and the Metabase instance version together, because both must move as a pair.
Next.js SDK docsPlan required for your login method
SSO-based embedding requires the Pro or Enterprise plan, while guest embeds work on all plans, including open source. If your Next.js app authenticates users with JWT or SAML, confirm the plan before design work begins. Ask your Metabase representative whether your intended user counts fit the plan you select.
Reachability from the Next.js host
The Next.js server and the browser both need to reach the self-hosted Metabase instance, and the two paths can differ. Confirm the internal address the server uses for the authentication endpoint and the public address the browser loads the SDK from. Check that TLS certificates, the reverse proxy and any firewall rules allow both paths.
Cookie behavior across domains
If the Next.js app and Metabase run on different domains, the browser treats the Metabase session cookie as third-party in some configurations. Test sign-in in the browser versions your users run, including private browsing and browsers that restrict third-party cookies. Confirm the cookie settings your Metabase version uses and the CORS origins you need to allow.
Node.js runtime in production
The SDK requires Node.js 20 or higher, but your hosting platform may pin an older runtime image or a long-term support line that differs from your development machines. Confirm the Node.js version in your build pipeline, container image and serverless or edge runtime. A version mismatch between build and production is easy to miss until the first deployment.
Translation and theming on your plan
Theming and translation options depend on the plan you buy, and advanced theming is not available on every tier. Confirm which theme presets, saved themes, fonts and translation dictionary features your chosen plan includes. Ask the vendor to show these options in your version of Metabase before you commit design time to them.
How DeployOpen approaches a Metabase SDK build
A written scope comes first, and it has to settle three things before any code is written: which SDK components the product will use (dashboards, questions, the query builder, collection browsing), the identity model that decides who sees what, and where the Metabase instance and the Next.js application will be hosted. Each of these changes the build. The identity model determines how the authentication endpoint issues sessions and whether the team needs a paid plan for SSO-based embedding. Hosting decides whether the two applications share a domain, which affects cookie and CORS work. We confirm the Metabase edition, the Node.js and React versions, and the SDK release line in the scope so that version matching is a named deliverable rather than an afterthought.
Build work then runs in the client's own repositories and infrastructure. DeployOpen implements the authentication endpoint in the Next.js server layer, keeps the SDK provider and components on the client side where rendering constraints require it, and wires theming and locale settings the client has chosen. We test the flow end to end, including sign-out, expired sessions, users without access and the case where a request reaches a component before the session is ready. Security testing covers how the secret used to sign identity is stored and rotated, and whether a user can change parameters to see another tenant's data. Upgrade steps for the SDK and the Metabase instance are written and rehearsed in a staging environment before production.
Handover consists of the code, a configuration reference, a version matrix that maps the SDK release to the Metabase instance and Node.js version, and runbooks for the upgrade and rollback steps. Your engineers should be able to explain the authentication flow and the version pinning without us in the room. Ongoing support, upgrades and continuous testing are available as retainers, and they are priced separately from the initial fixed-scope work. Ask for the written scope to list which items are one-time and which recur, and confirm with your Metabase account team which plan your identity model requires.
How DeployOpen scopes, delivers and supports Metabase embedding
DeployOpen approaches Metabase modular embedding with Next.js as a fixed-scope piece of platform work inside infrastructure you control. The written scope fixes the components, the authentication endpoint, the version pairing and the handover documents before any build starts, so your team knows what it receives and how it will run.
How we scope
- Agree in writing which SDK components the Next.js application will render, such as dashboards, questions or the query builder.
- Map which pages render on the server and which Metabase components must run in client-side code.
- Confirm the Metabase plan needed for SSO-based embedding, since all SSO-based embedding requires Pro or Enterprise.
- Record the Node.js and React versions the application uses against the SDK's stated requirements of React 18 or 19 and Node.js 20 or higher.
How we build
- Implement the authentication endpoint in your Next.js backend so the browser never handles the signing secret.
- Pin the SDK package version and the self-hosted Metabase version together, and document the matching rule for future upgrades.
- Configure theming, locale and access settings for each embedded component as the written scope defines them.
- Test sign-in, permission boundaries and rendering behaviour in a non-production environment before release.
How we hand over
- Deliver the authentication endpoint code, environment variable inventory and version matrix with the application repository.
- Document which Metabase version and SDK version are approved, and the order to upgrade them together.
- Provide a runbook for rotating the embedding secret and for diagnosing failed sign-ins and blank embedded components.
- Walk your engineers through the build and confirm the handover checklist against the agreed scope.
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after the initial handover.
- Plan SDK and Metabase upgrades release by release, with an application database backup taken before each Metabase upgrade.
- Retest the embedded pages after each upgrade to confirm authentication, permissions and rendering still behave as documented.
- Ask for the retainer scope, response expectations and upgrade responsibilities in writing before work begins.

