This is a Node App with Express and React. It is to be used as a starting point for a merchant facing channel app for marketplaces. This repo makes use of [Shopify CLI](https://shopify.dev/apps/tools/cli) commands to help setup your app quickly and easily.
---
- [1. Getting Started](#1-getting-started)
- [2. Overview of Code Structure](#2-overview-of-code-structure)
- [3. How to use this repo](#3-how-to-use-this-repo)
- [4. Key Tech](#4-key-tech)
- [5. License](#5-license)
---
## 1. Getting Started
**Requirements:**
- [Yarn](https://yarnpkg.com/en/)
- [Sequelize-cli](https://www.npmjs.com/package/sequelize-cli) installed on your system
- [Shopify CLI](https://github.com/Shopify/shopify-cli) installed and [configured for local development](https://shopify.dev/apps/tools/cli/getting-started#4-start-a-local-development-server) (version >= 2.16.1)
To set up for first time
**Clone this repository:**
```bash
git clone https://github.com/Shopify/shopify-marketplaces-admin-app
```
**Install dependencies:**
```bash
yarn
```
**Run migrations:**
```bash
npx sequelize-cli db:migrate
```
**Add scopes:**
Create a .env file in the root folder
Add the following scopes to .env file `unauthenticated_read_product_listings,read_product_listings`.
Your .env file should look like the following:
```bash
SCOPES=unauthenticated_read_product_listings,read_product_listings
```
**Run and install app:**
To run this in dev:
```bash
shopify app serve
```
This will walk you through a series of steps to setup the app in your development store.
To run in production:
```bash
yarn build
yarn start
```
## 2. Overview of Code Structure
Familiarize yourself with the code structure for the merchant-facing channel app, to help you add all additional features that will be required, it is a great way to get started! The file structure follows that of [Shopify CLI](https://shopify.dev/apps/tools/cli). We highly recommend familiarizing yourself with the Shopify CLI and [Channels UI](https://github.com/Shopify/channels-ui-docs). A description of the code for this app can be found on the [Marketplace Kit docs](https://shopify.dev/marketplaces/getting-started/get-started-with-shopify-marketplace-kit).
Familiarize yourself with the code structure for the merchant-facing app, to help orient you to subsequent Marketplace Kit tutorials.
Folder/file | Contains |
---|---|
app/* |
React code for the frontend, which the merchant sees in the Shopify admin |
server/index.js |
The setup for the app's Express server, the Shopify API library, and the Apollo GraphQL server |
server/custom-session-storage.js |
Custom session storage functions to store data in the database.You might need to edit this for the database that you're using |
server/handlers/* |
Helper functions for making REST and GraphQL calls to Shopify, so that you can do things like create Storefront Access Tokens. Also includes callback functions that are called when the app receives a webhook from Shopify |
server/helpers.js |
Helper and wrapper functions that call functions in the handlers folder |
webpack.config.js |
The configuration for webpack, which is the app's module bundler. You might need to edit this file depending on your needs for development and production |