Files
BackupX/docs-site/i18n/zh-Hans/docusaurus-plugin-content-docs/current/development/setup.md
Wu Qing bc3d03de7e 文档: 新增 Docusaurus 官网与双语文档,README 切换为英文默认 (#39)
- 新建 docs-site/ Docusaurus 项目,支持 en + zh-Hans 双语
- 从 README 迁移内容为独立文档页面:
  - Getting Started(安装、快速开始)
  - Deployment(Docker、裸机、Nginx、配置参考)
  - Features(备份类型、存储后端、SAP HANA、多节点集群、通知)
  - Reference(API、CLI)
  - Development(开发、贡献)
- 自定义 BackupX 主题色、logo、落地页组件
- 新增 .github/workflows/docs.yml,Actions 自动构建并发布到 GitHub Pages
- README.md 切换为英文,中文版挪到 README.zh-CN.md,两者均精简为导航型
- 配置站点 URL:https://awuqing.github.io/BackupX/
2026-04-17 13:19:41 +08:00

84 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
sidebar_position: 1
title: 开发环境
description: 搭建 BackupX 本地开发环境 — 后端、前端、测试。
---
# 开发环境
**环境要求:** Go ≥ 1.25Node.js ≥ 20npm。
## 克隆与依赖
```bash
git clone https://github.com/Awuqing/BackupX.git && cd BackupX
cd web && npm install && cd ..
```
## 开发服务
开两个终端分别跑后端和前端:
```bash
# 终端 1后端监听 :8340
make dev-server
# 终端 2Vite HMR监听 :5173
make dev-web
```
Vite 配置了 `/api` 代理到 `http://127.0.0.1:8340`,浏览器直接访问 `http://localhost:5173`
## 测试
```bash
make test # 运行 Go + Web 全部测试
make test-server # 仅 Go
make test-web # 仅 Vitest
```
## 生产构建
```bash
make build # server/bin/backupx + web/dist
make docker # Docker 镜像
make docker-cn # 国内镜像加速构建
```
## 技术栈
| 组件 | 技术 |
|------|------|
| **后端** | Go · Gin · GORM · SQLite · robfig/cron · rclone |
| **前端** | React 18 · TypeScript · ArcoDesign · Vite · Zustand · ECharts |
| **存储** | rclone70+ 后端)· AWS SDK v2 · Google Drive API v3 |
| **安全** | JWT · bcrypt · AES-256-GCM |
## 目录结构
```
BackupX/
├── server/ # Go 后端
│ ├── cmd/backupx/ # 入口 + 子命令agent / backint / reset-password
│ ├── internal/
│ │ ├── agent/ # Agent CLI 逻辑
│ │ ├── app/ # 装配repo → service → handler
│ │ ├── backup/ # 备份 runnerfile / mysql / postgres / sqlite / saphana
│ │ ├── backint/ # SAP HANA Backint 协议
│ │ ├── http/ # HTTP handler + router
│ │ ├── model/ # GORM 模型
│ │ ├── repository/ # 数据访问
│ │ ├── service/ # 业务逻辑
│ │ └── storage/ # 存储 providerrclone + 直接 SDK
│ └── pkg/ # 通用工具
├── web/ # React 前端Vite
│ └── src/
│ ├── components/
│ ├── pages/
│ ├── services/
│ └── types/
├── docs-site/ # 文档站Docusaurus
├── deploy/ # install.sh / systemd unit / nginx config
└── Makefile
```