@builder6/server 3.2.3 → 3.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +255 -0
  2. package/package.json +19 -19
package/README.md ADDED
@@ -0,0 +1,255 @@
1
+ # Builder6 Server
2
+
3
+ Builder6 主服务器应用,基于 NestJS 和 Moleculer 构建的综合性低代码平台服务端核心。
4
+
5
+ ## 简介
6
+
7
+ Builder6 Server 是一个全功能的低代码平台服务端应用,集成了多个功能模块,提供完整的后端服务支持。它采用现代化的微服务架构,结合了 NestJS 的模块化设计和 Moleculer 的微服务能力。
8
+
9
+ ## 主要功能
10
+
11
+ - **用户认证与授权**: JWT 认证、OIDC 集成
12
+ - **数据管理**: MongoDB 数据库支持、动态表格管理
13
+ - **文件管理**: 文件上传下载、存储管理
14
+ - **实时通信**: WebSocket 支持、房间协作
15
+ - **文档管理**: 在线文档编辑、OnlyOffice 集成
16
+ - **邮件服务**: 邮件发送和队列管理
17
+ - **自动化服务**: 微服务编排、Node-RED 工作流
18
+ - **API 文档**: Swagger/OpenAPI 自动生成
19
+ - **插件系统**: 动态加载和管理插件
20
+
21
+ ## 安装
22
+
23
+ ```bash
24
+ npm install @builder6/server
25
+ ```
26
+
27
+
28
+
29
+ ```bash
30
+ yarn add @builder6/server
31
+ ```
32
+
33
+ ## 快速开始
34
+
35
+ ### 启动服务
36
+
37
+ ```bash
38
+ # 开发模式
39
+ npm run start:dev
40
+
41
+ # 生产模式
42
+ npm run start:prod
43
+
44
+ # 调试模式
45
+ npm run start:debug
46
+ ```
47
+
48
+ ### 使用 CLI 启动
49
+
50
+ ```bash
51
+ yarn add @builder6/server
52
+ yarn b6 start
53
+ ```
54
+
55
+ ## 环境变量
56
+
57
+ ### 基本配置
58
+
59
+ ```bash
60
+ # 服务端口
61
+ B6_PORT=5100
62
+
63
+ # 服务地址
64
+ B6_HOST=http://127.0.0.1:5100
65
+
66
+ # MongoDB 连接
67
+ B6_MONGO_URL=mongodb://127.0.0.1:27017/steedos
68
+
69
+ # Redis 连接(用于微服务通信)
70
+ B6_CLUSTER_TRANSPORTER=redis://127.0.0.1:6379
71
+
72
+ # Redis 连接(用于缓存)
73
+ B6_CLUSTER_CACHER=redis://127.0.0.1:6379
74
+
75
+ # JWT 密钥
76
+ B6_JWT_SECRET=your-secret-key
77
+
78
+ # Session 配置
79
+ B6_SESSION_SECRET=your-session-secret
80
+ B6_SESSION_PREFIX=steedos-session:
81
+ ```
82
+
83
+ ### 插件配置
84
+
85
+ ```bash
86
+ # 启动时自动安装的软件包
87
+ B6_PLUGIN_PACKAGES=@builder6/node-red,lodash
88
+
89
+ # 使用淘宝源
90
+ B6_PLUGIN_NPMRC=registry=https://registry.npmmirror.com
91
+
92
+ # 启动时加载的 Moleculer 服务
93
+ B6_PLUGIN_SERVICES=@builder6/node-red
94
+
95
+ # 启动时加载的 NestJS 模块
96
+ B6_PLUGIN_MODULE=@builder6/node-red
97
+ ```
98
+
99
+ ## 集成模块
100
+
101
+ Builder6 Server 集成了以下核心模块:
102
+
103
+ - `@builder6/core`: 核心基础功能(包含认证模块)
104
+ - `@builder6/cli`: 命令行工具
105
+ - `@builder6/moleculer`: Moleculer 微服务框架
106
+ - `@builder6/microservices`: 微服务通信
107
+ - `@builder6/tables`: 动态表格管理
108
+ - `@builder6/files`: 文件管理
109
+ - `@builder6/rooms`: 实时协作房间
110
+ - `@builder6/email`: 邮件服务
111
+ - `@builder6/docs`: 文档管理
112
+ - `@builder6/pages`: 页面管理
113
+ - `@builder6/services`: 微服务管理
114
+ - `@builder6/steedos`: Steedos 平台集成
115
+ - `@builder6/onlyoffice`: OnlyOffice 集成
116
+ - `@builder6/sharepoint`: SharePoint 集成
117
+ - `@builder6/oidc`: OpenID Connect 客户端
118
+ - `@builder6/oidc-provider`: OpenID Connect 提供者
119
+
120
+ ## API 文档
121
+
122
+ 启动服务后,可以通过以下地址访问 Swagger API 文档:
123
+
124
+ ```
125
+ http://localhost:5100/api/v6
126
+ ```
127
+
128
+ 下载 OpenAPI JSON 文档:
129
+
130
+ ```
131
+ http://localhost:5100/api/v6-json
132
+ ```
133
+
134
+ ## 插件系统
135
+
136
+ ### 动态安装软件包
137
+
138
+ 启动时自动安装 npm 包:
139
+
140
+ ```bash
141
+ B6_PLUGIN_PACKAGES=@builder6/node-red,lodash
142
+ B6_PLUGIN_NPMRC=registry=https://registry.npmmirror.com
143
+ ```
144
+
145
+ ### 加载 Moleculer 服务
146
+
147
+ 如果包含 `package.service.js` 文件,将作为 Moleculer 服务加载:
148
+
149
+ ```bash
150
+ B6_PLUGIN_SERVICES=@builder6/node-red
151
+ ```
152
+
153
+ ### 加载 NestJS 模块
154
+
155
+ 如果包含 `dist/plugin.module.js` 文件,将作为 NestJS 模块加载:
156
+
157
+ ```bash
158
+ B6_PLUGIN_MODULE=@builder6/node-red
159
+ ```
160
+
161
+ ## 开发
162
+
163
+ ### 构建
164
+
165
+ ```bash
166
+ npm run build
167
+ ```
168
+
169
+ ### 使用 Webpack 构建
170
+
171
+ ```bash
172
+ npm run build:webpack
173
+ npm run start:webpack
174
+ ```
175
+
176
+ ### 测试
177
+
178
+ ```bash
179
+ # 单元测试
180
+ npm run test
181
+
182
+ # 测试监听模式
183
+ npm run test:watch
184
+
185
+ # 测试覆盖率
186
+ npm run test:cov
187
+
188
+ # E2E 测试
189
+ npm run test:e2e
190
+ ```
191
+
192
+ ### 代码检查
193
+
194
+ ```bash
195
+ npm run lint
196
+ ```
197
+
198
+ ### 格式化代码
199
+
200
+ ```bash
201
+ npm run format
202
+ ```
203
+
204
+ ### Moleculer REPL
205
+
206
+ ```bash
207
+ npm run moleculer:repl
208
+ ```
209
+
210
+ ## 配置服务
211
+
212
+ 系统自动识别 `B6_` 和 `STEEDOS_` 开头的环境变量,转换为 NestJS ConfigService 配置。
213
+
214
+ 例如:
215
+
216
+ ```typescript
217
+ import { ConfigService } from '@nestjs/config';
218
+
219
+ constructor(private configService: ConfigService) {
220
+ // B6_MONGO_URL 转换为 mongo.url
221
+ const mongoUrl = this.configService.get('mongo.url');
222
+
223
+ // B6_JWT_SECRET 转换为 jwt.secret
224
+ const jwtSecret = this.configService.get('jwt.secret');
225
+ }
226
+ ```
227
+
228
+ ## 架构特点
229
+
230
+ - **微服务架构**: 基于 Moleculer 的分布式微服务
231
+ - **混合通信**: 支持 HTTP、WebSocket、Redis 传输
232
+ - **模块化设计**: 清晰的模块边界,易于扩展
233
+ - **插件系统**: 动态加载和管理功能模块
234
+ - **高性能日志**: 基于 Pino 的高性能日志系统
235
+ - **Session 管理**: Redis 存储的分布式 Session
236
+ - **CORS 支持**: 灵活的跨域资源共享配置
237
+
238
+ ## 调试外网
239
+
240
+ 使用 ngrok 将本地服务暴露到外网:
241
+
242
+ ```bash
243
+ brew install ngrok
244
+ ngrok http 5100
245
+ ```
246
+
247
+ 然后配置环境变量:
248
+
249
+ ```bash
250
+ B6_HOST=https://your-ngrok-url.ngrok.io
251
+ ```
252
+
253
+ ## License
254
+
255
+ AGPL-3.0-only
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder6/server",
3
- "version": "3.2.3",
3
+ "version": "3.2.14",
4
4
  "description": "The Builder6 is a comprehensive low-code platform designed to facilitate a wide range of functionalities and integrations.",
