> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sellauth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Theme CLI

> Develop, sync, and manage SellAuth themes locally with the official CLI.

## Overview

The [SellAuth Theme CLI](https://www.npmjs.com/package/sellauth-theme-cli) is the official command-line tool for developing SellAuth themes locally. It lets you create, pull, and push themes, watch for file changes with live preview and auto-reload, and build Tailwind CSS without any extra setup.

<Card title="sellauth-com/sellauth-theme-cli" icon="github" href="https://github.com/sellauth-com/sellauth-theme-cli">
  View the source code on GitHub.
</Card>

<Note>
  New to themes? Start with the [Theme Quickstart](/developers/theme-quickstart), which walks through this whole flow end to end, then read [Theme Structure](/developers/theme-structure) to learn what the files do.
</Note>

## Installation

Requires Node.js 18+. Install the CLI globally via npm:

```bash theme={null}
npm install -g sellauth-theme-cli
```

## Authentication

Login using your SellAuth API key:

```bash theme={null}
sellauth-theme login
```

<Note>
  Your API key is available at **Dashboard → Account → [API Access](https://dash.sellauth.com/api)**. If you don't see an API key, click **Regenerate**. Your Shop ID is shown on the same page.
</Note>

## Finding Your Theme ID

<Tabs>
  <Tab title="Using the CLI (Recommended)">
    List all your shops and their theme IDs directly from the CLI:

    ```bash theme={null}
    sellauth-theme list-ids
    ```

    This prints all shops on your account, their Shop IDs, all themes within each shop, and each theme's Theme ID. It's the fastest way to retrieve both Shop IDs and Theme IDs without opening the dashboard.
  </Tab>

  <Tab title="From the Dashboard">
    Go to **Storefront → [Themes](https://dash.sellauth.com/theme)** and click on the theme name. You will be redirected to:

    ```
    https://dash.sellauth.com/theme/edit/<themeId>
    ```

    The number in the URL is your Theme ID.
  </Tab>
</Tabs>

## Multiple Shops

If your account has multiple shops, you must specify the shop on every command that interacts with a shop:

```bash theme={null}
--shop <shopId>
```

If your account has only one shop, the CLI uses it automatically.

## Commands

### Create a Theme

Create a new theme:

```bash theme={null}
sellauth-theme create --name "My Theme"
```

With an optional official template:

```bash theme={null}
sellauth-theme create --name "My Theme" --template canvas
```

Official template IDs: `canvas`, `marble`, `main`, `blue`, `pro`. See [Themes Overview](/developers/themes#official-themes) for what each one is.

| Option | Description |
| - | - |
| `--name <name>` | Theme name (required) |
| `--template <id>` | Official template ID (optional) |
| `--shop <shopId>` | Required if multiple shops exist |

The theme is created on SellAuth. Run `pull` afterwards to get the files locally.

### Pull a Theme

Download theme files locally:

```bash theme={null}
sellauth-theme pull --theme <themeId> [--shop <shopId>]
```

Files are written to `./themes/<themeId>`, relative to the directory you run the command in.

| Option | Description |
| - | - |
| `--theme <themeId>` | Theme ID (required) |
| `--shop <shopId>` | Required if multiple shops exist |

### Push a Theme

Sync your local theme to SellAuth:

```bash theme={null}
sellauth-theme push --theme <themeId> [--shop <shopId>]
```

Like `pull`, this works on `./themes/<themeId>`.

| Option | Description |
| - | - |
| `--theme <themeId>` | Theme ID (required) |
| `--shop <shopId>` | Required if multiple shops exist |

<Warning>
  `push` is a two-way sync, not an upload. Files that exist on SellAuth but not in your local folder are **deleted** on SellAuth. Always `pull` first if your local copy might be out of date.
</Warning>

### Watch Mode (Recommended for Development)

Watch your local theme and sync changes automatically:

```bash theme={null}
sellauth-theme watch --theme <themeId> [--shop <shopId>]
```

This will:

1. Generate a temporary preview token
2. Display a preview URL
3. Watch for file changes
4. Push updates automatically
5. Reload the preview page

| Option | Description |
| - | - |
| `--theme <themeId>` | Theme ID (required) |
| `--shop <shopId>` | Required if multiple shops exist |
| `--dir <directory>` | Themes directory (default: `themes`) |
| `--template <name>` | Preview template (default: `shop`) |

The preview token expires periodically. Watch mode regenerates it and prints a fresh preview URL, so use the newest URL if the old one stops working.

<Note>
  To enable auto-reload, watch mode adds a small block to `layouts/master.njk`, marked with a `__SELLAUTH_LIVE_RELOAD__` comment. It only runs inside the preview, never on your live shop, and it is only added once. If you see an unexpected change to `master.njk` in your diff, that is what it is.
</Note>

### Apply a Theme to Your Shop

Apply a theme to your shop:

```bash theme={null}
sellauth-theme apply --theme <themeId> [--shop <shopId>]
```

| Option | Description |
| - | - |
| `--theme <themeId>` | Theme ID (required) |
| `--shop <shopId>` | Required if multiple shops exist |

### List Shops and Themes

Print every shop on your account with its Shop ID, and every theme within it with its Theme ID:

```bash theme={null}
sellauth-theme list-ids
```

### Help

```bash theme={null}
sellauth-theme help
```

## Tailwind CSS Support

If your theme contains a `tailwind.config.js`, the CLI automatically:

* Builds `assets/style.css` into `assets/built.css`
* Watches the template files defined in `content`
* Pushes the built CSS automatically
* Reloads the preview

<Tip>No need to install Tailwind inside the theme. The CLI handles it for you.</Tip>

## Sync Limitations

* **Flat folders only.** The CLI syncs `templates/`, `layouts/`, `components/`, `snippets/`, `assets/`, and the theme root. Paths nested deeper than one folder, such as `assets/img/logo.png`, are skipped with a warning. Keep asset files directly in `assets/`.
* **Watch mode pushes text files only.** The extensions synced on change are `njk`, `html`, `css`, `js`, `json`, `txt`, `md`, `xml`, and `svg`. Add images, fonts, and other binaries with a full `push`, or upload them from the dashboard.
* **`pull` and `push` always use `./themes/<themeId>`.** Only `watch` accepts `--dir`.

## Next Steps

<CardGroup cols={2}>
  <Card title="Theme Structure" icon="folder-tree" href="/developers/theme-structure">
    What each folder does and which template renders which URL.
  </Card>

  <Card title="Settings and Schema" icon="sliders" href="/developers/theme-settings">
    Add configurable settings that show up in the visual editor.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.