BigCommerce is an ecommerce platform for building and managing online storefronts. This guide explains how to deploy a headless storefront using Next.js on Vercel.
This guide uses Catalyst by BigCommerce to connect your BigCommerce store to a Vercel deployment. Catalyst was developed by BigCommerce in collaboration with Vercel.
You can use this guide as a reference for creating a custom headless BigCommerce storefront, even if you're not using Catalyst.
You can deploy the Catalyst by BigCommerce template directly to Vercel, or use the steps below to fork and clone it locally.
You can use an existing BigCommerce account and storefront, or get started with one of these options:
- Fork the Catalyst repository on GitHub. You can name your fork as you prefer. This guide refers to it as
<YOUR_FORK_NAME>. - Clone your forked repository to your local machine:
Replace <YOUR_GITHUB_USERNAME> with your GitHub username and <YOUR_FORK_NAME> with the name you chose for your fork.
To automatically sync updates, add the BigCommerce Catalyst repository as a remote named "upstream":
Verify the local repository is set up with the remote repositories:
The output should look similar to this:
Learn more about syncing a fork.
Catalyst requires pnpm as the Node.js package manager. Corepack helps manage package manager versions. Run this command to enable Corepack, activate pnpm, and install dependencies:
The Catalyst CLI helps set up and configure your project. When run, it will:
- Guide you through logging into your BigCommerce store
- Help you create a new or select an existing Catalyst storefront Channel
- Automatically create an
.env.localfile in your project root
Run the following command:
Follow the CLI prompts to complete the setup.
After setting up your project and configuring the environment variables, start the development server from your project root:
Your local storefront should now be accessible at http://localhost:3000.
Now that your Catalyst storefront is configured, deploy your project to Vercel.
Visit https://vercel.com/new to create a new project. You may be prompted to sign in or create a new account.
- Find your forked repository in the list.
- Click the Import button next to your repository.
- In the Root Directory section, click the Edit button.
- Select the
coredirectory from the file tree. Click Continue to confirm your selection. - Verify that the Framework preset is set to Next.js. If it isn't, select it from the dropdown menu.
- Open the Environment Variables dropdown and paste the contents of your
.env.localinto the form. - Click the Deploy button to start the deployment process.
To link your local development environment with your Vercel project, install the Vercel CLI globally:
Then link your local project to your Vercel project:
Learn more about the Vercel CLI.
Vercel Remote Cache optimizes your build process by sharing build outputs across your team, eliminating redundant tasks.
Run this command to authenticate the Turborepo CLI with your Vercel account:
For SSO-enabled Vercel teams, include your team slug:
To link your project to a team scope and specify who the cache should be shared with:
If the team owner has disabled Remote Caching, Turborepo will display: "Please contact your account owner to enable Remote Caching on Vercel."
To securely sign artifacts before uploading them to the Remote Cache, add the TURBO_REMOTE_CACHE_SIGNATURE_KEY environment variable to your Vercel project:
When prompted, add the environment variable to Production, Preview, and Development environments. Set the value to a secure random string by running openssl rand -hex 32 in your terminal.
Pull the new environment variable into your local project:
Learn more about Vercel Remote Cache.
The Catalyst monorepo comes pre-configured with Vercel Web Analytics and Speed Insights. These tools help you understand and optimize your storefront's performance.
- Web Analytics provides real-time insights into your site's traffic and user behavior.
- Speed Insights offers detailed performance metrics and suggestions to optimize your site's loading speed.
For more advanced configurations, refer to the BigCommerce Catalyst documentation.