Coder Social home page Coder Social logo

minhtanpham / shopify-app-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from helloastral/shopify-app-starter

0.0 0.0 0.0 132 KB

The Fast-Track to Flawless Shopify Apps ✨

Home Page: https://storetools.io

JavaScript 8.36% TypeScript 89.47% CSS 0.19% HTML 1.98%

shopify-app-starter's Introduction

App Starter By Storetools 🔮

The Fast-Track to Flawless Shopify Apps ✨

Shopify App Starter

This is the template we use at Storetools to build our Shopify apps.

This is a fork of App Starter Nest we use but now using the @shopify/shopify-app-express package.

Getting Started

  1. Clone this repo
npx degit [email protected]:storetools/Shopify-App-Starter.git app-name
  1. Copy .env.example to .env and fill in the values
  2. Run yarn
  3. Run yarn migrate:dev
  4. Run yarn dev

Notes

Install packages

This is a yarn workspace so when you want to install a package run this:

# Client
yarn workspace client add package-name
# Or
cd client
yarn add package-name

# Server
yarn workspace server add package-name
# Or
cd server
yarn add package-name

Deploying

Checkout both nixpacks.toml and Dockerfile

  • nixpacks.toml: You can deploy it to Railway.app directly
  • Dockerfile: Deploy to any host using Docker. Eg: Render, Heroku, etc

Look at the Dockerfile for the commands to run. You'll need to set the environment variables in your deployment environment.

Features

1. Swagger

Visit /tools/swagger to see swagger. The API calls are authenticated automatically when used within the app embed

image

2. Tailwind

Tailwind CSS works out of the box

<h1
  className="text-5xl font-extrabold text-transparent bg-clip-text bg-gradient-to-br from-pink-300 to-red-600 mb-5"
>
  Products
</h1>

3. Shopify CLI

Run development server using shopify CLI without having to update any URLs

yarn dev

4. useApi hook

Use the useApi hook to fetch data which sends authenticated requests to the nest js BE

const api = useApi();

const { data } = useQuery(["products"], () => {
  return api.get(`/products`);
});

5. @ShopSession() and @ShopClient() Nest Decorators

Use the @ShopSession() to fetch the session from the the request Use ShopClient(type) client to get a rest or a graphql client in the controller

@Get()
async fetchProducts(@ShopSession() session) {
  const products = await this.productService.fetchProducts(session);
  return products?.data || [];
}

@Get()
async fetchProducts(@ShopClient('gql') gqlClient) {
  // use client to fetch
}

Software Used

  • Shopify App CLI
  • NestJS
  • PrismaJS
  • Tailwind CSS
  • Postgres
  • Swagger

FAQ

Can I build Shopify Extensions?

Yes, Just generate the extension using the Shopify CLI like how you would with the other templates. It will live inside an extensions folder created by shopify. Dev server will work out of the box.

Does HMR work on development server?

Yes

Typescript?

Yes

Tests?

You can write tests as you would on Nest js: https://docs.nestjs.com/fundamentals/testing

Checkout our apps at storetools.io

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.