Coder Social home page Coder Social logo

carstenlebek / shopify-node-app-starter Goto Github PK

View Code? Open in Web Editor NEW
173.0 8.0 29.0 815 KB

๐Ÿš€๐Ÿš€ A Shopify embedded app starter template, written in TypeScript with session storage, app context and examples for basic functionalities.

Home Page: https://typescript-next-shopify-app.vercel.app

License: MIT License

Shell 0.03% JavaScript 0.46% TypeScript 99.51%
nextjs shopify shopify-app trpc typescript shopify-app-node

shopify-node-app-starter's Introduction

๐Ÿš€๐Ÿš€ Shopify App Template | Next.js | Typescript

This is an opinionated starter template for embedded Shopify apps. The biggest opinion is, that Typescript should be used everywhere and it's the only right opinion.

This Template utilizes Middleware and Next.js APIs for OAuth, so no custom server is needed.

Found a bug? Please create an issue! โค๏ธ

Apps built with this template:

Manufactory

Want your app listed? Create a PR!

Table of Contents

  • ๐Ÿคฉ Features
  • ๐Ÿ‘€ Requirements
  • ๐Ÿค“ Getting Started
  • ๐ŸŽฃ Fetching Data
  • ๐Ÿงฐ Built with
  • โ˜•๏ธ Buy me a coffee

๐Ÿคฉ Features

  • ๐Ÿ“ TypeScript
  • โšก Next.js - React Framework for static rendering
  • โœจ Serverless Architecture
  • ๐Ÿ’ณ App Subscriptions
  • ๐Ÿ’พ Session Storage with Redis
  • ๐Ÿš‡ Ngrok for development
  • ๐Ÿช Webhook registration and persistance after server restart
  • ๐Ÿ”‘ Ready to use online and offline accesstokens simultaneously
  • ๐ŸŒ App context set up. Can be used to store data, that only needs to be fetched once, but is needed in multiple places
  • Request verification set up
  • Link component to convert <a> tags to Next Links for relative paths
  • Routepropagation set up
  • Examples for creating and displaying of app subscriptions
  • Loading screen while the app context is initializing

๐Ÿฆบ Typesafety

๐Ÿ‘€ Requirements

  • Shopify Partner Account
  • Shopify Dev Store
  • Ngrok account
  • Upstash Redis Database

๐Ÿค“ Getting Started

  • Click Use this template or this link
  • Create an App in your Shopify Partner Account
  • Fill out your .env file
    • SHOPIFY_API_KEY: The Shopify Api key of the app, you have just created
    • SHOPIFY_API_SECRET_KEY: The Shopify Api secret key of the app, you have just created
    • SCOPES: The access scopes your app needs
    • USE_OFFLINE_ACCESS_TOKEN: Set to true, if you want to use offline accesstokens
    • SHOP: Your dev stores url
    • NGROK_AUTH_TOKEN: Your Ngrok auth token
    • UPSTASH_REDIS_REST_URL: Your Upstash Redis REST url.
    • UPSTASH_REDIS_REST_TOKEN: Your Upstash Redis REST token.
  • Run pnpm install or npm install --force (There is a peer dependency issue between React 18 and Polaris, but it works.)
  • Run npm run dev
  • Your apps ngrok url will be printed to the terminal
  • Install the app to your dev store
  • After you have completed auth, you can run npm run get-schema to generate the gql schema for the admin API, if you want to use a different version than 2022-07z
  • Run npm run generate in a seperate terminal to start the GraphQL code generator

๐ŸŽฃ Fetching Data

Shopify Admin API

  1. Start the GraphQL code generator with npm run generate
  2. Create your Query/Mutation (examples in src/graphql)
  3. Use the generated react-query hook to get your data (example in src/pages/get-data.tsx and src/pages/subscriptions.tsx)

tRPC

  1. Read the tRPC docs
  2. Hook up your DB (Prisma is a great addition to tRPC)
  3. Define your tRPC router
  4. Use the trpc.useQuery() hook to access your data

๐Ÿงฐ Built with

โ˜•๏ธ Buy me a coffee

Found this repo useful? Buy me a coffee to keep me awake ๐Ÿคฉ

BuyMeACoffee

Made by Carsten Lebek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.