Repository: cube-js/cube
Stars: 19814
CLAUDE.md
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Repository Overview
Cube is a semantic layer for building data applications. This is a monorepo containing the complete Cube ecosystem including:
- Cube backend server and core components
- Client libraries for JavaScript/React/Vue/Angular
- Database drivers for various data sources
- Documentation site
- Rust components (CubeSQL, CubeStore)
Development Commands
Note: This project uses Yarn as the package manager.
Core Build Commands
Build all packages
yarn buildRun TypeScript compilation across all packages
yarn tscWatch mode for TypeScript compilation
yarn tsc:watchClean build artifacts
yarn cleanRun linting across all packages
yarn lintFix linting issues
yarn lint:fixLint package.json files
yarn lint:npmTesting Commands
Run tests (most packages have individual test commands)
yarn testTest individual packages
cd packages/cubejs-[package-name]
yarn testDocumentation Development
The documentation is in
/docs directory:cd docs
yarn dev # Start development server
yarn build # Build for productionArchitecture Overview
Monorepo Structure
-
/packages: All JavaScript/TypeScript packages managed by Lerna- Core packages:
cubejs-server-core, cubejs-schema-compiler, cubejs-query-orchestrator - Client libraries:
cubejs-client-core, cubejs-client-react, etc.- Database drivers:
cubejs-postgres-driver, cubejs-bigquery-driver, etc.- API layer:
cubejs-api-gateway-
/rust: Rust components including CubeSQL (SQL interface) and CubeStore (distributed storage)-
/docs: Next.js documentation site-
/examples: Example implementations and recipesKey Components
1. Schema Compiler: Compiles data models into executable queries
2. Query Orchestrator: Manages query execution, caching, and pre-aggregations
3. API Gateway: Provides REST, GraphQL, and SQL APIs
4. CubeSQL: Postgres-compatible SQL interface (Rust)
5. CubeStore: Distributed OLAP storage engine (Rust)
6. Tesseract: Native SQL planner (Rust) located in
/rust/cubesqlplanner - enabled via CUBESQL_SQL_PUSH_DOWN=true environment variablePackage Management
- Uses Yarn workspaces with Lerna for package management
- TypeScript compilation is coordinated across packages
- Jest for unit testing with package-specific configurations
Testing Approach
Unit Tests
- Most packages have Jest-based unit tests in
/test directories- TypeScript packages use
jest.config.js with TypeScript compilation- Snapshot testing for SQL compilation and query planning
Integration Tests
- Driver-specific integration tests in
/packages/cubejs-testing-drivers- End-to-end tests in
/packages/cubejs-testing- Docker-based testing environments for database drivers
Test Commands
Individual package testing
cd packages/[package-name]
yarn testDriver integration tests (requires Docker)
cd packages/cubejs-testing-drivers
yarn testDevelopment Workflow
1. Making Changes: Work in individual packages, changes are coordinated via Lerna
2. Building: Use yarn tsc to compile TypeScript across all packages
3. Testing: Run relevant tests for modified packages
4. Linting: Ensure code passes yarn lint before committing
Git
Use conventional commits with these prefixes:
- feat: β new features
- fix: β bug fixes
- docs: β documentation changes
- refactor: β code refactoring
Include scope in parentheses when applicable, e.g., fix(tesseract): or feat(databricks-jdbc-driver):.
Common File Patterns
- *.test.ts/js: Jest unit tests
- jest.config.js: Jest configuration per package
- tsconfig.json: TypeScript configuration (inherits from root)
- CHANGELOG.md: Per-package changelogs maintained by Lerna
- src/: Source code directory
- dist/: Compiled output (not committed)
Important Notes
- This is documentation for the old Cube docs site structure (the existing /docs/CLAUDE.md refers to the documentation site)
- The main Cube application development happens in /packages
- For data model changes, focus on cubejs-schema-compiler package
- For query execution changes, focus on cubejs-query-orchestrator package
- Database connectivity is handled by individual driver packages
Key Dependencies
- Lerna: Monorepo management and publishing
- TypeScript: Primary language for most packages
- Jest: Testing framework
- Rollup: Bundling for client libraries
- Docker: Testing environments for database drivers
README.md
![]()
<p align="center">
<a href="https://cube.dev?ref=github-readme"><img src="https://raw.githubusercontent.com/cube-js/cube/master/docs/content/cube-core-logo.png" alt="Cube Core β Open-Source Semantic Layer" width="300px"></a>
</p>
<br/>
Website β’ Docs β’ Examples β’ Blog β’ Slack β’ X



