Skip to content

Commit c6fbb0a

Browse files
authored
Merge pull request #53 from objectstack-ai/copilot/reorganize-documentation-site
2 parents ab0e51f + 17beb5e commit c6fbb0a

64 files changed

Lines changed: 1644 additions & 64 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

content/docs/concepts/enterprise-framework.cn.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ my-erp/
301301

302302
## 下一步
303303

304-
* **[SDK 参考](../specifications/sdk)**: `@objectstack/sdk` 的详细 API 文档
305-
* **[CLI 指南](../specifications/cli)**: 命令参考和使用示例
306-
* **[部署模式](../specifications/deployment)**: Docker、Kubernetes 和云部署策略
304+
* **[创造层](../creator-layer)**: 了解用于开发的 SDK 和 CLI 工具
305+
* **[治理层](../governance-layer)**: 理解 CI/CD 流水线和部署
306+
* **[执行层](../execution-layer)**: 探索 ObjectQL、ObjectOS 和 ObjectUI 引擎
307307

308308
:::tip 企业级准备
309309
ObjectStack 企业框架专为重视代码质量、版本控制和可维护性的团队而设计。它将低代码的力量带入专业开发工作流程。

content/docs/concepts/enterprise-framework.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ However, it adds a critical developer experience layer:
302302

303303
## Next Steps
304304

305-
* **[SDK Reference](../specifications/sdk)**: Detailed API documentation for `@objectstack/sdk`
306-
* **[CLI Guide](../specifications/cli)**: Command reference and usage examples
307-
* **[Deployment Patterns](../specifications/deployment)**: Docker, Kubernetes, and cloud deployment strategies
305+
* **[Creator Layer](../creator-layer)**: Learn about the SDK and CLI tools for development
306+
* **[Governance Layer](../governance-layer)**: Understand the CI/CD pipeline and deployment
307+
* **[Execution Layer](../execution-layer)**: Explore the ObjectQL, ObjectOS, and ObjectUI engines
308308

