A starter for Gatsby + Shopify + Builder.io
All the power of going headless, speed of Gatsby and, the customizability of Builder.io
Typescript + Theme-UI
gatsby-theme-shopify-manager The easiest way to build a shopify store on gatsby.
Analytics, A/B testing, product augmentation, and heatmaps out of the box.
npm install @builder.io/cli -g
using git
git clone https://github.com/BuilderIO/gatsby-builder-shopify
Signup for Builder.io, then go to your organization settings page, create a private key and copy it, then create your space and give it a name
cd gatsby-builder-shopify
builder create -k [private-key] -n [space-name] -d
This command when done it’ll print your new space’s public api key, copy it and add as the value for GATSBY_BUILDER_PUBLIC_KEY
into the .env files (.env.production
and .env.development
)
GATBY_BUILDER_PUBLIC_KEY=...
Now you have a space clone matching the spec defined in this repo, you’ll need to connect it to your shopify store.
Create a private app in your Shpoify store and generate both admin api keys and storefront API token.
Access your newly created space, by selecting it from the list of spaces in your organization, then from space settings, configure the @builder.io/plugin-shopify
with the required details: admin api key / password, store domain, please feel free to ignore the import your products/collections
step since it’s not needed for this starter.
Add your storefront api token to the .env files (.env.all
)
GATSBY_SHOPIFY_ACCESS_TOKEN=...
GATSBY_SHOP_NAME=...
yarn
yarn develop
It’ll start a dev server at http://localhost:8000
For continuous deployment from netlify <> Builder.io :
This starter demonstrates:
See:
👉Tip: want to limit page building to only your components? Try components only mode
Register a component
import { Builder } from '@builder.io/react';
class SimpleText extends React.Component {
render() {
return <h1>{this.props.text}</h1>;
}
}
Builder.registerComponent(SimpleText, {
name: 'Simple Text',
inputs: [{ name: 'text', type: 'string' }],
});
Then import it in the template entry point
import './components/simple-text';
// ...
See:
Our editor uses the preview URL you supply for live editing. Because the editor is on https
, the preview might not work correctly if your development setup uses http. To fix this, change your development set up to serve using https. Or, as a workaround, on Chrome you can allow insecure content on localhost, by toggling the insecure content
option here chrome://settings/content/siteDetails?site=http%3A%2F%2Flocalhost%3A9009
build
Build the static files into the public
folder
$ yarn build
develop
or start
Runs the clean
script and starts the gatsby develop server using the command gatsby develop
.
yarn develop
format
Formats code and docs according to our style guidelines using prettier
Contributions are always welcome, no matter how large or small.