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

用語集

This glossary provides definitions for key terms and concepts used throughout the MBC CQRS Serverless framework documentation.

Design Patterns

CQRS (Command Query Responsibility Segregation)

コマンド クエリ責任分離 (CQRS) パターンは、データの変更、つまりシステムのコマンド部分をクエリ部分から分離します。スループット、レイテンシ、一貫性などの要件が異なる場合は、CQRS パターンを使用して更新とクエリを分離できます。 CQRS パターンは、アプリケーションをコマンド側とクエリ側の 2 つの部分に分割します。コマンド側は、作成、更新、削除のリクエストを処理します。クエリ側はリードレプリカを使用してクエリ部分を実行します。

CQRSフロー

See: CQRS パターン

Event Sourcing

イベント ソーシング パターンは通常、読み取りワークロードと書き込みワークロードを分離し、パフォーマンス、スケーラビリティ、セキュリティを最適化するために CQRS パターンとともに使用されます。データは、データ ストアへの直接更新ではなく、一連のイベントとして保存されます。マイクロサービスは、イベント ストアからイベントを再生して、独自のデータ ストアの適切な状態を計算します。このパターンは、アプリケーションの現在の状態を可視化し、アプリケーションがその状態にどのように到達したかについての追加のコンテキストを提供します。コマンド データ ストアとクエリ データ ストアのスキーマが異なる場合でも、特定のイベントのデータを再現できるため、イベント ソーシング パターンは CQRS パターンと効果的に連携します。

See: イベントソーシングパターン

Optimistic Locking

A concurrency control mechanism that allows multiple transactions to proceed without locking resources. Before committing, the system checks if another transaction has modified the data. In MBC CQRS Serverless, this is implemented using version numbers - each update must include the current version, and the update fails if the version doesn't match.

Domain-Driven Design (DDD)

A software design approach that focuses on modeling software based on the business domain. Key concepts include entities, value objects, aggregates, and bounded contexts. MBC CQRS Serverless uses DDD principles to structure modules and entities.

Aggregate

A cluster of domain objects that can be treated as a single unit. An aggregate has a root entity (the aggregate root) and boundary that defines what's inside the aggregate. In MBC CQRS Serverless, each command table typically represents an aggregate.

Framework Concepts

Command

A request to change the state of the system. Commands are processed by the command side of the CQRS pattern. In MBC CQRS Serverless, commands are published using CommandService and stored in DynamoDB command tables.

Command Table

A DynamoDB table that stores the command (write) model. Contains the full history of changes with version tracking. Data flows from command tables to data tables via DynamoDB Streams.

Data Table

A DynamoDB table that stores the data (read) model. Contains the current state of entities, optimized for queries. Updated automatically when commands are processed.

Data Sync Handler

A handler that processes DynamoDB Stream events to synchronize data between tables or to external systems like RDS. Implements the IDataSyncHandler interface.

Invoke Context

The context object passed to service methods containing user information, tenant context, and request metadata. Created from the Lambda event and used for authorization and auditing.

Partition Key (PK)

The primary key component in DynamoDB that determines data distribution across partitions. In MBC CQRS Serverless, typically formatted as TYPE#tenantCode (e.g., ORDER#tenant001).

Sort Key (SK)

The secondary key component in DynamoDB that enables range queries within a partition. In MBC CQRS Serverless, typically formatted as TYPE#code for data tables or TYPE#code#vN for command tables.

Tenant

An isolated organizational unit in a multi-tenant application. Each tenant has its own data partition identified by a tenant code. Tenants share the application infrastructure but have completely isolated data.

Version

A number that tracks the revision history of an entity. Incremented on each update. Used for optimistic locking to prevent concurrent update conflicts.

AWS Services

Amazon DynamoDB

A fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. MBC CQRS Serverless uses DynamoDB as the primary data store for both command and data tables.

DynamoDB Streams

A feature that captures data modification events in DynamoDB tables. Used by MBC CQRS Serverless to trigger data synchronization between command and data tables, and to external systems.

AWS Lambda

A serverless compute service that runs code in response to events. MBC CQRS Serverless uses Lambda functions for API handlers, event processors, and background tasks.

Amazon Cognito

A service that provides user authentication, authorization, and user management. MBC CQRS Serverless uses Cognito for user authentication and JWT token validation.

AWS Step Functions

A serverless orchestration service that lets you combine Lambda functions and other AWS services. Used in MBC CQRS Serverless for long-running workflows like data imports and batch processing.

Amazon SES (Simple Email Service)

An email platform that provides an easy, cost-effective way to send and receive email. Used by MBC CQRS Serverless for notification emails.

Amazon S3 (Simple Storage Service)

Object storage service for storing and retrieving any amount of data. Used for file uploads, exports, and static asset storage.

Amazon SQS (Simple Queue Service)

A fully managed message queuing service. Used for asynchronous processing and decoupling components.

Amazon RDS (Relational Database Service)

A managed relational database service. Used in MBC CQRS Serverless for complex queries that require SQL joins and aggregations.

