Sign up for Cube.js Releases and UpdatesAwesome product updates; no spamBuilt for DevelopersWe obsess over developer experience. Cube.js gives development teams the building blocks to create a complex, custom-tailored analytics experience.Bar ChartTime
SeriesTableDate PickerClient
Or check out the Cube.js examples repository.1. Install Cube.js CLI with NPM or Yarn
import React from 'react';
import cubejs from '@cubejs-client/core';
import { QueryRenderer } from '@cubejs-client/react';
import { Spin } from 'antd';
import { Chart, Axis, Tooltip, Geom } from 'bizcharts';
const HACKER_NEWS_API_KEY = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpIjozODU5NH0.5wEbQo-VG2DEjR2nBpRpoJeIcE_oJqnrm78yUo9lasw';
const Example = <QueryRenderer
cubejsApi={cubejs(HACKER_NEWS_API_KEY)}
query={{
measures: ['Stories.count'], dimensions: ['Stories.category']
}}
render={({ resultSet }) => {
if (!resultSet) return <Spin />;
return (
<Chart data={resultSet.chartPivot()} height={400} forceFit>
<Axis name="category" />
<Axis name="Stories.count" />
<Tooltip />
<Geom type="interval" position="category*Stories.count" />
</Chart>
);
}}
/>;
export default Example;Cube.js Data Schema
cube(`Stories`, {
sql: `select * from \`bigquery-public-data\`.hacker_news.stories`,
measures: {
count: {
type: `count`
}
},
dimensions: {
category: {
type: `string`,
case: {
when: [
{ sql: `STARTS_WITH(${title}, "Show HN")`,
label: `Show` },
{ sql: `STARTS_WITH(${title}, "Ask HN")`,
label: `Ask` }
],
else: { label: `Other` }
}
},
time: {
sql: `time_ts`,
type: `time`
},
title: {
sql: `title`,
type: `string`
}
}
});Generated SQL
SQL Code OrganizationSooner or later, modeling even a dozen metrics with a dozen dimensions using pure SQL queries becomes a maintenance nightmare, which ends with you building a modeling framework.InfrastructureCube.js provides key
components every production-ready analytics solution requires: analytic SQL generation, query results caching and execution orchestration, data pre-aggregation, security, and API for query results fetch.PerformanceCube.js has necessary infrastructure
for every analytic application that heavily relies on its caching and pre-aggregation layer to provide sub-second API response times on a scale of a trillion data points.Cube.js empowers the developers to build custom and large-scale analytics featuresCube.js
is designed to work with large-scale data sets and implements various optimization techniques. It takes the pain out of building analytics by providing the required infrastructure.Supported DatabasesAND MANY OTHERSGetting
Started with Cube.jsStart using Cube.js by following the simple steps below. Or check out the Cube.js examples repository.1. Install Cube.js CLI with NPM or Yarn
Cube.js CLI is used for various Cube.js workflows.
$ npm install -g cubejs-cli2. Connect to Your Database
Connect to your existing data warehouse or set up a new one.
$ cubejs create hello-world -d postgres3. Define Your Data SchemaUse Cube.js Schema to model raw data into meaningful business definitions.Learn more4. Visualize ResultsNow you can use Cube.js client libraries and
API to build analytics features directly into your apps.Learn moreGet Started