309309
:::tip Enterprise-Ready
310310
The ObjectStack Enterprise Framework is designed for teams that value code quality, version control, and maintainability. It brings the power of low-code to professional development workflows.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: 创造层
3+
description: "层级 A:ObjectStack SDK - 在 IDE 中定义世界"
4+
---
5+
6+
# 创造层:ObjectStack SDK
7+
8+
**"在 IDE 中定义世界"**
9+
10+
创造层是开发者工作的地方——编写代码、定义元数据、构建业务逻辑,而无需离开他们熟悉的 IDE 环境。这一层通过将所有配置和开发带入 TypeScript 代码,消除了对网页后台的需求。
11+
12+
## 概述
13+
14+
在 ObjectStack 企业框架中,创造层代表开发者的主要工作空间。开发者不再需要点击配置界面,而是使用:
15+
16+
* **ObjectStack CLI**: 用于快速脚手架和项目管理的命令行工具
17+
* **TypeScript SDK**: 用于定义对象、逻辑和界面的类型安全 API
18+
* **代码化元数据**: 从 Schema 到 UI 布局的一切都作为版本控制的代码存在
19+
20+
## 核心理念
21+
22+
> "没有黑盒。所有业务定义都在本地代码中,基于 TypeScript,清晰透明。"
23+
24+
这一层体现了**透明性**原则:
25+
* 所有元数据都是可读的 TypeScript 代码
26+
* 所有变更都在 Git 中跟踪
27+
* 所有业务逻辑都可以使用标准 IDE 工具进行测试和重构
28+
29+
## 开发者体验
30+
31+
### 1. 项目初始化
32+
33+
```bash
34+
ostack init my-enterprise-app
35+
cd my-enterprise-app
36+
```
37+
38+
这将生成一个标准项目结构,包含:
39+
- 预配置的 TypeScript 设置
40+
- ObjectStack SDK 依赖
41+
- 示例对象和工作流
42+
- 测试基础设施
43+
44+
### 2. 对象定义
45+
46+
使用 SDK 定义业务实体:
47+
48+
```typescript
49+
import { defineObject, Field } from '@objectstack/sdk';
50+
51+
export const Contract = defineObject({
52+
name: 'contract',
53+
label: '销售合同',
54+
fields: {
55+
title: Field.String({
56+
label: '标题',
57+
required: true
58+
}),
59+
amount: Field.Currency({
60+
label: '金额',
61+
precision: 18,
62+
scale: 2
63+
}),
64+
status: Field.Select({
65+
options: ['draft', 'signed', 'cancelled'],
66+
defaultValue: 'draft'
67+
})
68+
}
69+
});
70+
```
71+
72+
### 3. 逻辑与触发器
73+
74+
将业务逻辑编写为 TypeScript 函数:
75+
76+
```typescript
77+
export const Contract = defineObject({
78+
// ... 字段 ...
79+
80+
triggers: {
81+
beforeInsert: async ({ doc }) => {
82+
if (doc.amount < 0) {
83+
throw new Error("金额不能为负");
84+
}
85+
},
86+
87+
afterUpdate: async ({ doc, oldDoc }) => {
88+
if (doc.status === 'signed' && oldDoc.status !== 'signed') {
89+
doc.signedAt = new Date();
90+
}
91+
}
92+
}
93+
});
94+
```
95+
96+
### 4. 本地开发
97+
98+
```bash
99+
ostack dev
100+
```
101+
102+
这将启动一个热重载开发服务器,你可以:
103+
* 即时测试更改
104+
* 使用 Chrome DevTools 调试
105+
* 无需部署即可快速迭代
106+
107+
## 架构集成
108+
109+
创造层输出**代码化元数据**,流入**治理层**(CI/CD 流水线)进行编译和部署。
110+
111+
```mermaid
112+
graph LR
113+
CLI[ObjectStack CLI] --> MetaCode[代码化元数据]
114+
SDK[TypeScript SDK] --> MetaCode
115+
MetaCode --> Extract[治理层]
116+
117+
style CLI fill:#e1f5ff
118+
style SDK fill:#e1f5ff
119+
style MetaCode fill:#fff4e1
120+
```
121+
122+
## 价值主张
123+
124+
### 类型安全
125+
* VS Code 中的完整 IntelliSense 支持
126+
* 编译时错误检测
127+
* 自信地重构
128+
129+
### Git 原生工作流
130+
* 所有更改都是提交
131+
* 通过 Pull Request 进行代码审查
132+
* 回滚只需 `git revert`
133+
134+
### 无厂商锁定
135+
* 你的代码存在于你的仓库中
136+
* 无需特殊工具即可读取和修改
137+
* 可跨环境移植
138+
139+
## 此层中的工具
140+
141+
* **[SDK 参考](./sdk)**: `@objectstack/sdk` 的详细 API 文档
142+
* **[CLI 指南](./cli)**: 命令参考和使用示例
143+
144+
---
145+
146+
**下一步:** **[治理层](../governance-layer)** - 了解你的代码如何构建和部署
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
title: Creator Layer
3+
description: "Layer A: ObjectStack SDK - Define the World in Your IDE"
4+
---
5+
6+
# Creator Layer: ObjectStack SDK
7+
8+
**"Define the World in Your IDE"**
9+
10+
The Creator Layer is where developers work—writing code, defining metadata, and building business logic without leaving their familiar IDE environment. This layer eliminates the need for web-based admin consoles by bringing all configuration and development into TypeScript code.
11+
12+
## Overview
13+
14+
In the ObjectStack Enterprise Framework, the Creator Layer represents the developer's primary workspace. Instead of clicking through configuration screens, developers use:
15+
16+
* **ObjectStack CLI**: Command-line tools for rapid scaffolding and project management
17+
* **TypeScript SDK**: Type-safe APIs for defining objects, logic, and interfaces
18+
* **Metadata as Code**: Everything from schemas to UI layouts exists as version-controlled code
19+
20+
## Core Philosophy
21+
22+
> "No Black Boxes. All business definitions exist in local code, based on TypeScript, clear and transparent."
23+
24+
This layer embodies the principle of **transparency**:
25+
* All metadata is readable TypeScript code
26+
* All changes are tracked in Git
27+
* All business logic is testable and refactorable with standard IDE tools
28+
29+
## The Developer Experience
30+
31+
### 1. Project Initialization
32+
33+
```bash
34+
ostack init my-enterprise-app
35+
cd my-enterprise-app
36+
```
37+
38+
This generates a standard project structure with:
39+
- Pre-configured TypeScript setup
40+
- ObjectStack SDK dependencies
41+
- Example objects and workflows
42+
- Testing infrastructure
43+
44+
### 2. Object Definition
45+
46+
Define business entities using the SDK:
47+
48+
```typescript
49+
import { defineObject, Field } from '@objectstack/sdk';
50+
51+
export const Contract = defineObject({
52+
name: 'contract',
53+
label: 'Sales Contract',
54+
fields: {
55+
title: Field.String({
56+
label: 'Title',
57+
required: true
58+
}),
59+
amount: Field.Currency({
60+
label: 'Amount',
61+
precision: 18,
62+
scale: 2
63+
}),
64+
status: Field.Select({
65+
options: ['draft', 'signed', 'cancelled'],
66+
defaultValue: 'draft'
67+
})
68+
}
69+
});
70+
```
71+
72+
### 3. Logic & Triggers
73+
74+
Write business logic as TypeScript functions:
75+
76+
```typescript
77+
export const Contract = defineObject({
78+
// ... fields ...
79+
80+
triggers: {
81+
beforeInsert: async ({ doc }) => {
82+
if (doc.amount < 0) {
83+
throw new Error("Amount cannot be negative");
84+
}
85+
},
86+
87+
afterUpdate: async ({ doc, oldDoc }) => {
88+
if (doc.status === 'signed' && oldDoc.status !== 'signed') {
89+
doc.signedAt = new Date();
90+
}
91+
}
92+
}
93+
});
94+
```
95+
96+
### 4. Local Development
97+
98+
```bash
99+
ostack dev
100+
```
101+
102+
This starts a hot-reloading development server where you can:
103+
* Test changes instantly
104+
* Debug with Chrome DevTools
105+
* Iterate rapidly without deploying
106+
107+
## Architecture Integration
108+
109+
The Creator Layer outputs **Metadata as Code** which flows into the **Governance Layer** (CI/CD Pipeline) for compilation and deployment.
110+
111+
```mermaid
112+
graph LR
113+
CLI[ObjectStack CLI] --> MetaCode[Metadata as Code]
114+
SDK[TypeScript SDK] --> MetaCode
115+
MetaCode --> Extract[Governance Layer]
116+
117+
style CLI fill:#e1f5ff
118+
style SDK fill:#e1f5ff
119+
style MetaCode fill:#fff4e1
120+
```
121+
122+
## Value Propositions
123+
124+
### Type Safety
125+
* Full IntelliSense support in VS Code
126+
* Compile-time error detection
127+
* Refactoring with confidence
128+
129+
### Git-Native Workflow
130+
* All changes are commits
131+
* Code reviews via Pull Requests
132+
* Rollback is just `git revert`
133+
134+
### No Vendor Lock-in
135+
* Your code lives in your repository
136+
* Can be read and modified without special tools
137+
* Portable across environments
138+
139+
## Tools in This Layer
140+
141+
* **[SDK Reference](./sdk)**: Detailed API documentation for `@objectstack/sdk`
142+
* **[CLI Guide](./cli)**: Command reference and usage examples
143+
144+
---
145+
146+
**Next:** **[Governance Layer](../governance-layer)** - Learn how your code gets built and deployed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "Creator Layer",
3+
"pages": [
4+
"index",
5+
"sdk",
6+
"cli"
7+
]
8+
}

0 commit comments

Comments
 (0)