AWS CDK (Cloud Development Kit)

An open-source software development framework to define cloud infrastructure in code. MBC CQRS Serverless uses CDK for infrastructure provisioning.

API Gateway

A fully managed service for creating, publishing, and managing APIs. Provides the HTTP endpoints for MBC CQRS Serverless applications.

CloudWatch

A monitoring and observability service. Used for logging, metrics, and alarms in MBC CQRS Serverless applications.

Tooling & Libraries

NestJS

Nest (NestJS) は、効率的でスケーラブルな Node.js サーバー側アプリケーションを構築するためのフレームワークです。プログレッシブ JavaScript を使用し、TypeScript で構築され完全にサポートされており (それでも開発者は純粋な JavaScript でコードを作成できます)、OOP (オブジェクト指向プログラミング)、FP (関数型プログラミング)、および FRP (関数型リアクティブ プログラミング) の要素を組み合わせています。

See: NestJS Documentation

Serverless Framework

サーバーレス フレームワークは、コマンド ライン インターフェイスとオプションのダッシュボードで構成されており、他のクラウド プロバイダーのサポートを強化しながら、コードとインフラストラクチャをアマゾン ウェブ サービスに一緒にデプロイするのに役立ちます。このフレームワークは、簡素化された構文を使用する YAML ベースのエクスペリエンスであり、クラウドの専門家でなくても、複雑なインフラストラクチャ パターンを簡単に展開できます。

See: Serverless Framework Documentation

Prisma

Prisma is an ORM for Node.js and TypeScript that serves as an alternative to writing plain SQL or using other database access tools, such as Knex or Sequelize. It simplifies database access and management by providing developers with a type-safe query builder and auto-generator.

See: Prisma Documentation

class-validator

A validation library that uses decorators for defining validation rules on class properties. Used in MBC CQRS Serverless for request DTO validation.

class-transformer

A library for transforming plain objects into class instances and vice versa. Works with class-validator for type-safe request handling.

API Concepts

DTO (Data Transfer Object)

An object that carries data between processes. In MBC CQRS Serverless, DTOs define the structure of API request and response bodies, typically with validation decorators.

Entity

A domain object with a distinct identity that persists over time. In MBC CQRS Serverless, entities are TypeScript classes that define the structure of data stored in DynamoDB.

Controller

A class that handles incoming HTTP requests. In NestJS/MBC CQRS Serverless, controllers define API routes and delegate business logic to services.

Service

A class that contains business logic. In MBC CQRS Serverless, services orchestrate data operations using CommandService and DataService.

Module

A class annotated with @Module() decorator that organizes the application structure. Each feature area has its own module containing controllers, services, and providers.

Guard

A class that determines whether a request should be handled by the route handler. Used for authentication and authorization.

Pipe

A class that transforms or validates input data before it reaches the route handler. Used for validation and data transformation.

Middleware

A function called before the route handler. Can perform operations like logging, authentication, and request modification.

Data Operations

Publish (publishAsync/publishSync)

Create a new entity. publishAsync processes asynchronously via DynamoDB Streams, while publishSync processes synchronously.

Partial Update (publishPartialUpdateAsync/publishPartialUpdateSync)

Update specific fields of an existing entity without providing all fields. Requires version for optimistic locking.

Soft Delete

Mark an entity as deleted (isDeleted: true) without physically removing it from the database. Allows for data recovery and audit trails.

Hard Delete

Physically remove an entity from the database. Typically done with TTL (Time-to-Live) or explicit delete operations.

Sequence

An auto-incrementing number generator. Used to generate unique codes like order numbers. Can be rotated by day, month, or year.

Architecture Terms

Cold Start

The initial startup time of a Lambda function when it's invoked after being idle. Can affect latency for the first request.

Warm Start

Subsequent invocations of a Lambda function that reuse an existing execution environment. Faster than cold starts.

Idempotency

The property where an operation produces the same result regardless of how many times it's executed. Critical for retry logic and event handling.

Eventually Consistent

A consistency model where reads may not immediately reflect the latest write, but will eventually become consistent. Default for DynamoDB reads.

Strongly Consistent

A consistency model where reads always return the most recent write. Available for DynamoDB reads with higher latency.

TTL (Time-to-Live)

A DynamoDB feature that automatically deletes items after a specified timestamp. Used for temporary data and automatic cleanup.

GSI (Global Secondary Index)

An index with a partition key and optional sort key different from the table's primary key. Enables efficient queries on alternative access patterns.

LSI (Local Secondary Index)

An index with the same partition key as the table but a different sort key. Must be created at table creation time.

Security Terms

JWT (JSON Web Token)

A compact, URL-safe token format for securely transmitting claims. Used by Cognito for authentication tokens.

IAM (Identity and Access Management)

AWS service for managing access to AWS resources. Defines permissions for Lambda functions and other services.

RBAC (Role-Based Access Control)

An access control method where permissions are assigned to roles, and users are assigned to roles. Implemented via Cognito groups.

See Also