Skip to content

ディレクトリ構成

転職エージェント業務管理システム


プロジェクト全体構成

agent-management/
├── frontend/                 # フロントエンド (React + Vite)
├── api/                      # バックエンド (Hono + Node.js)
├── docs/                     # ドキュメント
│   ├── 要件定義書.docx
│   ├── テーブル定義書.docx
│   ├── 画面定義書.docx
│   ├── API_DESIGN.md
│   ├── INFRASTRUCTURE.md
│   └── ENVIRONMENT_VARIABLES.md
├── .github/
│   └── workflows/
│       ├── deploy-cloudflare.yml
│       └── deploy-api.yml
└── README.md

フロントエンド構成

frontend/
├── src/
│   ├── components/
│   │   ├── ui/                      # shadcn/ui コンポーネント
│   │   │   ├── button.tsx
│   │   │   ├── card.tsx
│   │   │   ├── dialog.tsx
│   │   │   ├── input.tsx
│   │   │   ├── select.tsx
│   │   │   ├── table.tsx
│   │   │   ├── badge.tsx
│   │   │   ├── tabs.tsx
│   │   │   └── ...
│   │   ├── features/                # 機能別コンポーネント
│   │   │   ├── candidates/          # 求職者関連
│   │   │   │   ├── CandidateList.tsx
│   │   │   │   ├── CandidateDetail.tsx
│   │   │   │   ├── CandidateForm.tsx
│   │   │   │   ├── CandidateFilter.tsx
│   │   │   │   └── CandidateNotes.tsx
│   │   │   ├── companies/           # 企業関連
│   │   │   │   ├── CompanyList.tsx
│   │   │   │   ├── CompanyDetail.tsx
│   │   │   │   └── CompanyForm.tsx
│   │   │   ├── applications/        # 選考関連
│   │   │   │   ├── ApplicationList.tsx
│   │   │   │   ├── ApplicationDetail.tsx
│   │   │   │   ├── ApplicationForm.tsx
│   │   │   │   ├── StatusUpdateModal.tsx
│   │   │   │   └── StatusTimeline.tsx
│   │   │   ├── dashboard/           # ダッシュボード
│   │   │   │   ├── TaskList.tsx
│   │   │   │   ├── InterviewSchedule.tsx
│   │   │   │   ├── PendingResults.tsx
│   │   │   │   └── SummaryCards.tsx
│   │   │   ├── reports/             # 集計・レポート
│   │   │   │   ├── DailyReport.tsx
│   │   │   │   ├── MonthlyReport.tsx
│   │   │   │   ├── ChannelReport.tsx
│   │   │   │   ├── AspReport.tsx
│   │   │   │   └── UserReport.tsx
│   │   │   └── masters/             # マスタ管理
│   │   │       ├── ChannelMaster.tsx
│   │   │       ├── AspMaster.tsx
│   │   │       ├── StatusMaster.tsx
│   │   │       └── UserMaster.tsx
│   │   └── layout/                  # レイアウト
│   │       ├── Header.tsx
│   │       ├── Sidebar.tsx
│   │       ├── MainLayout.tsx
│   │       └── PageTitle.tsx
│   ├── hooks/                       # カスタムフック
│   │   ├── useAuth.ts              # 認証情報取得(CF Access)
│   │   └── queries/                 # React Query フック
│   │       ├── useCandidates.ts
│   │       ├── useCompanies.ts
│   │       ├── useApplications.ts
│   │       ├── useDashboard.ts
│   │       ├── useReports.ts
│   │       └── useMasters.ts
│   ├── lib/                         # ユーティリティ
│   │   ├── api-client.ts           # Axios インスタンス
│   │   ├── utils.ts                # 共通ユーティリティ
│   │   └── constants.ts            # 定数
│   ├── pages/                       # ページコンポーネント
│   │   ├── DashboardPage.tsx
│   │   ├── CandidatesPage.tsx
│   │   ├── CandidateDetailPage.tsx
│   │   ├── CompaniesPage.tsx
│   │   ├── CompanyDetailPage.tsx
│   │   ├── ApplicationsPage.tsx
│   │   ├── ApplicationDetailPage.tsx
│   │   ├── ReportsPage.tsx
│   │   └── MastersPage.tsx
│   ├── stores/                      # Zustand ストア
│   │   ├── useFilterStore.ts       # フィルタ状態
│   │   └── useUiStore.ts           # UI状態
│   ├── types/                       # 型定義
│   │   ├── candidate.ts
│   │   ├── company.ts
│   │   ├── application.ts
│   │   ├── master.ts
│   │   └── api.ts
│   ├── App.tsx                      # ルートコンポーネント
│   ├── main.tsx                     # エントリーポイント
│   ├── router.tsx                   # React Router設定
│   └── index.css                    # グローバルCSS
├── public/
│   └── favicon.ico
├── package.json
├── vite.config.ts
├── tsconfig.json
├── tailwind.config.ts
├── postcss.config.js
├── components.json                   # shadcn/ui設定
└── .env.example

バックエンド構成(クリーンアーキテクチャ)

