Brightstack gives you a fast, easy to use, fully-capable data warehouse in 5 minutes. Let’s set it up! First, download and install the CLI:
curl -fsSl https://get.brightstack.ai/install | bash

Setup

quickstart Next, sign up or log in:
bright login
NOTE: this authentication key is valid for one week, so you may need to authenticate again in the future.

Engines

Engines provide the compute resources necessary to access and work with your data. So let’s create one!
bright engine create --name <ENGINE_NAME> --type <ENGINE_TYPE>
After creation, you’ll need to start your engine manually using:
bright engine start <ENGINE_ID_OR_NAME>
This might take up to a minute. Available engine types are sandbox, boost, xsmall, small, medium, and large. You can check the status of your engines using:
bright engine list
You can use engines in running state right away. Here is an example:
bright sql run --engine <ENGINE_ID_OR_NAME> 'SELECT 1;'
NOTE: our data engine is powered by the amazing DuckDB. You can use their awesome documentation as a reference for supported commands and syntax. They have a Postgres-style SQL syntax with additional goodies on top. Remember to stop your engines when you’re done to avoid unnecessary charges:
bright engine stop <ENGINE_ID_OR_NAME>
We’re working on automatic idle detection and stopping to make this easier. To start them back up in the future:
bright engine start <ENGINE_ID_OR_NAME>
Finally, you want to create an API Key in order to use your data engine inside an application.
bright key create <name>
IMPORTANT: the default database is memory-backed. All data in it is lost between restarts. Please create a database and use in order to persist data! Please see the next section for info on how to do this. From this point forward on you can use bright help for a complete command reference. For detailed information about engine tiers, compute units, and storage options, see our Engines documentation.

Usage

Using the CLI is great for maintenance, quick tests, and one-off tasks, but brightstack really shines when you integrate it with your applications using our API or one of our libraries. Below is an example of integration using our JS client library, @brightstack/client. More clients coming soon!

Installation

npm install @brightstack/client

Setup Client

Instantiate your dw (data warehouse) client:
// dw.ts
import { brightstack } from "@brightstack/client";

// will auto-detect settings from your environment
const dw = brightstack({
  apiKey: "MY_API_KEY",
  engine: "production",
  database: "myapp",
});

export default dw;

Create a Database

The default database is memory-backed. All data is lost between engine restarts. In order to persist data you must create and use a database.
import dw from "./dw";

// Create a new database
await dw.sql("CREATE DATABASE hits;");

// Use the database
await dw.sql("USE hits;");

Making SQL Queries

Our Data Engine is powered by a DuckDB core, so most of DuckDB’s SQL dialect will work out of the box.
import dw from "./dw";

// Simple query
const result = await dw.sql("SELECT * FROM users LIMIT 10;");
// Result: [{ id: 'usr_d78as6bg', name: 'Bob' }]

// Create a table and insert data
await dw.sql(`
  CREATE TABLE products (
    id INTEGER PRIMARY KEY,
    name VARCHAR,
    price DECIMAL(10,2)
  );
`);

await dw.sql(`
  INSERT INTO products VALUES 
    (1, 'Laptop', 999.99),
    (2, 'Mouse', 29.99),
    (3, 'Keyboard', 79.99);
`);

// Query the data
const products = await dw.sql("SELECT COUNT(*) as total FROM products;");
console.log(products); // [{ total: '3' }]
Here is a reference of the data types we support. For advanced usage including raw API calls, sessions, and more detailed examples, see our Advanced documentation.