Buildless + Turbo

Using Buildless with Turborepo's remote cache feature

Turborepo, a build system focused on JavaScript and TypeScript codebases, supports remote caching through their own API.

You can use Buildless as a drop-in remote build cache with Turborepo. To set things up, follow the directions below.

Obtain your account and API key

Before you configure Maven with Buildless, you'll need to setup your account and obtain your API key. You can sign up for Buildless here. To locate your API key, it depends which kind of key you want to use:

  • For individual users: Your API key is located in the welcome email and in your user settings, accessed from the Buildless Console.
  • For tenant users who wish to authorize an org-level cache (with no specific user), access your org API key in the Buildless Console at Tenant → Settings → Integration.

Authorizing your environment

The easiest and most secure way to use Buildless is via the environment variables and CLI config files. These techniques for configuring the cache keep your API key out of your source code.

Once you obtain your API key, set it in your environment via BUILDLESS_APIKEY:

echo "export BUILDLESS_APIKEY=..." >> ~/.bashrc

Linking Turborepo to Buildless for remote caching

In order to use the remote caching feature, Turborepo repositories must first be linked to a cache provider. To do this, run the following command, taking notice of the additional arguments to ensure Buildless is being configured properly

npx turbo link --api="" --token=$BUILDLESS_APIKEY

Follow the instructions to select the scope of the cache (currently only account scopes are supported), and enable remote caching for this repository.

Unlike with the traditional setup process for Turborepo, there is no need to use turbo login with Buildless, since the --token argument specifies user credentials using a Buildless API Key.

Running builds with remote caching

After linking the repository, use the following arguments when calling turbo to use Buildless:

npx turbo build --api="" --token=$BUILDLESS_APIKEY

Code sample

Check out our code samples, including our code sample for Turborepo.