Slide 19
Slide 19 text
© 2019-2025 OPTiM Corp. All rights reserved. 19
【OPTiM 文書管理】Package by Feature の実践 ディレクトリ構成
feature/
└── health // 例: ヘルスチェック機能
├── handler/
├── usecase/
├── repository/
├── entity/
├── health.go
shared/
├── usecase/
├── repository/
└── entity/
pkg/
└── ...
feature
• 各機能を管理する独立したディレクトリ
• 機能内では4層構造(handler~entity)
• 各層に実装,テスト,モックを配置
shared
• 複数機能で共有するレイヤ(handler〜entity)
• 機能に依存しつつ共通で参照する操作など
pkg
• 全体で使用する汎用的な共通パッケージ
• 機能に依存しない再利用可能なコンポーネント
Goの明示的な依存管理と構成自由度を活かし
プロジェクトに最適なディレクトリ構成を設計