init: 클린 아키텍처 백엔드

This commit is contained in:
DongHyeonka
2026-07-24 14:29:36 +09:00
parent 9eed16d097
commit 821fe00c32
971 changed files with 74769 additions and 1 deletions
@@ -0,0 +1,52 @@
# adapter:outbound:persistence-mongo — module rules
## Registered identity
- Module ID: `adapter-outbound-persistence-mongo`
- Gradle path: `:adapter:outbound:persistence-mongo`
- Focused test: `./gradlew :adapter:outbound:persistence-mongo:test --console=plain`
- Runtime baseline: Java 21; repository framework baseline: Spring Boot 4.0.0.
- Registry SSOT: `.harness/project/modules.yaml`.
Package root: `dev.caskeleton.adapter.outbound.mongo`. Driven (outbound) adapter — **lightweight
Spring Data MongoDB scaffolding**. Design rationale lives in [README.md](README.md).
## Responsibility
- Demonstrate MongoDB-backed persistence: opt-in Mongo config + a self-contained example document /
repository / adapter showing the document↔domain mapping boundary. It does **not** reimplement
idempotency / outbox / lock on Mongo (those stay JPA-only).
- Opt-in: `MongoPersistenceConfig` re-imports the Mongo auto-configuration (`@ImportAutoConfiguration`)
and enables repositories (`@EnableMongoRepositories`, scoped to this package via
`basePackageClasses`) only when `ca-skeleton.persistence-mongo.enabled=true` (default off). The
connection URI comes from Spring's standard `spring.data.mongodb.uri`.
## Allowed
- Project deps: `:application-core`, `:shared-contract` — SSOT is the
`adapter-outbound-persistence-mongo` entry in `.harness/project/modules.yaml`; `src/build.gradle`
enforces it. No
`:domain-core`, no sibling adapters.
- External: `org.springframework.boot:spring-boot-starter-data-mongodb` (version via the shared
Spring Boot BOM), `spring-boot-configuration-processor` (annotation processor). Test-only:
Testcontainers (`testcontainers`, `testcontainers-junit-jupiter`), BOM-managed.
## Forbidden
- Inbound adapters, sibling outbound adapters, `app-bootstrap`, `sample-portfolio` (ArchUnit
`OUTBOUND_ADAPTERS_*` family rules).
- Leaking the `ExampleMongoDocument` type outside the adapter — the adapter maps documents to the
module-local `ExampleRecord` at the edge.
- Inventing an `application-core` port for the example (scaffolding stays self-contained); adding
idempotency/outbox/lock on Mongo.
- Fully-qualified inline type references; more than one public top-level type per file.
## Tests
`ExampleMongoMapperTest` (pure mapping, no container), `ExampleMongoRepositoryIT` (Testcontainers
MongoDB save/find/derived-query, `disabledWithoutDocker`).
```bash
cd src
./gradlew :adapter:outbound:persistence-mongo:check
```