Skip to content

Legacymigration Module — C3/C4 Architecture

Auto-generated by c4docgen on 2026-04-27. Do not edit manually — regenerate with ./gradlew generateC4Docs.

Component and code-level architecture for the Legacymigration module. For system-wide context (C1 — System Context, C2 — Container), see docs/c4-architecture.md.


C3 — Component

Internal components of the Legacymigration module, following the flat package structure established by the sample module.

C4Component
    title Legacymigration Module — Component Diagram

    Container_Boundary(legacymigration, "Legacymigration Module") {
        Component(controllers, "Controllers", "@RestController", "REST endpoints for LegacyMigration")
        Component(services, "Services", "@Service", "Business logic, caching, event publishing")
        Component(repositories, "Repositories", "JpaRepository", "Data access interfaces")
        Component(mappers, "Mappers", "@Component", "Entity ↔ DTO conversion")
        Component(producers, "Event Producers", "@Component", "Publishes domain events to Kafka")
        Component(listeners, "Event Listeners", "@KafkaListener", "Consumes domain events from Kafka")
        Component(entities, "Entities", "@Entity", "JPA entity classes")
        ComponentDb(dtos, "DTOs", "Java Records", "Request/response data transfer objects")
        Component(constants, "Constants", "static final", "API paths, Kafka topics, cache names")
    }

    Rel(controllers, services, "Delegates to")
    Rel(controllers, mappers, "Converts via")
    Rel(services, repositories, "Persists via")
    Rel(services, mappers, "Converts via")
    Rel(services, producers, "Emits events via")
    Rel(listeners, services, "May trigger")
    Rel(repositories, entities, "Manages")

Component → Package mapping

Component Package Key classes
Controllers controllers/ LegacyMigrationController
Request DTOs controllers/dto/request/ CreateLegacyMigrationRequest, UpdateLegacyMigrationRequest, etc.
Response DTOs controllers/dto/response/ LegacyMigrationResponse, etc.
Services services/ LegacyMigrationService
Repositories repositories/
Entities models/
Mappers mappers/
Constants constants/ Constants, KafkaTopics, CacheNames

C3.1 — Entity Relationship Model

The 0 core entities and their relationships.

erDiagram

C3.2 — REST API Structure

All endpoints follow the pattern established by the sample module.

Entity Base path Operations
LegacyMigration /api/admin/legacy-migration POST, GET /{jobId}

All list endpoints support page (default: 0) and size (default: 20) query parameters, returning PagedResponse<T> from modules/shared/.


C3.3 — Event Flow

No Kafka events defined for this module.


C3.4 — Caching Strategy

No caching defined for this module.


C4 — Code Patterns

Implementation follows the conventions from the sample module.

Request flow

HTTP Request
  → Controller (validates, delegates)
    → Mapper.toEntity(request)
    → Service (business logic)
      → Repository.save(entity)
      → Mapper.toEvent(entity, CREATED)
      → EventProducer.publish(event)
      → Redis cache updated
    → Mapper.toResponse(entity)
  → HTTP Response (JSON)

Shared utilities (reuse from modules/shared/)

Class Usage
PagedResponse<T> Wrap all paginated list responses
ResourceNotFoundException Throw on entity-not-found (auto-mapped to 404 ProblemDetail)

Conventions

  • All DTOs are immutable Java records
  • Constructor injection only (no @Autowired fields)
  • OpenAPI annotations on all controllers and DTOs (@Tag, @Operation, @Schema)
  • Constants for API paths, Kafka topics, and cache names (no magic strings)
  • Integration tests with Testcontainers (real Postgres, Kafka, Redis)

Document Path
Sample module guide Sample Guide
Root PRD index docs/PRD.md
Backend system README backend/README.md