__Cube Core is an open-source semantic layer.__ Cube Core can be used to build embedded analytics in your applications, create your own business intelligence tool or provide context about data to AI agents. Cube Core is headless and comes with multiple APIs for embedded analytics and BI: REST, GraphQL, and SQL.
If you are looking for a fully integrated platform, check out Cube, a modern AI-first business intelligence platform. We use Cube Core to power it.
<img
src="https://lgo0ecceic.ucarecd.net/418db1f9-7597-4e00-8c10-eba19fcac20f/"
style="border: none"
width="100%"
/>
<p align="center">
<i>Learn more about connecting Cube to <a href="https://cube.dev/cube-core/getting-started/create-a-project?ref=github-readme" target="_blank">data sources</a> and <a href="https://cube.dev/docs/integrations?ref=github-readme" target="_blank">analytics & visualization tools</a>.</i>
</p>
Cube Core was designed to work with all SQL data sources, including cloud data warehouses like Snowflake, Databricks, and BigQuery; query engines like Presto and Amazon Athena; and application databases like Postgres. Cube Core has a built-in relational caching engine to provide sub-second latency and high concurrency for API requests.
Why Cube Core?
Every business intelligence tool relies on a semantic layer as its core engineβa critical component that defines metrics, dimensions, and business logic while abstracting the complexity of underlying data sources. However, most semantic layers are proprietary, tightly coupled to specific BI platforms, and cannot be reused across different applications.
Cube Core is an open-source project that aims to create an open, modern semantic layer that can be used to power any analytics applications and AI agents. By decoupling the semantic layer from specific tools and making it accessible through standard APIs, Cube Core enables organizations to define their metrics once and use them everywhereβfrom BI tools to embedded analytics to AI agents.
Getting Started π
You can get started with Cube locally or self-host it with Docker.
Once Docker is installed, in a new folder for your project, run the following command:
docker run -p 4000:4000 \
-p 15432:15432 \
-v ${PWD}:/cube/conf \
-e CUBEJS_DEV_MODE=true \
cubejs/cubeThen, open http://localhost:4000 in your browser to continue setup.
For a step-by-step guide, see the docs.
Cube β Complete Modern BI Tool from Cube Core Creators
Cube is a complete modern agentic analytics platform built on Cube Core. It provides a fully integrated solution with a user-friendly interface, advanced analytics capabilities, and managed infrastructure.
<a href="https://cubecloud.dev/auth/signup?ref=github-readme"><img src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/f1f1eac0-0b44-4c47-936e-33b5c06eedf0.png" alt="Get started now" width="200px"></a>
Resources
- Documentation
- Getting Started
- Examples & Tutorials
- Architecture
Contributing
There are many ways you can contribute to Cube Core! Here are a few possibilities:
* Star this repo and follow us on X.
* Add Cube to your stack on Stackshare.
* Upvote issues with π reaction so we know what the demand is for particular issues to prioritize them within the roadmap.
* Create issues every time you feel something is missing or goes wrong.
* Ask questions on Stack Overflow with cube.js tag if others might have these questions as well.
* Provide pull requests for all open issues and especially for those with help wanted and good first issue labels.
All sorts of contributions are welcome and extremely helpful π Please refer to the contribution guide for more information.
License
Cube Client is MIT licensed.
Cube Backend is Apache 2.0 licensed.
