Files
ocdp-go/.github/PROJECT_STRUCTURE.md
mangomqy c5e51ed069 ocdp v1
2025-11-13 02:54:06 +00:00

80 lines
2.8 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.

# Project Structure
## 📁 Directory Layout
```
ocdp-go/
├── backend/ # Go 后端
│ ├── cmd/api/ # 主程序入口
│ ├── internal/
│ │ ├── handlers/ # HTTP handlers
│ │ ├── graphql/ # GraphQL schema & resolvers
│ │ ├── models/ # 数据模型
│ │ ├── storage/ # 存储层JSON
│ │ └── auth/ # 认证
│ └── data/ # 数据存储JSON文件
└── frontend/ # React 前端
└── src/
├── app/ # 应用层
│ ├── providers/ # 全局 Provider
│ ├── routes/ # 路由配置
│ └── constants/ # 导航配置
├── features/ # 功能模块(按类别)
│ ├── configuration/ # 🔧 配置类
│ │ ├── clusters/
│ │ └── registries/
│ ├── monitoring/ # 📊 监控类
│ │ └── clusters/
│ ├── artifact/ # 📦 制品类
│ │ ├── registries/
│ │ └── instances/
│ ├── auth/
│ └── home/
├── core/ # 核心层
│ ├── api/ # API 调用
│ ├── graphql/ # GraphQL 客户端
│ ├── types/ # 类型定义
│ └── config/ # 配置
└── shared/ # 共享层
├── components/ # 通用组件
├── hooks/ # 通用 hooks
├── utils/ # 工具函数
└── services/ # 服务
```
## 🎯 Features 模块分类
### Configuration配置类
- `clusters/` - 配置 K8s 集群连接
- `registries/` - 配置 OCI 仓库连接
### Monitoring监控类
- `clusters/` - 监控集群状态
### Artifact制品类
- `registries/` - 浏览制品仓库内容
- `instances/` - 管理已部署的服务实例
## 🔄 API 架构
- **GraphQL** - 用于 CRUD 操作(集群、仓库、实例)
- **RESTful** - 用于代理和实时查询OCI、K8s 状态)
- **Unified API** - 自动根据配置切换 GraphQL/RESTful
## 🚀 实例管理术语
- **Launch** - 启动/创建服务实例
- **Modify** - 修改实例配置
- **Terminate** - 终止实例运行
## 📝 说明
- 所有功能模块按**业务类别**分类(配置、监控、制品)
- Features 模块名使用**单数**形式configuration, artifact
- URL 路径保持 RESTful 风格(`/artifact/registries`