Next.js Commerce

Overview and first steps

Next.js Commerce

On October 27, the Next.js conf, the global conference of Next.js for the developer community, this year in online and interactive format. In the inaugural keynote of the event, organized by Vercel (creators of Next.js and formerly known as Zeit) the new platform Commerce was presented (, a solution based on Next.js to be able to integrate with different ecommerce backends and that promises speed, ease of development and all the advantages associated with developing with Next.js such as internationalization, analytics, image optimization.

Next.js Commerce Homepage

Next.js Commerce Homepage

The idea of this project is to use Next.js and all its advantages as the basis for the development of a great ecommerce platform, easy to develop, with multiple integrations, scalable, accessible and capable of contributing to the development of both simple and large stores. marketplaces with the same knowledge base. To begin with, they have integrated with BigCommerce through a module for Next.js, although they promise to work on integrations with other platforms and services such as Shopify, Magento, Wordpress, etc ...

The challenge is titanic, but it seems that they have things quite clear and an active community willing to collaborate. I have spent a few days creating an environment, playing with the platform and developing some component and even doing some PR.

In this article we are going to summarize the process of creating, installing and developing a project with Next.js commerce and several simple development examples.


  • Next.js (of course) with TypeScript
  • Tailwind
  • BigCommerce Data Hooks to interact with BigCommerce
  • CSS Modules to modify specific styles


The easiest way to install this platform is by using Vercel as a hosting and CI service, since through this system you can automatically clone the repository, display and set the environment variables to connect with the backend. To do this, we go to the project home and click on "Clone & Deploy".

Clone & deploy

If you do not have an account created, a new user registration form will start and once created, you will go to the project settings, where the BigCommerce integration will be installed. If you don't have a BigCommerce account or project previously, a new one will be created.

Vercel Integrations

BigCommerce Login

After a couple more clicks to confirm the repository to be created will be confirmed and deployment will begin. Simpler impossible.

Next.js deploy in Vercel

Example of Next.js deployment in Vercel

After finishing the deployment, Vercel shows us the URL of the storefront. We are not going to investigate the possibilities of Vercel which are infinite and we are going to focus on the structure of the code and what can be done in a couple of hours working with Next.js Commerce.

Home of Next.js Commerce

Home of Next.js Commerce


To start working with the code, we clone the previously created repository and open it with VSCode. At a glance we can see the following:

Project structure

  • Assets: Folder with CSS files and Tailwind overrides.
  • Components: Folder with all the components of the project, organized by scope (cart, product, wishlist, common) and generic (ui). Very easy to locate the components with this structure.
  • Config: Folder with general site settings, by default there is only one JSON with SEO settings.
  • Lib: Folder with generic functions of the site such as search, obtaining the slug or hooks used in components and pages. It is a bit of a disaster drawer but there are not many files either so it is somewhat manageable.
  • Pages: Folder with the store pages (blog, cart, search). It is worth highlighting the following pages:
    • slug.tsx. Page in charge of resolving the product page urls and loading the ProductView component.
    • ...pages.tsx. Generic page to resolve any url in Next.

Also, there are also several prominent files:

  • next.config.js: File with general Next.js settings, such as domains, languages and routing. This file is where the search urls and the redirection to the BigCommerce API for the checkout process are defined.


In order to develop locally it is first necessary to download all packages using Yarn.

cd ecommerce-test

Once all the packages have been downloaded, we must link the repository with Vercel to download the environment variables and be able to connect with BigCommerce locally, for this we install Vercel CLI if we had not done it before and link the project

npm i -g vercel
vercel link
vercel env pull .env.local

After this we are ready to develop our store locally 🙂

yarn dev

Note: The integration with BigCommerce does not work smoothly, I have had to create 2 projects in Vercel and link the environment variables 2 times for it to connect with BigCommerce, since the API constantly returned 401.

Logo change

To modify the logo it is necessary to go to components/ui/Logo/Logo.tsx. In this module we can see how the logo has been added in SVG by inserting the code directly, but we can reuse the component by adding our own logo in SVG or by inserting a specific image and saving it in the public folder.

const Logo = ({ className = "", ...props }) => (
    viewBox="0 0 481.11 345"
      transform="translate(-172.19 -137.72)"
      transform="translate(-172.19 -137.72)"

export default Logo

// OR using an image:
import Image from "next/image"

const Logo = ({ className = "", ...props }) => (
  <Image src="/icon-192x192.png" alt="Logo" width="64" height="64" />

export default Logo

New navigation menu

New navigation menu

The navigation logic on this platform are located in the component components/common/Navbar/Navbar.tsx. At the moment there is no integration with CMS or management of elements in a transparent way and without development. To add a link with the current structure, it is as simple as using the Link component of Next.js

<nav className="space-x-4 ml-6 hidden lg:block">
  <Link href="/search">
    <a className={}>All</a>
  <Link href="/search?q=clothes">
    <a className={}>Clothes</a>
  <Link href="/search?q=accessories">
    <a className={}>Accessories</a>
  <Link href="/blog">
    <a className={}>Blog</a>

Bloque de información en página de producto

New content block on product page

New content block on product page

The component that is responsible for rendering the product information is located in components/product/ProductView/ProductView.tsx. This component is loaded on the pages/product/slug.tsx page when the product object is loaded.

We are going to use the Hero component defined in the UI components folder, for this we add the component with our desired values at the end and test its operation.

// Add the Hero component
import { Button, Container, Text, Hero } from '@components/ui'

  return (
    <Container className="max-w-none w-full" clean>
        headline="Free Shipping in all orders"
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

export default ProductView


Although there is a lot of work ahead and adding integrations to the platform, the software is fully functional and developing a simple store can be a very simple and fun task. I am looking forward to seeing the next steps and the reception it has among developers, because this platform promises.


Photo by Dimosthenis Papamichail on Unsplash