Home

Awesome

clean-architecture-example

This is an example project to show what Clean Architecture would look like (in Java).

It was originally created to go together with this presentation

Table of Contents


Why Clean Architecture?

The center of your application is not the database. Nor is it one or more of the frameworks you may be using. The center of your application is the use cases of your application - Unclebob (source)

Clean architecture helps us solve, or at least mitigate, these common problems with architecture:

Clean architecture gives us all these benefits:

Of course, it comes at a cost:


Application Structure

<img src="docs/images/clean-architecture-diagram-1.png" alt="clean-architecture-diagram-1.png" width="700"> <img src="docs/images/clean-architecture-diagram-2.png" alt="clean-architecture-diagram-2.png" width="700">
Core: Entities
Core: Use Cases
Dataproviders
Entrypoints
Configuration
Examples
<img src="docs/images/example-1.png" alt="clean-architecture-diagram-1.png" width="700"> <img src="docs/images/example-2.png" alt="clean-architecture-diagram-1.png" width="700">

Testing Strategy

<img src="docs/images/testing-strategy.png" alt="testing-strategy.png" width="700">
Unit Tests
Acceptance Tests
Integration Tests
End-to-end Tests

Building and Running the application

./gradlew clean build
java -jar application/build/clean-architecture-example.jar
./gradlew bootRun
com.clean.example.configuration.Application
./gradlew tasks

Once the application is running, you can:

Importing the project in IntelliJ
Importing the project in Eclipse

The example domain

<img src="docs/images/example-domain.png" alt="example-domain.png" width="700">

This example application is a simplified version of a real production application that we develop at Sky. The domain is a telecommunication domain. It's a Network Inventory software that has the fulfill the following use cases:


Resources

Presentation
Blogs & Articles
Videos & Presentations

Contacts

For any question or feedback (really appreciated!) feel free to contact me: