# Shoplazza CLI 快速上手

> 三分钟走完 Shoplazza CLI 的安装、OAuth 店铺授权和第一条命令，再按应用或主题方向选择下一步。

3 分钟上手 Shoplazza CLI。

## 第一步：安装

```shell
npm install -g shoplazza-cli
```

其他安装方式参见 [安装 Shoplazza CLI](./install)。

## 第二步：认证

使用 Shoplazza 合作伙伴账号登录并连接到店铺：

```shell
shoplazza auth login --store-domain my-store.myshoplaza.com --domain products,orders
```

CLI 会打印一个授权 URL。在浏览器中打开并完成授权后，CLI 会将凭证加密存储到其配置目录中。

验证认证状态：

```shell
shoplazza auth status
```

## 第三步：运行第一个命令

搜索店铺中的商品：

```shell
shoplazza products +search --keyword "shirt"
```

以表格格式查看订单：

```shell
shoplazza orders +search --format table
```

通过 Schema 自省探索可用的 API 命令：

```shell
shoplazza schema products
```

## 接下来

### 应用开发者

初始化一个新的应用项目：

```shell
shoplazza app init --name "my-app"
```

然后参考 [应用开发](/zh-CN/docs/app/developer-tools/shoplazza-cli/commands/app) 教程。

### 主题开发者

基于 Nova 2023 创建新主题：

```shell
shoplazza themes init --name my-theme
```

主题命令需要 `themes` 相关作用域。如果登录时只选了其他业务域，请重新登录并保留已授权的作用域：

```shell
shoplazza auth login --store-domain my-store.myshoplaza.com --domain themes --merge-scopes
```

进入主题目录后本地预览：

```shell
cd my-theme
shoplazza themes serve
```

详见 [主题 CLI 指南](/zh-CN/docs/theme/developer-tools/shoplazza-cli/)。

### 探索命令

* [命令参考](./commands/) — 按主题分组的所有命令
* [三层命令体系](./guides/command-layers) — 了解快捷命令、API 命令和原始 API
* [输出格式](./guides/output-formats) — JSON、pretty、table 和 jq 过滤
