Although this works we recommend you use our remix-nest starter for new apps See our latest starter here: https://github.com/helloastral/Astral-App
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.
- Clone this repo
npx degit git@github.com:storetools/Shopify-App-Starter.git app-name
- Copy
.env.example
to.env
and fill in the values - Run
yarn
- Run
yarn migrate:dev
- Run
yarn dev
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
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.
Visit /tools/swagger
to see swagger. The API calls are authenticated automatically when used within the app embed
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>
Run development server using shopify CLI without having to update any URLs
yarn dev
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`);
});
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
}
- Shopify App CLI
- NestJS
- PrismaJS
- Tailwind CSS
- Postgres
- Swagger
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.
Yes
Yes
You can write tests as you would on Nest js: https://docs.nestjs.com/fundamentals/testing
Checkout our apps at storetools.io
Make sure you add in your shopify.app.xyz.toml
the following. So the server always start first for vite proxy to work properly.
web_directories = [ "server", "client" ]