Skip to content

package 内の layer / directory architecture を静的検査する #41

Description

@koh110

背景

package 間の dependency boundary だけでなく、各 package 内にも設計上の layer / directory rule が存在する。

例:

API

  • HTTP 非依存の domain logic は src/features/<domain>/ に置く
  • handler は request / response 変換と features の呼び出しに徹する
  • features は Hono / handler へ依存しない

Client

  • page 固有 component は page 直下 _components
  • 複数 page で共有する component は src/app/_components

これらは package boundary とは別の architecture invariant。

目的

package 内で責務が逆流したり、便利だからという理由で layer を飛び越える実装を防ぐ。

実装案

dependency-cruiser / filesystem checker / AST rule を組み合わせる。

例:

api/handlers → api/features
api/features -X→ api/handlers
api/features -X→ hono

必要に応じて lib / config / test 等の許可方向も定義する。

client component placement は filesystem と import graph を組み合わせて検査する。

Acceptance Criteria

  • API features から Hono / handlers への依存を禁止する
  • handler → features の標準方向を定義する
  • page-local component の配置規約を検査できる
  • shared client component の配置規約を検査できる
  • architecture rule の fixture がある
  • package-boundary rule と責務が重複しないよう整理する

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions