Skip to content

langaliya-hitarth/shopify-app-template-node-react-ts

Repository files navigation

Shopify App Template for Node + React (Typescript)

This is a template is heavily inspired from shopify-app-template-node and is used for building a Shopify app using Node and React in Typescript. It contains the basics for building a Shopify app.

Benefits

The Node app template comes with the following out-of-the-box functionality:

  • OAuth: Installing the app and granting permissions
  • GraphQL Admin API: Querying or mutating Shopify admin data
  • GraphQL Admin API Types: Types are generated run-time for all the queries and mutations within server's graphql directory.
  • REST Admin API: Resource classes to interact with the API
  • Shopify-specific tooling:
    • AppBridge
    • Polaris
    • Webhooks with HMAC verification middleware
    • App Proxy with HMAC verification middleware
  • Typescript Configuration: Recommended rules for typescript are implied by default
  • Linting and Formatting: Leveraging ESLint and Prettier to enforce linting rules and formatting code on pre-commit using Husky and Lint-Staged.
  • Logging: This template leverages the popular Winston library to provide a robust logging solution. It supports logging to multiple tools and services, including:
    • Prisma
    • Rollbar
    • Console

Tech Stack

This template combines a number of third party open-source tools:

The following Shopify tools complement these third-party tools to ease app development:

Getting started

Requirements

  1. You must download and install Node.js if you don't already have it.
  2. You must create a Shopify partner account if you don’t have one.
  3. You must create a store for testing if you don't have one, either a development store or a Shopify Plus sandbox store.

Local Development

The Shopify CLI connects to an app in your Partners dashboard. It provides environment variables, runs commands in parallel, and updates application URLs for easier development.

You can develop locally using npm package manager. Run one of the following commands from the root of your app.

Using npm:

npm run dev

Open the URL generated in your console. Once you grant permission to the app, you can start development.

Deployment

Application Storage

This template uses MySQL to store session data, with Prisma as the ORM to manage database interactions efficiently.

The choice of database depends on your app's data requirements and query patterns. You can either host your database on your own server or use a SaaS provider for managed hosting.

If you'd prefer to use a different form of storage for session data, you’ll need to update the session storage configuration accordingly. For guidance, refer to the list of available SessionStorage adapter packages.

Build

Proper configuration is required to build and run the app. You can find the necessary configurations on your app's page in the Shopify Partners Dashboard.

Copy and paste your app's configurations into the .env file to ensure the app functions correctly.

Developer resources

About

A template for building Shopify apps with Node.js, React, and TypeScript

Topics

Resources

License

Stars

Watchers

Forks