5
5
  "author": "",
6
6
  "license": "AGPL-3.0-only",
@@ -28,23 +28,23 @@
28
28
  "test:e2e": "jest --config ./test/jest-e2e.json"
29
29
  },
30
30
  "dependencies": {
31
- "@builder6/cli": "3.2.3",
32
- "@builder6/core": "3.2.3",
33
- "@builder6/docs": "3.2.3",
34
- "@builder6/email": "3.2.3",
35
- "@builder6/files": "3.2.3",
36
- "@builder6/microservices": "3.2.3",
37
- "@builder6/moleculer": "3.2.3",
38
- "@builder6/oidc": "3.2.3",
39
- "@builder6/oidc-provider": "3.2.3",
40
- "@builder6/onlyoffice": "3.2.3",
41
- "@builder6/pages": "3.2.3",
42
- "@builder6/query-mongodb": "3.2.3",
43
- "@builder6/rooms": "3.2.3",
44
- "@builder6/services": "3.2.3",
45
- "@builder6/sharepoint": "3.2.3",
46
- "@builder6/steedos": "3.2.3",
47
- "@builder6/tables": "3.2.3",
31
+ "@builder6/cli": "3.2.13",
32
+ "@builder6/core": "3.2.14",
33
+ "@builder6/docs": "3.2.12",
34
+ "@builder6/email": "3.2.12",
35
+ "@builder6/files": "3.2.12",
36
+ "@builder6/microservices": "3.2.12",
37
+ "@builder6/moleculer": "3.2.12",
38
+ "@builder6/oidc": "3.2.12",
39
+ "@builder6/oidc-provider": "3.2.12",
40
+ "@builder6/onlyoffice": "3.2.12",
41
+ "@builder6/pages": "3.2.12",
42
+ "@builder6/query-mongodb": "3.2.12",
43
+ "@builder6/rooms": "3.2.12",
44
+ "@builder6/services": "3.2.12",
45
+ "@builder6/sharepoint": "3.2.12",
46
+ "@builder6/steedos": "3.2.12",
47
+ "@builder6/tables": "3.2.12",
48
48
  "@nestjs/common": "^11.1.9",
49
49
  "@nestjs/config": "^4.0.2",
50
50
  "@nestjs/core": "^11.1.9",
@@ -137,5 +137,5 @@
137
137
  "publishConfig": {
138
138
  "access": "public"
139
139
  },
140
- "gitHead": "544e8b41e82e41a3a7534cd30219c00d60285c63"
140
+ "gitHead": "6d6e13fed8d4b3c6de14f84dcb6287c5661ea6f6"
141
141
  }