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

# 快速开始

> 编译 Polymarket Account Analyzer，运行 CLI 分析与本地 HTTP API。

## 前置条件

* [Rust](https://www.rust-lang.org/tools/install) stable
* （可选）Docker + Docker Compose，用于 Postgres + 常驻 API
* （可选）PostgreSQL，用于报告缓存、raw/canonical、榜单

## 1. 进入项目目录

本 monorepo 中后端 crate 位于 **`polymarket-account-analyzer/`**：

```bash theme={null}
cd polymarket-account-analyzer
```

若单独克隆官方仓库，根目录即为 **`Polymarket-Analyzer/`**（与 `Cargo.toml` 同级）。

## 2. 编译

```bash theme={null}
cargo build --release
```

可执行文件：`target/release/polymarket-account-analyzer`。

## 3. 分析钱包（CLI）

```bash theme={null}
# 打印到终端
cargo run --release -- analyze 0x你的钱包地址

# 写入 JSON
cargo run --release -- analyze 0x你的钱包地址 --out report.json

# 跳过 Postgres 报告缓存
cargo run --release -- analyze 0x你的钱包地址 --no-cache
```

使用配置文件时，**必须**显式传入 `--config`（程序不会自动读取当前目录的 `config.toml`）：

```bash theme={null}
cp config.example.toml config.toml
# 编辑后：
cargo run --release -- --config config.toml analyze 0x你的钱包地址 --out report.json
```

## 4. 启动 HTTP API

```bash theme={null}
cargo run --release -- serve --bind 127.0.0.1:3000
```

```bash theme={null}
curl -s "http://127.0.0.1:3000/analyze/0x你的钱包地址" | jq .
```

浏览器跨域访问需在配置中设置 **`cors_allowed_origins`** 或环境变量 **`PAA_CORS_ORIGINS`**。

## 5. Docker Compose（可选）

```bash theme={null}
docker compose up --build -d
curl -s "http://127.0.0.1:3000/analyze/0x你的钱包地址" | jq .
```

详细环境变量、挂载 `config.docker.toml` 与一次性 `analyze` 容器示例见仓库根目录 **[README](https://github.com/a9research/Polymarket-Analyzer/blob/main/README.md)**。

## 接下来

<CardGroup cols={2}>
  <Card title="架构说明" icon="diagram-project" href="/architecture" />

  <Card title="配置与 PAA_ 变量" icon="gear" href="/configuration" />

  <Card title="API 参考" icon="code" href="/api-reference/introduction" />
</CardGroup>
