---
title: 源码构建步骤
description: "获取Dify源码，进行API侧和Web前端源码构建。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengai/ecosystemEnable/dify/kunpengdify_16_0005.html
sourcePath: /source/zh/kunpengai/ecosystemEnable/dify/kunpengdify_16_0005.html
indexId: 956e457b9f9a50f16248433481ba7b6634d59325c6db89844765c5a0c286272366
---
# 源码构建步骤

获取Dify源码，进行API侧和Web前端源码构建。

1. 获取Dify源码。
  1 git clone --branch 1.13.3 --depth 1 https://github.com/langgenius/dify.git

2. 检查API和Web版本要求（该步骤用于确认API侧不需要构建）。
  1 2 3 4 5 6 7 8 9 10 cd dify python3 - <<'PY' import tomllib api = tomllib.load(open("api/pyproject.toml", "rb")) print("api_name=" + api["project"]["name"]) print("api_version=" + api["project"]["version"]) print("api_requires_python=" + api["project"]["requires-python"]) print("api_package=" + str(api.get("tool", {}).get("uv", {}).get("package"))) PY

  预期包含以下内容： 1 2 3 4 api_name=dify-api api_version=1.13.3 api_requires_python=>=3.11,<3.13 api_package=False api_package=False表示API侧不需要构建。API的可运行内容是“api/”源码目录、已安装的Python依赖和运行时配置。

3. Web前端源码构建。
  1 2 3 cd web pnpm install --frozen-lockfile pnpm build

  该步骤会从源码生成Next.js构建产物，构建产物示例如下，构建产物说明如表1所示。 1 2 3 4 .next/BUILD_ID .next/routes-manifest.json .next/required-server-files.json public/manifest.json

**表1 Web构建产物说明**

| 产物 | 说明 |
| --- | --- |
| .next/BUILD\_ID | 当前Web构建的唯一标识。 |
| .next/routes\-manifest.json | Next.js路由构建结果。 |
| .next/required\-server\-files.json | Web服务启动所需文件清单。 |
| public/manifest.json | 前端静态资源清单。 |
