---
title: "Components"
description: "一个 Dex 应用由四个组件组成：你的应用、server、CLI 和 Web。应用由你编写，其余由 Dex 提供。"
canonical_url: "https://docs.superdurable.io/zh-Hans/components/"
source: "docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/components/index.mdx"
locale: "zh-Hans"
---

# Components

一个 Dex 应用由四个组件组成：你的应用、server、CLI 和 Web。应用由你编写，其余由 Dex 提供。

| 组件                                                                            | 作用                                                                                     |
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [Application](https://docs.superdurable.io/zh-Hans/components/application.md) | 你的 Worker 和 Client。Worker 承载 Flow 定义，运行 Step 和 RPC。Client 启动 Flow、调用 RPC、读取 Attribute。 |
| [Server](https://docs.superdurable.io/zh-Hans/components/server.md)           | server-zd 保存 Flow 状态，并把工作交给 Worker。                                                    |
| [CLI](https://docs.superdurable.io/zh-Hans/components/cli.md)                 | **dexcli** 在本地运行 Dex，并在 shell 中操作 Flow。                                                |
| [Web](https://docs.superdurable.io/zh-Hans/components/web.md)                 | Dex Web 是查看和操作 Flow 的运维界面。                                                             |

## 组件之间的关系

```text
Client  ──▶ server-zd ◀── Worker
Dex Web ──▶     │
dexcli  ──▶     ├──▶ object storage
                └──▶ PostgreSQL (Attribute Store sync)
```

Worker、Client、Dex Web 和 **dexcli** 都连接 server 的 API 端口。Worker 主动向 server 建立出站 stream，从不监听调用。server 把 Flow 状态保存在对象存储中。它也可以把选定的 Attribute 写入 PostgreSQL，供你自己查询，见[在 Flow 之后保留数据](https://docs.superdurable.io/zh-Hans/concepts/primitives/attribute.md#attribute-store-projection)。

## 本地和生产环境

| 组件          | 本地开发                        | 生产环境                                |
| ----------- | --------------------------- | ----------------------------------- |
| Server      | **dexcli dev** 启动 server-zd | 使用对象存储运行 **dex-server-zd serve**    |
| Web         | **dexcli dev** 启动 Dex Web   | 单独的 **dex-web** 进程，或 **dexcli web** |
| Application | 你的 Worker 进程                | 你的 Worker 服务，像其他服务一样扩缩容             |

每个组件页都链接到它的[开发者参考](https://docs.superdurable.io/zh-Hans/reference.md)，那里有配置、限制和版本细节。
