# Shopify API and app tools for JavaScript
This repository contains packages you can use to interact with Shopify's APIs.
You can use these packages to create clients for those APIs directly, or to create apps using TypeScript / JavaScript.
It is organized as a [monorepo](https://monorepo.tools/), which includes multiple packages that can be used together.
## Packages
The packages in this repository can be used to extend Shopify in different ways:
- [Shopify API and app tools for JavaScript](#shopify-api-and-app-tools-for-javascript)
- [Packages](#packages)
- [API clients](#api-clients)
- [Apps and middlewares](#apps-and-middlewares)
- [Session storage](#session-storage)
- [Developing in this repo](#developing-in-this-repo)
### [API clients](./packages/api-clients)
These packages make it easy to interact with Shopify's APIs if you have the required [access tokens](https://shopify.dev/docs/apps/auth#types-of-authentication-and-authorization-methods).
| Package | Latest version | Description |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| [`@shopify/admin-api-client`](./packages/api-clients/admin-api-client/#readme) | [](https://www.npmjs.com/package/@shopify/admin-api-client) | Client for the [GraphQL](https://shopify.dev/docs/api/admin-graphql) and [REST](https://shopify.dev/docs/api/admin-rest) Admin APIs. |
| [`@shopify/storefront-api-client`](./packages/api-clients/storefront-api-client/#readme) | [](https://www.npmjs.com/package/@shopify/storefront-api-client) | Client for the GraphQL [Storefront](https://shopify.dev/docs/api/storefront) API. |
| [`@shopify/graphql-client`](./packages/api-clients/graphql-client/#readme) | [](https://www.npmjs.com/package/@shopify/graphql-client) | Generic GraphQL API client. |
| [`@shopify/api-codegen-preset`](./packages/api-clients/api-codegen-preset/#readme) | [](https://www.npmjs.com/package/@shopify/api-codegen-preset) | [Codegen](https://the-guild.dev/graphql/codegen) preset for Shopify APIs. Automatically integrates with the clients above. |
### [Apps and middlewares](./packages/apps)
These packages make it easy to create Shopify apps with TS / JS using different tech stacks.
| Package | Latest version | Description |
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [`@shopify/shopify-api`](./packages/apps/shopify-api/#readme) | [](https://www.npmjs.com/package/@shopify/shopify-api) | Framework and runtime agnostic library for Shopify OAuth, APIs, webhooks, and more. |
| [`@shopify/shopify-app-remix`](./packages/apps/shopify-app-remix/#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-remix) | Implementation of `@shopify/shopify-api` to make it easy to create apps using Remix. |
| [`@shopify/shopify-app-express`](./packages/apps/shopify-app-express/#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-express) | Implementation of `@shopify/shopify-api` to make it easy to create apps using Express. |
### [Session storage](./packages/apps/session-storage)
These packages provide database-specific implementations to manage `@shopify/shopify-api` sessions.
| Package | Latest version | Description |
| ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [`@shopify/shopify-app-session-storage`](./packages/apps/session-storage/shopify-app-session-storage#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage) | Provides the interfaces used by the app middleware packages to write custom packages. |
| [`@shopify/shopify-app-session-storage-drizzle`](./packages/apps/session-storage/shopify-app-session-storage-drizzle#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-drizzle) | Drizzle implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-dynamodb`](./packages/apps/session-storage/shopify-app-session-storage-dynamodb#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-dynamodb) | DynamoDB implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-kv`](./packages/apps/session-storage/shopify-app-session-storage-kv#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-kv) | Cloudflare KV implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-memory`](./packages/apps/session-storage/shopify-app-session-storage-memory#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-memory) | Memory implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-mongodb`](./packages/apps/session-storage/shopify-app-session-storage-mongodb#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-mongodb) | MongoDB implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-mysql`](./packages/apps/session-storage/shopify-app-session-storage-mysql#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-mysql) | Mysql implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-postgresql`](./packages/apps/session-storage/shopify-app-session-storage-postgresql#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-postgresql) | PostgreSQL implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-prisma`](./packages/apps/session-storage/shopify-app-session-storage-prisma#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-prisma) | Prisma implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-redis`](./packages/apps/session-storage/shopify-app-session-storage-redis#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-redis) | Redis implementation of the session storage interface. |
| [`@shopify/shopify-app-session-storage-sqlite`](./packages/apps/session-storage/shopify-app-session-storage-sqlite#readme) | [](https://www.npmjs.com/package/@shopify/shopify-app-session-storage-sqlite) | SQLite implementation of the session storage interface. |
## Developing in this repo
We use `pnpm` to develop this package, and we recommend using it for development to ensure your environment is consistent with ours.
To get started, install the dependencies, and build the packages:
```bash
cd shopify-app-js
pnpm install
pnpm build
```
Once the packages are built, you'll be able to make changes. Note that if you're working on multiple packages, you'll need to build them for changes to affect other packages.
We aim to add test coverage for every change to help prevent regressions. You can run the whole suite by running this at the root:
```bash
pnpm test
```
> [!NOTE]
> Make sure to run `build` before `test` to ensure the internal dependencies are available.
If you're only working on one package, you can build and run tests individually:
```bash
cd packages/<package>
pnpm build
pnpm test
```
When you're ready to test a package in an app, you can build it, and install it with a `file:` protocol in e.g. a [Remix app](https://github.com/Shopify/shopify-app-template-remix):
```bash
cd packages/<package>
pnpm build
cd <app folder>
pnpm add "file:<path to shopify-app-js>/packages/<package>"
shopify app dev
```
To update the local package, run `pnpm build` in the package folder, and restart your app.