# 快速上手 (/zh/docs/getting-started)



## 你需要先装好 [#你需要先装好]

| 依赖                                    | 版本要求     | 用途               |
| ------------------------------------- | -------- | ---------------- |
| Python                                | 3.12+    | 运行开发脚本           |
| [uv](https://github.com/astral-sh/uv) | 最新       | Python 版本管理和脚本执行 |
| Docker                                | 能跑容器就行   | PostgreSQL、Redis |
| Cargo                                 | Rust 稳定版 | 编译后端             |
| npm                                   | 最新       | 前端依赖             |

uv 的安装：

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install 3.12
uv python pin 3.12
```

Windows 用户可以直接 `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"`，或者去 [GitHub Releases](https://github.com/astral-sh/uv/releases) 下安装包。

## 启动服务 [#启动服务]

1. 启动 PostgreSQL 和 Redis 容器，然后启动后端和前端：

```bash
# 1. 启动 PostgreSQL
docker run -d --name herald-postgres \
  -e POSTGRES_USER=postgres \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=herald \
  -p 5432:5432 \
  postgres:18-alpine

# 2. 启动 Redis
docker run -d --name herald-redis \
  -p 6379:6379 \
  redis:8.4-alpine

# 3. 启动后端（会自动运行迁移）
cd backend
cargo run --bin herald-app

# 4. 启动前端（另一个终端）
cd frontend
npm install
npm run dev
```

## 验证 [#验证]

后端健康检查：

```bash
curl http://localhost:8080/health
```

在浏览器打开 [http://localhost:3000](http://localhost:3000) 访问前端，Vite 提供热更新。

如果后端启动失败，先检查 PostgreSQL 和 Redis 容器是不是在跑（`docker ps`），再检查 `config.toml` 里的连接字符串。

## 下一步 [#下一步]

服务跑起来后，打开 [http://localhost:3000](http://localhost:3000) 进入前端界面。创建 realm 时指定的管理员用户具有超级管理员权限，可以邀请用户、配置权限。具体操作见[架构](/docs/architecture)了解各模块的职责。
