メインコンテンツまでスキップ

モジュール

MBC CQRS Serverlessフレームワークは、エンタープライズグレードのサーバーレスアプリケーションを構築するための包括的なモジュールセットを提供します。各モジュールは、CQRSとイベントソーシングパターンとの一貫性を維持しながら、特定の関心事を処理するように設計されています。

モジュール概要

コアモジュール

モジュールパッケージ説明
Commandモジュール@mbc-cqrs-serverless/coreCQRSコマンド処理、データ同期、イベントソーシング
Sequenceモジュール@mbc-cqrs-serverless/sequenceスレッドセーフな連番ID生成
Tenantモジュール@mbc-cqrs-serverless/tenantマルチテナントデータの分離と管理

機能モジュール

モジュールパッケージ説明
Taskモジュール@mbc-cqrs-serverless/taskStep Functionsによる非同期タスク実行
Masterモジュール@mbc-cqrs-serverless/masterマスターデータと設定の管理
Importモジュール@mbc-cqrs-serverless/importDistributed Mapによる大規模CSVインポート

サポートモジュール

モジュールパッケージ説明
Notificationモジュール@mbc-cqrs-serverless/coreAmazon SESによるメール通知
Settingモジュール@mbc-cqrs-serverless/ui-settingユーザーインターフェース設定のストレージ

クイックスタート

コアパッケージをインストール:

npm install @mbc-cqrs-serverless/core

アプリケーションにCommandModuleを登録:

import { CommandModule } from '@mbc-cqrs-serverless/core';

@Module({
imports: [
CommandModule.register({
tableName: 'your-table-name',
}),
],
})
export class YourModule {}

共通パターン

サービスインジェクション

すべてのサービスはNestJSプロバイダーでインジェクション可能です:

import { CommandService, DataService } from '@mbc-cqrs-serverless/core';

@Injectable()
export class YourService {
constructor(
private readonly commandService: CommandService,
private readonly dataService: DataService,
) {}
}

マルチテナントコンテキスト

ほとんどの操作はデータ分離のためにテナントコンテキストが必要です:

async createItem(tenantCode: string, data: CreateDto, invokeContext: IInvoke) {
return this.commandService.publishAsync({
pk: `${tenantCode}#ITEM`,
sk: data.id,
tenantCode,
// ... other fields
}, { invokeContext });
}

モジュールドキュメント

各モジュールの詳細ドキュメントを参照: