feat: complete Phase 1 infrastructure

- erp-core: error types, shared types, event bus, ErpModule trait
- erp-server: config loading, database/Redis connections, migrations
- erp-server/migration: tenants table with SeaORM
- apps/web: Vite + React 18 + TypeScript + Ant Design 5 + TailwindCSS
- Web frontend: main layout with sidebar, header, routing
- Docker: PostgreSQL 16 + Redis 7 development environment
- All workspace crates compile successfully (cargo check passes)
This commit is contained in:
iven
2026-04-11 01:07:31 +08:00
parent eb856b1d73
commit 5901ee82f0
36 changed files with 4542 additions and 221 deletions

65
wiki/index.md Normal file
View File

@@ -0,0 +1,65 @@
# ERP 平台底座 — 知识库
## 项目画像
**模块化 SaaS ERP 底座**Rust + React 技术栈,提供身份权限/工作流/消息/配置四大基础模块,支持行业业务模块快速插接。
关键数字:
- 8 个 Rust crate4 个 placeholder1 个前端 SPA
- 1 个数据库迁移tenant 表)
- Phase 1 基础设施完成约 85%
## 模块导航树
### L1 基础层
- [[erp-core]] — 错误体系 · 事件总线 · 模块 trait · 共享类型
- [[erp-common]] — 共享工具(当前为 stub
### L2 业务层(均为 placeholder
- erp-auth — 身份与权限Phase 2
- erp-config — 系统配置Phase 3
- erp-workflow — 工作流引擎Phase 4
- erp-message — 消息中心Phase 5
### L3 组装层
- [[erp-server]] — Axum 服务入口 · 配置加载 · 数据库连接 · 迁移执行
### 基础设施
- [[database]] — SeaORM 迁移 · 多租户表结构 · 软删除模式
- [[infrastructure]] — Docker Compose · PostgreSQL 16 · Redis 7
- [[frontend]] — React SPA · Ant Design 布局 · Zustand 状态
### 横切关注点
- [[architecture]] — 架构决策记录 · 设计原则 · 技术选型理由
## 核心架构决策
**模块间如何通信?** 通过 [[erp-core]] 的 EventBus 发布/订阅 DomainEvent不直接依赖。
**多租户怎么隔离?** 共享数据库 + tenant_id 列过滤,中间件从 JWT 注入 TenantContext。详见 [[database]] 和 [[architecture]]。
**错误怎么传播?** 业务 crate 用 thiserror → AppError → Axum IntoResponse 自动转 HTTP。详见 [[erp-core]] 错误处理链。
**为什么没有路由?** Phase 1 只搭建基础设施。ModuleRegistry 已定义但未集成到 [[erp-server]]Phase 2 开始注册路由。
**版本差异怎么办?** package.json 使用 React 19 + Ant Design 6比规格文档更新以实际代码为准。
## 开发进度
| Phase | 内容 | 状态 |
|-------|------|------|
| 1 | 基础设施 | 85% — 缺 README、ModuleRegistry 集成、中间件 |
| 2 | 身份与权限 | 待开始 |
| 3 | 系统配置 | 待开始 |
| 4 | 工作流引擎 | 待开始 |
| 5 | 消息中心 | 待开始 |
| 6 | 整合与打磨 | 待开始 |
## 关键文档索引
| 文档 | 位置 |
|------|------|
| 设计规格 | `docs/superpowers/specs/2026-04-10-erp-platform-base-design.md` |
| 实施计划 | `docs/superpowers/plans/2026-04-10-erp-platform-base-plan.md` |
| 协作规则 | `CLAUDE.md` |
| 设计评审 | `plans/squishy-pondering-aho-agent-a23c7497aadc6da41.md` |