Documentation
CLI

CLI

The Cube command line interface (CLI) is used for various Cube workflows. It could help you in areas such as:

  • Creating a new Cube service;
  • Generating a data model based on your database tables;

Quickstart

Once installed, run the following command to create new Cube service

npx cubejs-cli create <project name> -d <database type>

specifying the project name and your database using -d flag. Available options:

  • postgres
  • mysql
  • mongobi
  • athena
  • redshift
  • bigquery
  • mssql
  • clickhouse
  • snowflake
  • presto

For example,

npx cubejs-cli create hello-world -d postgres

Once run, the create command will create a new project directory that contains the scaffolding for your new Cube project. This includes all the files necessary to spin up the Cube backend, example frontend code for displaying the results of Cube queries in a React app, and some example data model files to highlight the format of the Cube Data Model layer.

The .env file in this project directory contains placeholders for the relevant database credentials. For MySQL, Redshift, and PostgreSQL, you'll need to fill in the target host, database name, user and password. For Athena, you'll need to specify the AWS access and secret keys with the access necessary to run Athena queries (opens in a new tab), and the target AWS region and S3 output location (opens in a new tab) where query results are stored.