Home > Articles > Next.js BigCommerce: The Ultimate E-commerce Solution

Next.js BigCommerce: The Ultimate E-commerce Solution

April 11, 2024
Written and researched by experts at AvadaLearn more about our methodology

By Sam Nguyen

CEO Avada Commerce

Dive into the dynamic synergy between Next.js and BigCommerce, a powerful duo that revolutionizes the e-commerce landscape for developers and online retailers alike.

Explore how integrating Next.js’s server-side rendering with BigCommerce’s robust e-commerce platform can elevate user experiences, enhance performance, and streamline development processes.

Key takeaways

  • Next js BigCommerce offers seamless integration, allowing developers in the developer community to build customizable storefronts while leveraging BigCommerce’s robust backend features.

Overview

BigCommerce offers cloud-based ecommerce solutions, including themes with powerful design tools for building and hosting your storefront data hooks.

Headless BigCommerce

BigCommerce’s flexibility enables headless architecture and helps integrate storefront frontends with the BigCommerce backend. Benefits include:

  • Customizing frontend technologies without database preserve/ migration
  • Preserving legacy frontends while adopting BigCommerce
  • Managing multiple stores across various sales channels from one dashboard.

Next.js Commerce

Next.js Commerce, a headless setups integration with BigCommerce, demonstrates the synergy between Next.js and BigCommerce. Developed in collaboration with Next.js and Vercel teams, it showcases Next.js’s ecommerce engine power alongside our ecommerce platform. Check out the demo application to explore Next.js Commerce’s robust features.

How to apply the Next.js + BigCommerce

Prerequisite Requirements

Here are several prerequisite requirements to take into account before applying the Next.js – BigCommerce integration:

  • An IDE or text editor: VScode, Sublime text, etc.
  • Basic knowledge of Next.js
  • Knowledge of BigCommerce APIs
  • Git provider: GitHub, Bitbucket, GitLab
  • NPM

Direct Deployment of Next.js Commerce from Vercel

Here are the step-by-step instructions for integrating Next.js Commerce with BigCommerce, taking the main advantages from Vercel:

Step 1. 

Go to nextjs.org/commerce and click on “Deploy”.

Deploy Next.js Commerce
Deploy Next.js Commerce

Step 2. 

Log in to Vercel using one of the supported Git providers. If you don’t have a Vercel account, you’ll need to create one.

Log in to Vercel
Log in to Vercel

Step 3. 

After logging in, you’ll be prompted to create a Git repository. Choose your Git Scope and provide a name for the repository. Click “Create” to proceed.

Create Git Repository
Create Git Repository

Step 4. 

Optionally, you can create a Vercel team or skip this step.

Step 5. 

In the “Add Integrations” dialog, click on “Add” to connect your BigCommerce store to your Vercel’s tool project.

Connect your BigCommerce store
Connect your BigCommerce store

Step 6. 

In the “Add BigCommerce to Your Vercel Project” dialog:

Log in or Sign up Bigcommerce account
Log in or Sign up Bigcommerce account
  • If you’re an existing developer on BigCommerce, select “Log In” and use your BigCommerce credentials to integrate BigCommerce and Vercel. Follow the on-screen instructions to install the Vercel app to your BigCommerce store.
Log in to Bigcommerce store
Log in to Bigcommerce store
  • If you’re new to BigCommerce, select “Sign Up” to create a BigCommerce developer community sandbox store and populate it with sample data. Vercel will automatically connect Next.js Commerce to this sandbox store. If you later want to upgrade your sandbox store to a live store, contact BigCommerce at 1-888-248-9325.

Step 7. 

Once the deployment to Vercel is complete, you’ll see your site deployed in a thumbnail image.

Local Server Development Following Vercel Deployment

1. Visit the Git provider where Vercel created a new repository and clone it locally.

2. Navigate to the root directory of the locally cloned project. Duplicate the .env.template file and rename the duplicate to .env.local. Insert your environmental variables using the following references:

.env.template

BIGCOMMERCE_STOREFRONT_API_URL=https://store-${STORE_HASH}.mybigcommerce.com/graphql
BIGCOMMERCE_STOREFRONT_API_TOKEN=${STOREFRONT_TOKEN}
BIGCOMMERCE_STORE_API_URL=https://api.bigcommerce.com/stores/${STORE_HASH}
BIGCOMMERCE_STORE_API_TOKEN=${STORE_TOKEN}
BIGCOMMERCE_STORE_API_CLIENT_ID=${STORE_CLIENT}

.env.local


COMMERCE_PROVIDER=bigcommerce
BIGCOMMERCE_STOREFRONT_API_URL=https://store-${STORE_HASH}-${CHANNEL_ID}.mybigcommerce.com/graphql
BIGCOMMERCE_STOREFRONT_API_TOKEN=${STOREFRONT_API_TOKEN}
BIGCOMMERCE_STORE_API_URL=https://api.bigcommerce.com/stores/${STORE_HASH}
BIGCOMMERCE_STORE_API_TOKEN=${STORE_TOKEN}
BIGCOMMERCE_STORE_API_CLIENT_ID=${STORE_CLIENT}
BIGCOMMERCE_CHANNEL_ID=${CHANNEL_ID}
BIGCOMMERCE_STORE_URL=https://store-${STORE_HASH}.mybigcommerce.com
BIGCOMMERCE_STORE_API_STORE_HASH=${STORE_HASH}

