Menu
Guides
Storefront Development

Storefront Development

FastStore CLI

4 min read
The FastStore Command Line Interface (CLI) provides pre-configured scripts for starting, building, and developing FastStore projects. It also helps keep FastStore projects up to date with the @faststore/core package.

Before you begin

To ensure the FastStore CLI commands related to the Headless CMS run correctly, make sure to install the Headless CMS, its dependencies and plugins as described in the FastStore requirements.

Running FastStore CLI on the project

The CLI is automatically added as a dependency in your project's package.json file, so once you run yarn install during the project setup, you can start using it in the project.

Installing FastStore CLI globally

To use FastStore CLI commands globally on your machine, install the @faststore/cli package:
yarn
npm

_10
yarn global add @faststore/cli

Default commands

Below is a brief description of the default commands available in the FastStore CLI. To view detailed information about each command, click the respective command name.
Running commands via yarn is sufficient for developing your store. However, to set up your project with the Headless CMS, create new sections, or scaffold a new store, you must install the FastStore CLI globally and use its commands.
Command nameDescription
buildGenerates a production-ready storefront. It compiles the project and optimizes it for production usage.
cms-syncSyncs the cms folder of your FastStore project with the Headless CMS.
devStarts the project in the development environment and uses http://localhost:3000 as the default server. It allows you to make changes to the project and see the results locally in real time without affecting the production environment.
generate-graphqlOptimizes the schema and regenerates TypeScript types so that recent changes take effect without restarting the development server.
helpDisplays help for FastStore CLI commands.
startExecutes the FastStore project in the root directory and uses http://localhost:3000 as the default server.
testRuns the project's end-to-end tests.

build

Generates a production-ready storefront. It compiles the project and optimizes it for production usage.

Usage


_10
yarn build


_10
faststore build [PATH] [--no-verify]

  • PATH (optional): the path where the FastStore project being built is located. Defaults to the current working directory.
  • --no-verify (optional): skips verification of the @faststore/* dependency version strings, preventing the use of packages installed from outside the npm registry.
🔼 Back

cms-sync

Syncs the cms folder of your FastStore project with the Headless CMS. Depending on the contentSource.type set in your discovery.config.js file, this command automatically syncs content using either the legacy Headless CMS flow or the Content Provider (CP) schema publishing flow.

Usage


_10
yarn cms-sync


_10
faststore cms-sync [PATH] [-d, --dry-run]

  • PATH (optional): the path where the FastStore project being synced with the CMS is located. Defaults to the current working directory.
  • -d, --dry-run (optional): runs the sync steps without actually publishing the schema or content, useful for previewing changes beforehand.
🔼 Back

dev

Starts the project in the development environment and uses http://localhost:3000 as the default server. This allows you to make changes to the project and see the results locally in real time without affecting the production environment.

Usage


_10
yarn dev


_10
faststore dev [PATH] [PORT] [--watch-plugins]

  • PATH (optional): the path where the FastStore project being run is located. Defaults to the current working directory.
  • PORT (optional): the port where FastStore should run. Defaults to 3000.
  • --watch-plugins (optional): also watches installed @vtex scoped packages inside node_modules for changes, useful when developing plugins alongside your store.
🔼 Back

generate-graphql

Optimizes the schema and regenerates TypeScript types so that recent changes take effect without restarting the development server.

Usage


_10
yarn faststore generate-graphql


_10
faststore generate-graphql

🔼 Back

help

Displays help for FastStore CLI commands.

Usage


_10
yarn faststore help


_10
faststore help [COMMAND] [-n, --nested-commands]

  • COMMAND (optional): the command to show help for.
  • -n, --nested-commands (optional): includes all nested commands in the output.
🔼 Back

start

Executes the FastStore project in the root directory and uses http://localhost:3000 as the default server. If the project hasn't been built yet, it runs build automatically before starting the server.
In FastStore CLI 3.x versions, this command was invoked as start instead of serve. If you're on an older CLI version, use faststore start instead.

Usage


_10
yarn start


_10
faststore serve [PATH] [PORT]

  • PATH (optional): the path where the FastStore project being run is located. Defaults to the current working directory.
  • PORT (optional): the port where FastStore should run. Defaults to 3000.
🔼 Back

test

Runs the project's end-to-end tests, watching the project files for changes.

Usage


_10
yarn test


_10
faststore test [PATH]

  • PATH (optional): the path where the FastStore project being tested is located. Defaults to the current working directory.
🔼 Back