api/
├── src/
│   ├── domain/                      # ドメイン層(ビジネスロジックの核心)
│   │   ├── entities/               # エンティティ(ビジネスオブジェクト)
│   │   │   ├── Candidate.ts
│   │   │   ├── Company.ts
│   │   │   ├── Application.ts
│   │   │   ├── ApplicationStatusHistory.ts
│   │   │   ├── CandidateNote.ts
│   │   │   ├── PendingTask.ts
│   │   │   ├── User.ts
│   │   │   ├── Channel.ts
│   │   │   ├── Asp.ts
│   │   │   ├── CandidateStatus.ts
│   │   │   ├── SelectionStatus.ts
│   │   │   └── ProgressRank.ts
│   │   ├── repositories/           # リポジトリインターフェース
│   │   │   ├── ICandidateRepository.ts
│   │   │   ├── ICompanyRepository.ts
│   │   │   ├── IApplicationRepository.ts
│   │   │   ├── INoteRepository.ts
│   │   │   ├── ITaskRepository.ts
│   │   │   ├── IUserRepository.ts
│   │   │   └── IMasterRepository.ts
│   │   └── services/               # ドメインサービス
│   │       ├── AspPaymentCalculator.ts      # ASP出金日計算
│   │       ├── RevenueCalculator.ts         # 売上計算
│   │       └── AspApprovalJudge.ts          # ASP承認判定
│   │
│   ├── application/                 # アプリケーション層(ユースケース)
│   │   └── services/               # アプリケーションサービス
│   │       ├── CandidateService.ts
│   │       ├── CompanyService.ts
│   │       ├── ApplicationService.ts
│   │       ├── DashboardService.ts
│   │       ├── ReportService.ts
│   │       ├── MasterService.ts
│   │       └── TaskService.ts
│   │
│   ├── infrastructure/              # インフラ層(外部サービス連携)
│   │   ├── database/               # DBクライアント
│   │   │   ├── supabase.ts         # Supabaseクライアント初期化
│   │   │   └── connection.ts       # PostgreSQL直接接続
│   │   └── repositories/           # リポジトリ実装
│   │       └── supabase/
│   │           ├── CandidateRepository.ts
│   │           ├── CompanyRepository.ts
│   │           ├── ApplicationRepository.ts
│   │           ├── NoteRepository.ts
│   │           ├── TaskRepository.ts
│   │           ├── UserRepository.ts
│   │           └── MasterRepository.ts
│   │
│   ├── interfaces/                  # インターフェース層(API)
│   │   ├── middleware/             # ミドルウェア
│   │   │   ├── auth.ts             # Cloudflare Access JWT検証
│   │   │   ├── logger.ts           # ロギング
│   │   │   ├── error-handler.ts    # エラーハンドリング
│   │   │   └── validator.ts        # バリデーション
│   │   ├── routes/                 # ルーティング
│   │   │   ├── index.ts            # ルート集約
│   │   │   ├── candidates.ts
│   │   │   ├── companies.ts
│   │   │   ├── applications.ts
│   │   │   ├── dashboard.ts
│   │   │   ├── reports.ts
│   │   │   └── masters.ts
│   │   └── controllers/            # コントローラー(オプション)
│   │       ├── CandidateController.ts
│   │       ├── CompanyController.ts
│   │       └── ...
│   │
│   ├── types/                       # 型定義
│   │   ├── request.ts              # リクエスト型
│   │   ├── response.ts             # レスポンス型
│   │   └── context.ts              # Honoコンテキスト拡張
│   │
│   ├── utils/                       # ユーティリティ
│   │   ├── date.ts                 # 日付操作
│   │   └── pagination.ts           # ページネーション
│   │
│   ├── app.ts                       # Honoアプリケーション設定
│   └── index.ts                     # エントリーポイント

├── tests/                           # テスト
│   ├── domain/
│   │   └── services/
│   │       └── AspPaymentCalculator.test.ts
│   ├── application/
│   │   └── services/
│   └── integration/
│       └── api/

├── Dockerfile
├── docker-compose.yml               # ローカル開発用
├── package.json
├── tsconfig.json
└── .env.example

レイヤー間の依存関係

┌─────────────────────────────────────────────────────────────┐
│                    interfaces(API層)                        │
│   routes / middleware / controllers                          │
│                          │                                   │
│                          ▼                                   │
├─────────────────────────────────────────────────────────────┤
│                  application(ユースケース層)                 │
│   CandidateService / CompanyService / ReportService          │
│                          │                                   │
│                          ▼                                   │
├─────────────────────────────────────────────────────────────┤
│                    domain(ドメイン層)                        │
│   entities / repositories(interface) / domain services       │
│                          ▲                                   │
│                          │                                   │
├─────────────────────────────────────────────────────────────┤
│                 infrastructure(インフラ層)                   │
│   Supabase repositories / DB connection                      │
└─────────────────────────────────────────────────────────────┘

※ 依存の向きは「上から下」
※ domain層は他の層に依存しない
※ infrastructure層はdomain層のインターフェースを実装

ファイル命名規則

フロントエンド

種類命名規則
コンポーネントPascalCaseCandidateList.tsx
フックcamelCase(use接頭辞)useCandidates.ts
ユーティリティcamelCaseapi-client.ts
型定義camelCasecandidate.ts
ページPascalCase(Page接尾辞)DashboardPage.tsx

バックエンド

種類命名規則
エンティティPascalCaseCandidate.ts
リポジトリIFPascalCase(I接頭辞)ICandidateRepository.ts
リポジトリ実装PascalCaseCandidateRepository.ts
サービスPascalCase(Service接尾辞)CandidateService.ts
ルートcamelCasecandidates.ts
ミドルウェアcamelCaseauth.ts