Metabase Source Code: Build, Understand, and Contribute
Learn how Metabase source code works: architecture, local setup, key modules, and contribution workflow. Get started with the open source BI codebase.
- Metabase source code is on GitHub with 48.7K stars and AGPL open source license
- Architecture splits into a Clojure backend and React frontend for easy modification
- Prerequisites include JDK 25+, Clojure, Node.js 18+, and Bun; setup takes 10 minutes
- Building locally enables custom modifications and deep understanding of the codebase
- Contributing to Metabase uses standard pull request workflow with active team review
Metabase is an open source business intelligence tool built in Clojure and React, with 48.7K GitHub stars and thousands of contributors worldwide. If you want to understand how it works, extend it for your specific needs, or contribute features back to the project, reading and building the source code is the way in.
This guide walks you through where the code lives, how to get it running locally, what each major component does, and how to contribute back to the project. You do not need to be a Clojure expert: the codebase is well-organized, and the team publishes clear documentation for developers.
What is Metabase, and Why Look at the Source Code?
Metabase is a web-based SQL query builder and dashboard tool. It lets non-technical users write queries and share dashboards without writing code. The entire application is open source under the AGPL v3 license, meaning anyone can read, modify, and redistribute it as long as modifications are shared back with the community.
You might look at the Metabase source code for several reasons. First, you want to understand how the dashboarding engine works so you can architect your own BI pipeline. Second, you need a custom database driver that Metabase does not yet support. Third, your compliance rules require you to verify that the application does not collect or transmit data in ways you do not control. Fourth, you want to contribute a feature or fix a bug.
Metabase is maintained by Metabase, Inc., but the open source version is completely free. There is also a commercial license for enterprises that want proprietary features and vendor support. The AGPL license means if you modify Metabase and run a service on top of it, you must publish your modifications. If you deploy it internally and do not share it publicly, the AGPL does not require you to publish anything.
Architecture: Clojure Backend and React Frontend
Metabase splits neatly into a backend and a frontend. The backend is written in Clojure, a functional language built on the Java Virtual Machine. The frontend is TypeScript and React. This separation means you can modify the UI without touching the query engine, and vice versa.
The repository structure reflects this split. The /backend directory holds the Clojure server code. The /frontend directory contains the React application. Supporting code lives in /modules for database drivers and /enterprise for commercial features.
The backend does the heavy lifting: it parses SQL queries, connects to data sources, executes queries, caches results, and serves data over a REST API. The frontend consumes that API and renders query builders, dashboards, and charts. This architecture means you can even replace the frontend with your own client as long as it speaks the API.
Inside /src/metabase, you will find the core server code organized by domain. The query_processor module interprets SQL. The driver module abstracts database connections so Postgres, MySQL, MongoDB, and others all work the same way. The api module exposes endpoints for the frontend. The database module manages connections and metadata. This modular design makes it easy to find code related to a specific feature.
The /frontend directory uses a modern React structure with separate folders for pages, components, and utilities. State management uses Zustand, so you are not wrestling with Redux boilerplate. This makes the codebase approachable even if you have not touched React in a while.
Getting Access: The GitHub Repository
The Metabase source code is available at https://github.com/metabase/metabase - the repository is public and requires no authentication. You can clone it with either HTTPS or SSH by running the appropriate git clone command for your preferred protocol.
The main branch is master, which tracks the latest development code. For each release, there is a corresponding tag like v1.62.7.x. If you want the stable code from a specific release, check out that tag instead of master:
git checkout v1.62.7.x
The repository releases roughly every one to two days, so it is very active.
If you want to contribute, fork the repository first. Click the Fork button on GitHub to create your own copy. Then clone your fork locally using the appropriate git clone command. This gives you a working copy where you can experiment without affecting the original.
Prerequisites: What You Need Before Building
Before you can build Metabase from source, your machine needs several tools. This is a full-stack JavaScript and Clojure project, so there are dependencies on both sides.
On the backend, you need the Java Development Kit (JDK) version 25 or later. Metabase builds against a specific Java version, so check the CONTRIBUTING guide to see the current requirement. You also need Clojure itself, which you can install via Homebrew on Mac (brew install clojure), or download from clojure.org. The build system uses the uv package manager for Python dependencies.
On the frontend, you need Node.js version 18 or later and Bun, a fast JavaScript runtime and package manager. Install Node via nvm (node version manager) or Homebrew. Then install Bun:
curl -fsSL https://bun.sh/install | bash
Summary of what to install:
- JDK 25 or later
- Clojure (latest)
- Node.js 18+ (recommended: 20 LTS)
- Bun (latest)
- uv (Python package manager)
If you are on Mac with an M1 or M2 chip (ARM64), most of these tools work fine. Java, Clojure, Node, and Bun all publish ARM64 binaries. Verify installation by running java -version, clojure --version, node --version, and bun --version. All should report versions without errors.
If you do not want to install all these tools locally, you can build Metabase inside a Docker container. The repository includes a Dockerfile for development. This approach isolates dependencies so your system stays clean.
Building and Running Metabase Locally
Once prerequisites are installed, building is straightforward. Start by cloning the repository and navigating to the root directory to begin the build process.
Next, run the backend build. From the root directory:
clojure -M:dev
This command starts the Clojure REPL and compiles the backend. The first build takes a few minutes because it has to download dependencies.
In a separate terminal window, build and start the frontend:
cd frontend && bun install && bun run dev
Bun installs dependencies and starts the development server on localhost:3001.
Once both processes are running, open http://localhost:3000 in your browser. The Metabase application will load. The backend listens on port 3000, the frontend dev server on port 3001, with some reverse proxy magic connecting them.
When you edit Clojure files, the backend automatically reloads. When you edit React components, the frontend hot-reloads without a full page refresh. This iterative workflow makes development fast.
See the official building guide at https://metabase.com/docs/latest/developers-guide/build for detailed troubleshooting. The Metabase documentation covers Java version conflicts, dependency caching, and common errors.
Understanding the Codebase: Key Modules Explained
The Metabase source is organized into logical modules, each with a clear responsibility. Understanding this structure helps you navigate the code and find where to make changes.
/backend/src/metabase contains the Clojure server. Inside, query_processor.clj is the core query engine. It takes a query in Metabase's internal query language, translates it to SQL for the target database, executes it, and returns results. driver is a module where each database gets its own namespace: driver.postgres, driver.mysql, driver.mongodb, etc. This abstraction lets you support a new database by writing a single driver module.
/backend/src/metabase/api exposes HTTP endpoints. The API is RESTful: GET endpoints fetch data, POST endpoints create, PUT endpoints update, DELETE endpoints remove. Every API endpoint is documented in the code with comments, so you can read the source to understand what the endpoint does and what parameters it accepts.
/backend/src/metabase/database manages connection pools and metadata caching. When you add a database to Metabase, this module stores the connection details and keeps a cache of table schemas. It also handles data type inference so Metabase knows whether a column is a number, date, or text.
/frontend/src holds the React code. Pages are in pages/, components in components/, and utilities in utils/. The query builder lives in query_builder/ with separate components for filtering, joining, and aggregating. Dashboard code is in dashboard/. This organization makes finding features intuitive.
/modules/drivers is where database-specific code lives. If you want to add support for a new database, you create a new module here. The module exports a set of functions that Metabase calls to connect, discover tables, and execute queries.
/enterprise contains proprietary features like SSO, embedding, and advanced permissions. If you are looking at the open source version, this directory will not build. The commercial version of Metabase includes this code.
Contributing: From Fork to Pull Request
If you fix a bug or add a feature you want to share with the Metabase community, the process is straightforward. The team is actively welcoming contributions.
First, fork the repository and create a branch for your work. Use a descriptive branch name: fix/query-processor-null-bug or feature/slack-notifications. Avoid generic names like fix/bug or my-changes.
Make your changes and commit frequently with clear messages. Each commit message should describe what changed and why. Example: "Fix NPE when filtering on NULL dates in PostgreSQL driver." The team reviews commit history, so clear messages help them understand your work.
Before submitting a pull request, make sure your changes do not break existing tests. Run the following command for backend tests:
clojure -M:test
and this for frontend tests:
cd frontend && bun run test
If you added a new feature, add tests for it. Tests make it easier for the maintainers to review and give confidence that your code works.
When you are ready, create a pull request against the master branch. Write a clear title and description. Explain what problem your code solves and how it solves it. Link to any related issues. The Metabase team will review, ask questions, and suggest changes if needed. Be responsive: the faster you address feedback, the faster your code merges.
The Metabase project uses a standard open source workflow. Expect your PR to sit for a few days while maintainers review other contributions. Once approved, a maintainer will merge and your code ships in the next release.
Self-Hosted from Source vs. Managed Hosting
Building Metabase from source gives you maximum control. You can modify the code, deploy it on your own infrastructure, and customize every feature. But this control comes with responsibility: you own updates, security patches, and database maintenance.
If you deploy Metabase from source, you must stay on top of releases. The Metabase team publishes security updates regularly, and you need to rebuild, test, and redeploy whenever a patch is available. You also own the database that Metabase uses to store dashboard definitions, queries, and user permissions. If that database fails, Metabase is down. If it runs out of disk space, Metabase is down.
For teams without dedicated DevOps staff, this operational burden adds up. Building from source makes sense if you are making deep modifications to the product or if you have strict requirements about where your data lives. For most teams, there is a better path: managed hosting.
Opsily offers managed Metabase hosting that removes the operational burden. The Opsily team handles updates, patches, backups, and scaling. You log in and start building dashboards immediately, with no deployment infrastructure to maintain. See our managed Metabase hosting page to learn about automated updates, team collaboration features, and multi-environment support.
If you choose to self-host from source, keep up with releases. Subscribe to the Metabase mailing list or watch releases on GitHub to get notifications. When a new version arrives, test it in a staging environment before rolling it out to production.
For a comprehensive guide to deployment options, see our article on Metabase installation and setup. It covers both source-based and pre-built approaches so you can decide which path suits your team.
Frequently Asked Questions
Is Metabase open source?
Yes. Metabase is published under the AGPL v3 license, which means the source code is freely available, modifiable, and redistributable under the same license. There is also a commercial license for enterprises that want proprietary features.
Can I run Metabase locally?
Yes. You can clone the repository, install prerequisites (JDK, Clojure, Node.js, Bun), and run it on your machine. The development setup takes about 10 minutes once dependencies are installed.
Can you use Metabase for free?
Yes. The open source version of Metabase is completely free. You can deploy it on your infrastructure with no licensing fees. Metabase, Inc. also offers a commercial version with additional features like SSO and advanced permissions, but the core product is free.
Who maintains Metabase?
Metabase is maintained by Metabase, Inc., with contributions from thousands of open source developers. The company funds development and sets the roadmap, but the community drives feature requests and bug reports.
What databases does Metabase support?
Metabase supports all major databases: PostgreSQL, MySQL, SQLite, MongoDB, Redshift, Snowflake, BigQuery, and dozens more. Each database is implemented as a driver module in the source code.
Do I need to understand Clojure to contribute?
No. While the backend is written in Clojure, many contributions happen on the frontend in TypeScript and React. If you know JavaScript, you can contribute UI improvements, bug fixes, and new features without learning Clojure. Conversely, if you know Clojure but not JavaScript, there are backend features to work on.
How often does Metabase release new versions?
Metabase publishes new releases every one to two days. This rapid release cycle means bug fixes and new features ship quickly. If you self-host, you will need to update frequently to stay current.
The Bottom Line
Metabase is a mature open source project with clean architecture and welcoming contribution process. Reading the source code teaches you how to build scalable data applications. Building it locally takes minutes, and contributing features back is straightforward.
If you are building custom extensions or integrating Metabase deeply into your product, working with the source code is the right approach. If you want to use Metabase for dashboards and ad-hoc queries without managing infrastructure, managed hosting saves you time. Explore our guide to managed Metabase hosting to see how Opsily handles updates, scaling, and team collaboration so your team focuses on data, not operations.