This guide shows you how to deploy the Next.js Commerce starter kit on Layer0. Note that Next.js Commerce repo is actively under development. This repo requires an account on the BigCommerce platform. BigCommerce has a generous free trial which can be used.
Next.js Commerce Example
Here is an example of the Next.js Commerce template running on Layer0. It uses all of the latest Next.js 10 features including image optimization, localization, and incremental static regeneration with stale-while-revalidate.
Sign up for Layer0
Deploying requires an account on Layer0. Sign up here for free.
Install the Layer0 CLI
If you have not already done so, install the Layer0 CLI
npm i -g @layer0/cli
# or
yarn global add @layer0/cli
System Requirements
Deploy the Example
Quickly launch an example with no code by clicking the “Deploy to Layer0” button.
Deploying the official Next.js Commerce repository
If you wish to deploy to Layer0 from the official Next.js Commerce repository, follow these steps:
Clone the official Next.js Commerce repository and install the dependencies.
Terminalgit clone git@github.com:vercel/commerce.git cd commerce yarn
Run Layer0
init
in the project directory:Terminalcd site 0 init
Duplicate
.env.template
and name it.env.local
in the project directory. Add your BigCommerce API keys to it.ℹ️For more details on how to set up your BigCommerce store, view the BigCommerce guideTerminalCOMMERCE_PROVIDER=@vercel/commerce-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}
STORE_HASH
: You can retrieve it from your BigCommerce store control panel URL in the format ofhttps://store-${STORE_HASH}.mybigcommerce.com/manage/dashboard
STORE_TOKEN|STORE_CLIENT
: For instructions on generating Store API credentials, visit Obtaining Store API CredentialsSTOREFRONT_API_TOKEN
: For instructions on generating the Storefront API token, visit Create a Token.CHANNEL_ID
: Visit Building Channels to learn how to create a channel for use in your application.
Deploy to Layer0.
From project root
Terminalnpm run deploy
Or from within
site
directoryTerminal0 deploy
Learn more
Connector
This framework has a connector developed for Layer0. See Connectors for more information.