LoginSignup
1
0

More than 1 year has passed since last update.

Next.js + サーバーサイドTypeScript + 関数フレーバーでクリーンなアプリを作ったので実装意図とか書く Advent Calendar 2022
4日目株式会社mofmofに生息しているshwldです。

前日は設計方針について書きました。


プロジェクトのアーキテクチャについて書きます。

クリーンアーキテクチャのように、逆方向へは依存しないようにしています。

矢印の方向に依存する
apps, infrastructuresuse-casescore domain, interfaces

ディレクトリ構造
┣━┳ apps
┃ ┣━━ web: フロントエンド (Next.js)
┃ ┗━━ worker: バックグラウンドワーカー
┣━┳ domain
┃ ┗━━ core: ドメインロジック
┃ ┗━━ interfaces: リポジトリや外部依存のインタフェース定義
┣━┳ infrastructures: 外部システムへの依存を持つ部品
┃ ┣━━ repository: データ永続化処理 (prisma)
┃ ┣━━ worker: バックグラウンド処理 (graphile-worker)
┃ ┣━━ pubsub: リアルタイム処理 (pg-pubsub)
┃ ┗━━ mailer: メール送信処理 (mailgun)
┣━┳ packages
┃ ┗━━ 共通で利用するパッケージ
┗━┳ use-cases
  ┗━━ graphql-resolvers: GraphQLクエリの解析と実行

次回予告

明日は型で状態を表現するについて書きます。

1
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
1
0