Important details:

  • STORE_HASH: Retrieve it from your BigCommerce store control panel URL in the format of https://store-${STORE_HASH}.mybigcommerce.com/manage/dashboard
Get Bigcommerce STORE_HASH
Get Bigcommerce STORE_HASH
  • STORE_TOKEN|STORE_CLIENT: Follow the instructions on Static Generation of  Store API credentials.
  • STOREFRONT_API_TOKEN: Follow the instructions on generating the Storefront API token.
  • CHANNEL_ID: Utilize the channel ID created by Vercel during deployment. Refer to the documentation on retrieving channel/ store information.

Note:

Any changes you save and push to your Git repository will automatically trigger a redeployment on Vercel. Additionally, you can manually trigger a redeployment through the Vercel dashboard.

Key Features of Next.js + BigCommerce

Next.js + BigCommerce combination includes the following features:

1. Next.js App Router: This feature is the built-in routing system in Next.js that enables seamless navigation between different statically generated pages of your storefront. It ensures a smooth and intuitive browsing experience for your customers as they explore your products and dynamic content.

2. Optimized for SEO using Next.js’s Metadata: By leveraging Next.js’s metadata capabilities, your storefront is finely tuned to meet the requirements of search engine algorithms. This optimization enhances the visibility of your products and content in search engine results, driving more organic traffic to your site.

Optimized for SEO using Next.js's Metadata
Optimized for SEO using Next.js’s Metadata

3. React Server Components (RSCs) and Suspense: These advanced features within Next.js improve the performance and responsiveness of your storefront. React Server Components efficiently manage the loading and re rendering of components. At the same time, Suspense optimizes data fetching, resulting in faster page load times and smoother user interactions.

4. Route handlers for mutations: With route handlers, your storefront can seamlessly handle data mutations, such as adding or updating products in a customer’s cart. This capability ensures that user changes are accurately processed and reflected in real-time, providing a reliable shopping experience.

5. Edge runtime: Your storefront benefits from improved speed and reliability by leveraging an edge runtime environment. Code is executed closer to the user, reducing latency and enhancing overall performance, especially for customers accessing your site from different locations.

6. New fetching and caching paradigms: These innovative data retrieval and storage approaches optimize your storefront’s performance. By efficiently fetching and caching data, your site experiences faster loading times and smoother user interactions, even during peak traffic.

7. Dynamic OG images: This feature dynamically generates visually appealing images optimized for sharing on social media platforms. These images, when shared, enhance the attractiveness of your storefront’s content, driving more traffic and potential customers to your site.

8. Styling with Tailwind CSS: Tailwind CSS simplifies the process of styling your storefront with its utility-first approach. This framework allows for quick and consistent design choices, empowering developers to create visually appealing layouts without extensive custom coding.

Styling with Tailwind CSS
Styling with Tailwind CSS

9. Automatic light/dark mode based on system settings: Enhancing user experience, this feature automatically adjusts the appearance of your storefront based on the user’s system preferences. Whether a user prefers a light or dark color scheme, your site seamlessly adapts, providing a comfortable and personalized browsing experience.

Benefits of Using Next.js with BigCommerce

  • Enhanced Performance: By employing Next.js for the front end, websites can experience significantly faster load times and improved performance. This is achieved through Next.js’s efficient pre rendering techniques that optimize how content is displayed to users.
Enhanced Performance
Enhanced Performance
  • Improved next SEO settings: Next.js’s server-side rendering capabilities make e-commerce websites more search engine-friendly. This means that search engines can easily crawl and index your site’s static content, resulting in better visibility and higher rankings in search results.
  • Scalability: Next.js and BigCommerce are built to handle scalability effectively. This makes them an ideal choice for e-commerce businesses of any size, whether you’re just starting or managing a large-scale operation. The combination ensures that your website can grow along with your business demands.
  • Customization and Flexibility: Leveraging Next.js empowers developers to create highly customized storefronts tailored to your business’s specific needs and branding. Despite this high level of customization, Next.js seamlessly integrates with BigCommerce’s robust e-commerce engine through its API, providing flexibility without sacrificing helper functions.
  • Developer Experience: Next.js offers a developer-friendly environment with features like hot reloading, automatic code base splitting, and a rich ecosystem of plugins. This enhances the development process, making it more efficient and enjoyable for developers working on the project.

See more: BigCommerce App Development: How to Build One

FAQs

You'll need an IDE or text editor like VScode, basic knowledge of Next.js, familiarity with BigCommerce APIs, a Git provider (GitHub, Bitbucket, GitLab), and NPM for package management.

Headless BigCommerce allows integration of storefront frontends with the BigCommerce backend, offering flexibility to customize frontend technologies without migrating direct database queries, preserving legacy frontend while adopting BigCommerce, and managing multiple stores across multiple sales channels from one dashboard.

Next.js + BigCommerce provides a range of features, including optimized SEO, enhanced performance, scalability, customization options, a developer-friendly environment, and seamless integration with BigCommerce's e-commerce engine.

In short

In short, Next.js + BigCommerce offers a seamless integration that empowers businesses to create high-performing and customizable online stores. With features like optimized SEO, enhanced performance, and scalability, this combination provides a comprehensive solution for businesses of all sizes. 


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.