In this guide, you will set up a GraphCommerce app locally, allowing you to start building.
nvm install 16
or nvm use 16
corepack enable
git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git
# Clone repository
mkdir my-project
# Create project folder
cp -R graphcommerce/examples/magento-graphcms/. my-project && rm -rf graphcommerce && cd my-project
# Copy example, delete repo, navigate to project folder
Duplicate and rename the configuration example file to:
graphcommerce.config.js
and configure the following:
magentoStoreCode
The first storeview in your object is loaded by default, with no added suffix to the URL. As the user switches to, e.g., the Canadian storeview, the suffix /en-ca is added to the URL. The locale, e.g., en-ca, is used to load the storeview translation A user is auto-redirected to the relevant storeview when their browser language matches the locale (Admin > Store > Configuration > General > General > Locale
) of that storeview.
yarn
# Install dependencies (may take a while)
yarn codegen
# Converts all .graphql files to typescript files
yarn dev
# Run the app
🎉 Explore your GraphCommerce app running at http://localhost:3000
(Explore the GraphQL Playground running at http://localhost:3000/api/graphql)
No success? Consult the troubleshooting guide