🧩 2. Why This Supports Microservices Architecture

The table below maps each concept in the folder layout to its purpose within a microservices-ready structure.

Concept Purpose in This Structure
adapter/rest API Gateway entry points for synchronous communication (REST endpoints per service).
adapter/lambda Serverless handler for AWS Lambda integration — deploy each microservice as a function.
adapter/events Enables asynchronous, decoupled communication between microservices via Kafka, SNS, or SQS.
domain/event Defines domain-specific events that are published across services (e.g., UserCreatedEvent).
application/port/input Exposes application-level use cases. The REST/Lambda adapters call these.
application/port/output Abstracts infrastructure dependencies (databases, event buses).
adapter/persistence Implements database access (JPA, DynamoDB, etc.) for this microservice only.
infrastructure/ Houses cross-cutting concerns — tracing, metrics, exception handling.
template.yaml Defines how the microservice is deployed as a Lambda function via AWS SAM.

âš™ 3. Multi-Service Example (Monorepo Layout)

At the root of your repository, you can host multiple microservices:

/ldschurch-platform/
├── user-service/
│   └── (structure above)
│
├── notification-service/
│   └── (same structure, focuses on email/SMS logic)
│
├── order-service/
│   └── (handles order lifecycle, publishes OrderCreatedEvent)
│
├── shared-libs/
│   ├── domain-events/
│   │   └── DomainEvent.java (shared base class)
│   ├── utils/
│   │   └── JsonMapper.java
│   └── build.gradle
│
└── build.gradle (root)
    

Each microservice: