0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

リポジトリ構成とフォルダ構成 まとめ

0
Posted at

リポジトリ構成

複数のシステム・アプリを開発する際のリポジトリ構成まとめ

モノレポ(Monorepo)

複数アプリ・パッケージを1つのリポジトリで管理。

repo/
├─ apps/
│  ├─ web/
│  ├─ api/
│  └─ admin/
├─ packages/
│  ├─ ui/
│  ├─ shared/
│  └─ config/

メリット

  • 共通コード共有が楽
  • 一括CI可能
  • 型共有しやすい
  • バージョン整合性が高い

デメリット

  • CIが重くなりやすい
  • 権限管理しづらい
  • Git履歴が巨大化

向いてる

  • フルスタック
  • microservices群
  • frontend + backend統合

マルチレポ(Multi Repo)

サービスごとに別リポジトリ。

frontend-repo
backend-repo
admin-repo
infra-repo

メリット

  • 独立性高い
  • CI分離できる
  • 権限分離しやすい

デメリット

  • 共通化が面倒
  • 型共有しづらい
  • 横断変更が大変

向いてる

  • 大企業
  • 完全分離組織
  • 異なる技術スタック

フォルダ構成

システム・アプリのフォルダ構成まとめ

レイヤードアーキテクチャ(Layered Architecture)

責務ごとに分割。

src/
├─ components/
├─ pages/
├─ hooks/
├─ services/
├─ repositories/
├─ lib/
├─ utils/
├─ types/
└─ styles/
フォルダ名 責務
components UI部品
pages / routes 画面・シーン
hooks 状態・ロジック
services API通信・データ処理・ビジネスロジック
stores グローバル状態
controllers HTTP受け取り
repositories DBアクセス

Feature-Based Architecture

機能単位で分割。

src/
├─ features/
│  ├─ auth/
│  │  ├─ components/
│  │  ├─ hooks/
│  │  ├─ services/
│  │  ├─ store/
│  │  └─ types/
│  └─ post/
├─ shared/
└─ app/

ドメイン駆動設計(DDD)

ドメイン中心設計。

src/
├─ domain/
├─ application/
├─ infrastructure/
├─ presentation/
└─ shared/

クリーンアーキテクチャ(Clean Architecture)

依存方向を厳密化。

src/
├─ entities/
├─ usecases/
├─ interfaceAdapters/
├─ frameworks/
└─ shared/

Vertical Slice Architecture

機能 + ユースケース単位。

src/
├─ features/
│  ├─ auth/
│  │  ├─ login/
│  │  │  ├─ page.tsx
│  │  │  ├─ api.ts
│  │  │  ├─ hooks.ts
│  │  │  └─ schema.ts

MVC

古典構成。

src/
├─ models/
├─ views/
└─ controllers/
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?