Analysis updated 2026-07-03
Write a test that fails if any controller class directly calls a repository, enforcing a strict service-layer separation.
Catch circular package dependencies automatically on every CI build before they become a long-term problem.
Enforce naming conventions across a Java project, such as requiring all Spring service classes to end in 'Service'.
| tng/archunit | mojang/brigadier | oasisfeng/island | |
|---|---|---|---|
| Stars | 3,690 | 3,688 | 3,685 |
| Language | Java | Java | Java |
| Setup difficulty | easy | easy | hard |
| Complexity | 2/5 | 2/5 | 4/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Just add ArchUnit as a test dependency in Maven or Gradle, no external infra or API keys needed.
ArchUnit is a Java library that lets you write automated tests for your code's architecture. In software projects, architecture refers to rules about how code is organized: which parts of the codebase are allowed to talk to each other, how layers are separated, whether there are circular dependencies, and so on. Without a tool like this, those rules typically live only in documentation or team memory and violations accumulate silently over time. ArchUnit lets you express the rules as regular unit tests that run in your existing test suite. The library works by scanning your compiled Java bytecode, loading all the classes into an in-memory structure, and then checking them against rules you define in Java code. The rules are written using a fluent API that reads roughly like English: you state that certain classes should only depend on certain other classes, that packages should follow a specific layering pattern, or that there should be no cyclic dependencies between a given set of packages. If any class violates a rule, the test fails and reports exactly which violation occurred. Adding ArchUnit to a project takes two steps: add it as a test dependency via Maven or Gradle, then write a test class with one or more rule checks. The library integrates with standard Java test frameworks like JUnit, so no special tooling is required beyond what most Java projects already have. Common use cases include enforcing a layered architecture (controllers only call services, services only call repositories, repositories only touch the database), preventing circular package dependencies, and ensuring naming conventions are followed across a codebase. The library is free, open-source, and published under the Apache License 2.0.
ArchUnit is a Java library that lets you write automated tests to enforce architecture rules in your codebase, catching violations like illegal dependencies or circular imports as part of your normal test suite.
Mainly Java. The stack also includes Java, JUnit, Maven.
Apache License 2.0, use freely for any purpose, including commercial projects, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.