2. Setting up the project
Now that your store is up and running after FastStore Onboarding, you're ready to set up your development environment and create a unique storefront that reflects your brand. Let's get started!
In this guide, you will:
- Clone your store repository to your local machine.
- Run a local development server, usually at http://localhost:3000/.
- Make your first change in your storefront.
Before you begin
Required tooling
Before cloning your store's repository, ensure that you have the following tools on your machine:
Node.js
To run your FastStore project, you must have the latest Node.js version or a version higher than
15.0.0
.Yarn
We will use the yarn command-line interface to add functionalities to the store and also run tasks, such as starting a development server.
Install Yarn on macOS by running the following:
_10brew install yarn
Install Yarn on Windows by running the following:
_10npm install -g yarn
Git
When developing your store's website, you will use Git to push your code to the cloud. You will also use Git to download and install the required files for your project.
Visual Studio Code - Code Editor
When developing your store's website, you will need a code editor to write the code for your project, such as Visual Studio Code (a.k.a., VS Code). Visit the VS Code website, download and install the version appropriate to your operating system.
Although you might opt to use an alternative code editor, note that Visual Studio Code might help you follow along with the FastStore documentation since our documentation may include screenshots from VS Code.
Enabling Developer Mode (Windows users)
We strongly recommend enabling Developer Mode when using the terminal for FastStore projects.
Since FastStore projects rely on creating symlinks, this mode grants the necessary permissions and privileges, reducing the chance of errors during development.
To activate Developer Mode, refer to Microsoft's official guide on Enabling your device for development.
Running the FastStore project as an Administrator is not recommended.
Step 1: Cloning the store's repository
-
Open the terminal and navigate to the directory where you want to store your project.For Windows users, we highly recommend enabling the Developer mode to run the terminal.
-
Clone the repository created during the FastStore Onboarding by running the following command in the terminal:_10git clone https://github.com/vtex-sites/{storeName}Replace
{storeName}
for your store's repository. -
Change into the working directory by running the following command:_10cd {storeName}
-
Install all the dependencies listed within the
package.json
file by running the following command:_10yarn install -
Open up your FastStore project in any code editor of your choice.
Note that your store configuration was already set during the FastStore Onboarding. Therefore, there is no need to connect your project to your VTEX account.
If you want to review these configurations, you can access the
discovery.config.js
file in the root directory of your project's repository.Step 2: Running a local server
Let's check what the project looks like in a web browser so far.
-
Start a local development server to serve your website:_10yarn devThis may take a few minutes. Once your development server is ready, the command line will output a similar message as the following:_10ready - started server on 0.0.0.0:3000, url: http://localhost:3000_10event - compiled client and server successfully in 333 ms (951 modules)The
dev
command is part of the FastStore CLI, a pre-configured command line interface in your starter project. Using the CLI, this command enables you to execute code to keep your store's project up-to-date with the @faststore/core package. -
Now, open your favorite web browser and navigate to the localhost served, for example, http://localhost:3000.
While your local development server is running, you can preview any changes you make to your files and saved changes will hot reload in the browser. To stop the development server, return to the terminal and press
Ctrl + C
. To restart it, run yarn dev
again.Step 3: Making the first change in your store frontend
Now that your store is up and running locally, let's make a simple change in the storefront.
Let's make the first level of customization which updates the store's theme. For this customization, we are going to use the Soft Blue theme.
-
Create a new file named
soft-blue.scss
insrc/themes
. This is going to be the new theme of your store. -
Add the following styles to
src/themes/soft-blue.scss
: -
Open the
discovery.config.js
file and change thetheme
fromcustom-theme
tosoft-blue
. -
Restart the server and check in the browser the new theme applied to your store. You may need to refresh the page.It is important to highlight that the store's logo is set through the Headless CMS.