Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/takeshape/takeshape-starter-shopify-nextjs

A Shopify storefront built with TakeShape and Next.js
https://github.com/takeshape/takeshape-starter-shopify-nextjs

Last synced: 1 day ago
JSON representation

A Shopify storefront built with TakeShape and Next.js

Awesome Lists containing this project

README

        

[![TakeShape](https://img.shields.io/badge/cms-takeshape-brightgreen.svg?logoWidth=14&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAABG2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIi8+CiA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo8P3hwYWNrZXQgZW5kPSJyIj8+Gkqr6gAAAYFpQ0NQc1JHQiBJRUM2MTk2Ni0yLjEAACiRdZHPK0RRFMc/BtEYzZRZKNRLw8qIURMbZSSUpDHKr83MMz/U/Hi99yTZKtspSmz8WvAXsFXWShEpWVhZExum5zyjZpI5t3PP537vPad7zwVHJK1mjJoeyGRNPTwaUmbn5pW6Z5y04cFLS1Q1tKGpqQkq2scdVXa88du1Kp/71xqW4oYKVfXCg6qmm8JjwhOrpmbztrBXTUWXhE+Fu3S5oPCtrceK/GJzsshfNuuR8DA4PMJKsoxjZaym9IywvBxfJr2i/t7Hfokrnp2Zltgu3opBmFFCKIwzwjBBehmQOYifAN2yokJ+z0/+JDnJVWXWWENnmSQpTLpEXZHqcYkJ0eMy0qzZ/f/bVyPRFyhWd4Wg9smy3jqgbgsKecv6PLSswhFUP8JFtpSfO4D+d9HzJc23D+4NOLssabEdON+E5gctqkd/pGpxRyIBryfQOAdN1+BcKPbsd5/je4isy1ddwe4edMp59+I3T6Zn2yrilxMAAAAJcEhZcwAACxMAAAsTAQCanBgAAAJVSURBVGiB7dm/b9NAGMbx70uBMnRhQyA6VMzsiBWJFQYWdthYEP9CN2aG8FdApQpYEBM7A0JCLDCwMVAJIUA8HeIrruPE97O2gx8pSi6SL+/Hd7F9NkyZMuW/jaTLku72XUeRVLhPmude3/VkTQOntUIuwa0HsgM3bqQnLjvSJD3I1Vkjb8zsnWtIugPsuGbtvf55E9it2vfN7GlyFZ57NDTPJJ2JqGUr+0gWwO1JOhtZSxOYjDzdaD8Hfif09xV4ZGa/JF0CrgMb1e9s1F719g8zm63ocyaJ6Ona2FvnozpZ7HNb/geUL7Xt2kYwbSRzAwNxIcA4ZE5gBC4UGI7MBYzExQCDkKdiQU0c8Jp/57nSmfkik4E94Fy8kEnAHnEuncho4ABwLiuRUcAB4VyWIoOBA8S5tCKDgAPGuSwgvYEjwLkcQ3oBR4RzOUI2VxMLkXSRceFcZpL++ozgN+Bj6WoK5AB43wk0s5/ALeBl8ZLy5QC4aWZvvf6DI0Me4SDgKDoS5DEcBJ4HB45cwEHElcxAka04iLwWHRhyKQ4SVhMDQa7EQeJ6sGdkJw4yrOh7QnrhINM9mRNGeuMgExBODBmEA4rc+D0n6UWB24bfJV2LKSgrMALpA4zDMX8+qFr7FWkPX/bN7IlDAlc8tvljZh+qbbaYT8N6wqdlPZ57OSQPowqhdQSjR64kMBrZAKbjmK/oH6d20pILkrbN7LP7QtJt4EbHdu7Badq07CPyP/BkGble4oEcL85lBXL8OJcW5PrgXGrI9cO5VMirfdcxZcqUcjkEtBb8Ina+cYEAAAAASUVORK5CYII=&longCache=true&colorB=5edeb3&colorA=5539d2&style=for-the-badge)](https://www.takeshape.io/)

# shape-shop-next — Get started with TakeShape, Shopify, and Next.js

This project shows off how connecting [Shopify](https://shopify.com) with [TakeShape](https://www.takeshape.io) opens up new possibilities for e-commerce on the [Jamstack](https://jamstack.org). By connecting Shopify to your TakeShape project, you can get data for your products and content from a single GraphQL API. This sample project is built using [Next.js](https://nextjs.org) and our [live demo](https://shape-shop-next.vercel.app/) is deployed to [Vercel](https://vercel.com).

To learn more and get started:

1. Explore the repo and copy it to your own GitHub account
2. Deploy this project to [TakeShape](https://app.takeshape.io/add-to-takeshape?repo=https://github.com/takeshape/patterns/tree/main/shopify-lookbook) and [Vercel](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Ftakeshape%2Ftakeshape-starter-shopify-nextjs&env=TAKESHAPE_TOKEN,TAKESHAPE_ENDPOINT&envDescription=Provide%20credentials%20for%20your%20TakeShape%20project&demo-title=Lookbook&demo-description=A%20statically-generated%20site%20using%20Next.js%2C%20showing%20off%20data%20from%20a%20TakeShape%20project%20connected%20to%20Shopify.&demo-url=https%3A%2F%2Fshape-shop-next.vercel.app%2F)
3. [Read our walkthrough](https://www.takeshape.io/articles/building-a-rich-e-commerce-experience-on-the-jamstack-with-takeshape-shopify-and-next-js/) to learn how we built this project from scratch

## Quickstart

1. First install the starter, then `cd` into it.

```console
$ npx create-next-app --example https://github.com/takeshape/takeshape-starter-shopify-nextjs --use-npm
```

_If you prefer a manual approach, [fork this template repository](https://github.com/takeshape/takeshape-starter-shopify-nextjs/generate) and create your own repo. After you `git clone` it to your local computer, run `npm install` and then continue on with these steps._

2. Next, set up your TakeShape project. Use the deploy button or the package's `setup` script.

Deploy To TakeShape

```console
$ npm run setup
```

3. In your new TakeShape project, connect to your Shopify account.

- Go to the Schema tab, then click "Connect Service".
- Provide the URL of your Shopify store, then click save. You'll be taken through an OAuth flow to authorize the TakeShape app with your Shopify account.

4. Create an API Key with `Dev` permissions in your TakeShape project.

- Go to the API tab, then find API Keys in the navigation sidebar. Select "New API Key". Copy your
new API key to a secure text document.
- Copy and save the API endpoint provided on the API Keys page. It looks like this:
`https://api.takeshape.io/project//v3/graphql`

5. Copy your storefront access token and domain

This example uses a [Shopify Private App](https://shopify.dev/docs/storefront-api/getting-started#private-app).
You'll need the private app's storefront access token and the store's domain (in the
format `your-shop-domain.myshopify.com`)

5. Back in your Next.js project, create a `.env.local` file in your project with following lines:

```inputrc
TAKESHAPE_ENDPOINT=
TAKESHAPE_TOKEN=
NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN=
NEXT_PUBLIC_SHOPIFY_DOMAIN=.myshopify.com #doesn't include https://
```

6. Finally, start your local development site at `http://localhost:3000`

```console
$ npm run dev
```

7. To deploy this project as a live site, use Vercel's deploy button or install and run the `vercel` CLI.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Ftakeshape%2Ftakeshape-starter-shopify-nextjs&env=TAKESHAPE_TOKEN,TAKESHAPE_ENDPOINT&envDescription=Provide%20credentials%20for%20your%20TakeShape%20project&demo-title=Lookbook&demo-description=A%20statically-generated%20site%20using%20Next.js%2C%20showing%20off%20data%20from%20a%20TakeShape%20project%20connected%20to%20Shopify.&demo-url=https%3A%2F%2Fshape-shop-next.vercel.app%2F)

```console
$ npm install -G vercel
```

## Add GraphQL API support

You can install a GraphQL extension for your code editor and use it with your TakeShape project's GraphQL API.

- If you're using VSCode, we recommend using [the official GraphQL extension](https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql).
- If you're using JetBrains, we recommend using [graphql-config](https://graphcool.github.io/graphql-config/).

First, install the TakeShape CLI, login, and run the `link` command in the project root:

```bash
npm i -g @takeshape/cli
takeshape login
takeshape link
```

This will download a `.graphql` file with your project's types and queries. This will power features like validation, autocomplete suggestions, and built-in definitions.

If you ever need to update your schema, you can run `takeshape schema` to download an updated version.

## Reach out

If we can make your life easier we want to hear from you at
[[email protected]](mailto:[email protected])