- Monorepo: NestJS API (Fastify) + React web (antd/ProComponents) + shared packages - PostgreSQL/Prisma (unified resources, relations graph, audit, events, jobs) - Auth/RBAC/workspace isolation, credential vault (AES-256-GCM) - Servers/SSH, Docker discovery & lifecycle, Job Center - Websites & deployments (git provider credential clone, env, health verification) - Domains/DNS (Cloudflare adapter), certificates (TLS probe), monitoring - Automation (cron/event/webhook HMAC + notifications), AI Gateway, MCP (29 tools) - AI chat window (LLM function-calling + rules fallback, SSE streaming, approvals) - Notes: Vditor WYSIWYG markdown editor, non-blocking autosave - Tests: 35 unit/security tests; UI audit clean (desktop+mobile, deep links)
1.2 KiB
1.2 KiB
02 — Unified Resource Model
原则
Resource Registry 必须从“通用 CRUD”升级为平台的统一索引层。
Resource 基础字段
interface Resource {
id: string
workspaceId: string
type: ResourceType
name: string
status: string
provider?: string
externalId?: string
metadata: Record<string, unknown>
createdAt: Date
updatedAt: Date
}
必须支持的类型
Server, Container, Website, Domain, Certificate, Repository, Deployment, Database, Project, Task, Note, Document, Credential, Automation, Job, Monitor。
Relation
实现有方向关系并支持 relation type,例如:
- PROJECT_HAS_REPOSITORY
- PROJECT_HAS_WEBSITE
- WEBSITE_DEPLOYED_TO_SERVER
- WEBSITE_USES_DOMAIN
- WEBSITE_HAS_DEPLOYMENT
- DEPLOYMENT_FROM_REPOSITORY
- DEPLOYMENT_TO_SERVER
- SERVER_HAS_CONTAINER
- PROJECT_HAS_TASK
- PROJECT_HAS_DOCUMENT
关键要求
- 所有资源必须 workspace scoped。
- 资源详情页必须显示 Relations。
- 支持反向关系。
- 支持按关系跳转。
- 删除资源前检查关系影响。
- 不要让 Resource Registry 替代领域模型;它负责索引/关系/统一查询,领域模块负责业务规则。