Coveo Turbo is a CLI-based tool designed to speed up development by standardizing and automating common tasks to quick start the creation of a reusable custom component or implementation project.
This article explains how to get started using Coveo Turbo to create, modify, and publish a component.
To learn how to test an existing component without cloning an existing project, see Testing Coveo Turbo Components.
For the full reference of the Coveo Turbo CLI, see CLI Reference.
To install Coveo Turbo, you need a Node environment with npm. You can download and install both on the node.js website.
Coveo Turbo requires at least version 12 of Node.js. While using previous versions may work for certain commands, it’s possible that other commands will not work properly.
You can create a new project using the following command:
npx @coveops/cli create:project TestComponent --create-component --with-styles --with-page
Remember to change
TestComponentwith the name of your component.
--template vanillato the command. Similarly, to use pure CSS instead of Sass, add
--styles-template vanillato the command.
This command does the following things:
The search page is not automatically connected to a Coveo Cloud organization; this can be added when serving the component.
Once you have created your component, you can start modifying the created template to develop your functionality.
In the generated
src folder, you should be able to find a
TestComponent is replaced with the name you gave your component). This file handles the logic of your component, and is written in Typescript.
To learn how to create custom TypeScript components, see Advanced Integration With Custom TypeScript Component (Implementation).
You can also change the styling of the component by changing the
src\stylesheets\TestComponent.scss Sass file (where
TestComponent is replaced with the name you gave your component).
Once you have modified your component and are ready to test it, you need to run the build command, so the code can be built.
To do so, run the following command, provided by the Makefile generated with the project. Remember to replace TestComponent with the name of your component.
./node_modules/.bin/coveops build TestComponent
.\node_modules\.bin\coveops build TestComponent
For a full list of all build options, see CLI Reference - Build.
You should consider enabling watch on your builds, so you don’t have to manually run the build command every time you make changes. The command would look like this:
./node_modules/.bin/coveops build TestComponent --watch
.\node_modules\.bin\coveops build TestComponent --watch
Note that the watch option does not serve the component.
During development, you’re likely to want to see your component in action. By serving your code, you are deploying it locally, allowing you to test your component in a working Coveo search page.
You are encouraged to use your own Coveo organization to test your components, as some components can expect a certain item structure to work properly. However, if you do not have one, you can use a sample Coveo Cloud organization by omitting an
To serve your component, enter the following command:
./node_modules/.bin/coveops serve --org-id yourorgid --token "your-token"
.\node_modules\.bin\coveops serve --org-id yourorgid token --"your-token"
Remember to change
yourorgidwith the id of your organization, and
your-tokenwith a valid search token or API key. For more information on how to get these values, see Managing Coveo Organization Settings and Limits and Adding and Managing API Keys.
The page is then served and available at