Repository overview
Frontend structure
The frontend is located in/frontend and uses TypeScript, React, Redux, and Mantine UI.
Frontend organization
Key frontend directories
/frontend/src/metabase
/frontend/src/metabase
The main application code, organized by feature:
- api/ - All API endpoints using RTK Query
- query_builder/ - Visual query builder logic
- dashboard/ - Dashboard creation and viewing
- ui/ - Reusable UI components built on Mantine
- components/ - Shared components across features
- lib/ - Utility functions and helpers
/frontend/src/metabase-types
/frontend/src/metabase-types
TypeScript type definitions:
- api/ - Types matching backend API responses
- store/ - Redux store shape types
- types/ - General application types
Frontend tech stack
- TypeScript - Primary language (migrating from JavaScript)
- React 18 - UI framework
- Redux Toolkit - State management
- RTK Query - Data fetching and caching
- Mantine - UI component library
- Emotion - CSS-in-JS (legacy, being phased out)
- Jest - Unit testing
- Cypress - End-to-end testing
Backend structure
The backend is located in/src and written in Clojure.
Backend organization
Key backend directories
/src/metabase/api
/src/metabase/api
REST API endpoint definitions. Each file defines routes for a specific resource:
- database.clj - Database connection endpoints
- card.clj - Question/card endpoints
- dashboard.clj - Dashboard endpoints
- table.clj - Table metadata endpoints
/src/metabase/models
/src/metabase/models
Toucan2 models for the application database:
- database.clj - Database connections
- card.clj - Saved questions
- dashboard.clj - Dashboards
- user.clj - User accounts
/src/metabase/driver
/src/metabase/driver
Core driver interface and implementations. Drivers provide:
- Database capabilities and features
- Schema introspection (sync)
- MBQL to native query compilation
- Query execution
/src/metabase/query_processor
/src/metabase/query_processor
MBQL query processing pipeline:
- Query preprocessing and middleware
- Permission checking
- Query optimization
- Result post-processing
Backend tech stack
- Clojure 1.12 - Primary language
- Ring - HTTP server abstraction
- Compojure - Routing
- Toucan2 - ORM for application database
- Honey SQL - SQL query generation
- clojure.test - Testing framework
Database drivers
Drivers are organized as separate modules in/modules/drivers/:
Driver components
metabase-plugin.yaml
Plugin manifest with driver metadata, connection properties, and initialization steps
src/metabase/driver/<name>.clj
Driver implementation with multimethod implementations for driver interface
Testing structure
Backend tests
Located in/test/metabase/, mirroring the source structure:
Frontend tests
New unit tests are placed alongside the components they test. Legacy tests are in
/frontend/test/.End-to-end tests
Cypress tests in/e2e/:
Build and configuration
Build scripts
Located in/bin/:
- build.sh - Build complete Metabase JAR
- build-drivers.sh - Build all database drivers
- build-driver.sh - Build single driver
- dev-install - Automated development setup
Configuration files
Enterprise features
Enterprise Edition code is in/enterprise/:
Resources and static files
Documentation
- /docs - Developer documentation (source files)
- /.claude - AI coding assistant skills and conventions
- README.md - Project overview and quick start
Naming conventions
Frontend
- Components - PascalCase (e.g.,
QueryBuilder.tsx) - Hooks - camelCase with
useprefix (e.g.,useQuery.ts) - Utils - camelCase (e.g.,
formatDate.ts) - Constants - UPPER_SNAKE_CASE (e.g.,
MAX_RESULTS)
Backend
- Namespaces - kebab-case (e.g.,
metabase.query-processor) - Functions - kebab-case (e.g.,
process-query) - Multimethods - kebab-case (e.g.,
mbql->native)
Working with the codebase
Finding code
Finding API endpoints
Finding API endpoints
Backend API endpoints are in
/src/metabase/api/. Each resource has its own file.Frontend API definitions using RTK Query are in /frontend/src/metabase/api/.Finding components
Finding components
Search in
/frontend/src/metabase/ by feature name. Components are organized by the feature they belong to.Finding driver code
Finding driver code
Driver implementations are in
/modules/drivers/<driver-name>/ for built-in drivers, or /src/metabase/driver/ for core driver interfaces.Next steps
- Learn about testing practices
- Understand the driver interface
- Read about building drivers