nomadro/.cursor/rules/modular-design.mdc
eric 56b29205e7 Integrate four verticals into nomadro portal with shared packages and API gateway.
Mount /vip with nomadvip+payjsapi, add @nomadro/pay|pb|sdk, apps/api, /admin shell, and backup/rollback scripts under git.nomadro.cn workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-28 20:16:44 -05:00

15 lines
1.1 KiB
Plaintext
Raw Permalink 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.

---
description: 模块化设计 — 易扩展业务、解耦
alwaysApply: true
---
# 模块化与解耦
- **按业务边界拆分**:垂直能力进 `apps/<name>`,门户只做路由挂载与壳层,禁止把业务逻辑堆进根 `app/` / `components/`。
- **稳定公共面**:跨垂直复用放 `packages/*`(已有 `@nomadro/pay`、`@nomadro/pb`、`@nomadro/sdk`),经显式导出;垂直之间禁止互相深路径 import。
- **依赖方向**:`packages` ← `apps` ← 门户挂载;下层不依赖上层;共享包不依赖具体垂直页面。
- **新增业务清单**:新模块 = 独立目录 + 自有 README/env 约定 + 可选 FastAPI 路由前缀 + 门户挂载路径(如 `/xxx`)+ 必要时扩展 `scripts/integrate-apps.mjs`;不改无关垂直。
- **接口优先**:模块对外用 HTTP/OpenAPI 或清晰 TS 类型;配置与密钥走 env。
- **可替换**:支付/存储/分析经 provider 接入(见 `@nomadro/pay.resolvePayProvider`)。
- **统一编排**:跨垂直入口集中在 `/admin`,后台壳不承载垂直业务实现。