A Shopify embedded app starter template, written in TypeScript with session storage, app context and examples for basic functionalities.
The Shopify App Template is an opinionated starter template for creating embedded Shopify apps. It promotes the use of TypeScript and Next.js for building the app. It leverages middleware and Next.js APIs for OAuth, eliminating the need for a custom server. The template provides various features such as app subscriptions, session storage with Redis, Ngrok for development, webhook registration and persistence, and ready-to-use online and offline access tokens. It also includes examples and setups for request verification, route propagation, and loading screens while the app context is initializing. The template ensures type safety through GraphQL Code Generator for the Shopify Admin API and tRPC for end-to-end typesafe APIs.
To install the Shopify App Template, follow these steps:
.env
file with the following values:SHOPIFY_API_KEY
: The Shopify API key of the app you have created.SHOPIFY_API_SECRET_KEY
: The Shopify API secret key of the app you have created.SCOPES
: The access scopes your app needs.USE_OFFLINE_ACCESS_TOKEN
: Set to true if you want to use offline access tokens.SHOP
: Your dev store’s URL.NGROK_AUTH_TOKEN
: Your Ngrok authentication token.UPSTASH_REDIS_REST_URL
: Your Upstash Redis REST URL.UPSTASH_REDIS_REST_TOKEN
: Your Upstash Redis REST token.pnpm install
or npm install --force
to install the dependencies (Note: There might be a peer dependency issue between React 18 and Polaris, but it will still work).npm run dev
to start the development server. The app’s Ngrok URL will be printed to the terminal.npm run get-schema
to generate the GraphQL schema for the admin API if you want to use a different version than 2022-07z
.npm run generate
to start the GraphQL code generator.The Shopify App Template is a powerful starter template for building embedded Shopify apps with TypeScript and Next.js. It offers a variety of features including app subscriptions, session storage with Redis, Ngrok for local development, and webhook registration. The template ensures type safety through GraphQL Code Generator and tRPC. By following the provided installation guide, developers can quickly set up and start building their Shopify apps with ease.