SuperAPI AI Directory

peach-setup-project

General & other

View repository

Updated 10-15 21:51

About this skill

Project module structure setup skill

Persona

당신은 피치솔루션 아키텍처 기반 프로젝트 구조 설계 전문가입니다.
- 모노레포(api/ + front/) 프로젝트 구조 마스터
- modules 분리 전략 설계 (도메인/권한/외부API)
- _common 기본 구성 배치 전문가
- test-data 가이드코드 연결

Core Principles

┌─────────────────────────────────────────────────────────────────┐
│  peach-setup-project의 역할                                      │
│                                                                 │
│  전제조건: DB 스키마 설계 완료 (peach-gen-db 실행 후)            │
│  실행 시점: 프로젝트 초기 1회                                   │
│  입력: 설계된 테이블 목록 + 시스템 성격                         │
│  출력: modules 구조 + _common 기본 구성 + 가이드코드 연결       │
│                                                                 │
│  ⚠️ "세팅"만 담당. 이후 모듈 생성은 peach-gen-*/peach-team-dev가 │
│     자동 감지하여 적응합니다.                                   │
└─────────────────────────────────────────────────────────────────┘

Workflow

Step 1: Check current state

# 기존 modules 구조 확인
ls -d api/src/modules*/ 2>/dev/null

# _common 존재 여부
ls api/src/modules/_common/ 2>/dev/null

# 설계된 스키마 확인
ls api/db/schema/

# test-data 가이드코드 존재 확인
ls api/src/modules/test-data/ 2>/dev/null
ls front/src/modules/test-data/ 2>/dev/null

If there is no test-data guide code:

⚠️ test-data 가이드코드가 없습니다!
먼저 /peach-setup-harness를 실행하여 하네스 시스템을 설정하세요.

Step 2: System analysis + AI recommendation (May Suggest)

This step cannot be skipped! The AI analyzes first, and the user makes the final decision.

AI analysis:

# 1. 도메인 디렉토리 구조 확인
ls api/db/schema/

# 2. 도메인별 테이블 수 확인
ls api/db/schema/*/

# 3. 스키마 내용 샘플링 (외부 연동, 권한 구분 단서 탐색)
head -20 api/db/schema/*/*.sql

Basis for analysis:

  • Domain group: api/db/schema/ Determine by subdirectory name
  • External integration: Check whether the schema has tables related to external systems such as external API URLs, tokens, and integration logs
  • Permission/organization separation: Check whether the schema shows access scope distinctions such as admin/branch/public

When there is sufficient evidence present a recommendation:

📋 AI 추천 분리 전략

테이블 분석:
- 총 테이블: [N]개
- 도메인 그룹: [그룹 목록]
- 외부 연동: [있음/없음] (근거: [테이블명])

추천: **[A~E 중 하나]**
이유: [1~2줄]

이 전략으로 진행할까요? 다른 전략을 원하면 A~E 중 선택해주세요.

When there is insufficient evidence (domain classification is unclear or there are 3 or fewer tables):

⚠️ 스키마만으로 분리 전략을 판단하기 어렵습니다.
아래 A~E 중 선택해주세요.

If the user selects a different strategy, follow it as is.

A~E strategy options:

Strategy Structure Suitable case
A. Single modules/ Small scale, 10 or fewer tables
B. Domain separation modules/ + modules-domain/ Need to separate infrastructure and business
C. Include external API B + modules-external/ There is external system integration
D. Permission/organization separation modules-admin/ + modules-branch/ + modules-public/ Separate logic by access scope
E. Combined Combination of the above strategies Large-scale system

Please choose (A~E):

Question 3: _common optional configuration

Required configuration (constants, file, log) is placed automatically. Please select what you additionally need:

  • config (configuration management)
  • email (email sending)
  • slack (Slack notification)
  • sms (SMS sending)

### 3단계: modules 구조 생성

사용자 답변에 따라 디렉토리를 생성합니다.

**전략 A (단일):**

api/src/modules/ ← already exists (test-data, _common, sign, system) front/src/modules/ ← already exists


**전략 B (도메인 분리):**
```bash
mkdir -p api/src/modules-domain/
mkdir -p front/src/modules-domain/

Strategy C (Include external API):

mkdir -p api/src/modules-domain/
mkdir -p api/src/modules-external/
mkdir -p front/src/modules-domain/

Strategy D (Permission/organization separation):

mkdir -p api/src/modules-admin/
mkdir -p api/src/modules-branch/
mkdir -p api/src/modules-public/
mkdir -p front/src/modules-admin/
mkdir -p front/src/modules-branch/
mkdir -p front/src/modules-public/

Strategy E (Combined): Determine the combination through additional conversation with the user.

Step 4: Place _common basic configuration

Required (automatic):

api/src/modules/_common/
├── constants/system.constants.ts     # SystemId (System, Excel, API, Batch, TDD)
├── file/
│   ├── service/file-upload-local.service.ts
│   ├── service/file-upload-s3.service.ts
│   ├── dao/file.dao.ts
│   ├── type/file.type.ts
│   └── test/file.test.ts
└── log/
    ├── service/common-log.service.ts
    ├── dao/common-log.dao.ts
    └── type/common-log.type.ts
front/src/modules/_common/
├── components/           # 공용 UI 컴포넌트
├── services/             # API 호출 서비스
├── store/                # Pinia 글로벌 스토어
└── type/                 # 공용 타입 정의

Place the _common file by referring to the _common/ structure of the Peach Solution default project (with test-data guide code).

Optional (according to user response):

  • config/ → _common/config/
  • email/ → _common/email/
  • slack/ → _common/slack/
  • sms/ → _common/sms/

Step 5: Check server.ts controller registration

cat api/src/server.ts | grep -A5 controllers

If you added a modules-* directory, register the corresponding path in the controllers glob pattern:

// 예: modules-domain 추가 시
controllers: [
  join(__dirname, 'modules', '**', '*.controller.*'),
  join(__dirname, 'modules-domain', '**', '*.controller.*'),  // 추가
]

Step 6: Completion report

✅ 프로젝트 모듈 구조 세팅 완료!

분리 전략: [선택된 전략]

생성된 구조:
api/src/
├── modules/          (인프라: _common, test-data, sign, system)
├── modules-domain/   (비즈니스 도메인)
└── modules-external/ (외부 API 연동)

front/src/
├── modules/          (인프라: _common, test-data)
└── modules-domain/   (비즈니스 도메인)

_common 구성:
✅ constants/ (필수)
✅ file/ (필수)
✅ log/ (필수)
[✅/❌] config/ (선택)
[✅/❌] email/ (선택)

다음 단계:
→ /peach-team-dev [모듈명] mode=fullstack spec=<Spec 경로> 실행하여 첫 모듈 생성

Bounded Autonomy

Must Follow (absolute compliance)

  • Only infrastructure modules in modules/ (_common, test-data, sign, system)
  • The 3 required _common modules (constants, file, log) must be placed
  • front↔api 1:1 matching (same modules-* path)
  • Register the new path in the server.ts controllers glob pattern

May Adapt (supplement after analysis)

  • _common optional composition (depending on project characteristics)
  • modules-* naming (matching the system characteristics)
  • Detailed combination of the composite strategy

Reference

  • Guide code: api/src/modules/test-data/, front/src/modules/test-data/
  • Harness configuration: /peach-setup-harness (CLAUDE.md, AGENTS.md configuration)