# tng/archunit-examples architecture

> Architecture diagram of the GitHub repository tng/archunit-examples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tng/archunit-examples
- Repository: https://github.com/tng/archunit-examples

## Overview

##### Main Components Identification
The system should be divided into these key components:

a) Core Testing Framework Components:
- JUnit4 Support Module
- JUnit5 Support Module
- Plain Testing Module
- Example Architecture Components (for testing)

b) Example Architecture Under Test:
- Layers Architecture
- Onion Architecture
- Shopping Application
- Cycles Examples

**[ArchUnit Examples Project]**
- Testing Framework Layer
- JUnit4 Support
- JUnit5 Support
- Plain Testing Support

- Example Architectures Layer
- Layers Architecture
- Controller Layer
- Service Layer
- Persistence Layer
- Core Layer

- Onion Architecture
- Domain Core
- Domain Services
- Application Layer
- Adapters Layer

- Shopping Application
- Product Management
- Order Processing
- Customer Management

##### Key Relationships

a) Framework Relationships:
- Test execution flow from JUnit modules to example architectures
- Rule validation paths
- Architecture violation detection flows

b) Example Architecture Relationships:
- Layer dependencies
- Component interactions
- Architectural constraint examples

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Project
    Project["ArchUnit Examples Project"]

    %% Testing Framework Layer
    subgraph Framework["Testing Framework"]
        JUnit4["JUnit4 Support"]
        JUnit5["JUnit5 Support"]
        Plain["Plain Testing Support"]
    end

    %% Example Architectures
    subgraph Examples["Example Architectures"]
        %% Layers Architecture
        subgraph Layers["Layers Architecture"]
            Controller["Controller Layer"]
            Service["Service Layer"]
            Persistence["Persistence Layer"]
            Core["Core Layer"]
        end

        %% Onion Architecture
        subgraph Onion["Onion Architecture"]
            Domain["Domain Core"]
            DomainServices["Domain Services"]
            Application["Application Layer"]
            Adapters["Adapters Layer"]
        end

        %% Shopping Application
        subgraph Shopping["Shopping Application"]
            Product["Product Management"]
            Order["Order Processing"]
            Customer["Customer Management"]
        end

        Cycles["Cycles Examples"]
    end

    %% Test Components
    subgraph Tests["Test Components"]
        JUnit4Tests["JUnit4 Tests"]
        JUnit5Tests["JUnit5 Tests"]
        PlainTests["Plain Tests"]
    end

    %% Relationships
    Project --> Framework
    Project --> Examples
    Project --> Tests

    %% Layer relationships
    Controller --> Service
    Service --> Persistence
    Service --> Core
    Persistence --> Core

    %% Onion relationships
    Adapters --> Application
    Application --> Domain
    DomainServices --> Domain

    %% Test relationships
    JUnit4Tests -.-> JUnit4
    JUnit5Tests -.-> JUnit5
    PlainTests -.-> Plain

    %% Component Mappings
    click JUnit4 "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/"
    click JUnit5 "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit5/"
    click Plain "https://github.com/TNG/ArchUnit-Examples/tree/main/example-plain/"
    
    click Controller "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/layers/controller/"
    click Service "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/layers/service/"
    click Persistence "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/layers/persistence/"
    click Core "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/layers/core/"
    
    click Domain "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/onionarchitecture/domain/"
    click Application "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/onionarchitecture/application/"
    click Adapters "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/onionarchitecture/adapter/"
    
    click Cycles "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/main/java/com/tngtech/archunit/example/cycles/"
    
    click JUnit4Tests "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit4/src/test/java/com/tngtech/archunit/exampletest/junit4/"
    click JUnit5Tests "https://github.com/TNG/ArchUnit-Examples/tree/main/example-junit5/src/test/java/com/tngtech/archunit/exampletest/junit5/"
    click PlainTests "https://github.com/TNG/ArchUnit-Examples/tree/main/example-plain/src/test/java/com/tngtech/archunit/exampletest/"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px;
    classDef framework fill:#ddf,stroke:#333,stroke-width:2px;
    classDef examples fill:#dfd,stroke:#333,stroke-width:2px;
    classDef tests fill:#ffd,stroke:#333,stroke-width:2px;
    
    class JUnit4,JUnit5,Plain framework;
    class Controller,Service,Persistence,Core,Domain,DomainServices,Application,Adapters,Product,Order,Customer,Cycles examples;
    class JUnit4Tests,JUnit5Tests,PlainTests tests;
```
