Cycle and dependency-direction rules
Architecture testing for TypeScript
ArchUnitTS
Make architecture executable in the same test suite as your application. ArchUnitTS understands modern TypeScript configuration, detects cycles, enforces dependency direction, measures design health, and exports reports for humans and automation.
npm
npm install --save-dev archunitimport { projectFiles } from 'archunit';
it('keeps the domain independent', async () => {
const rule = projectFiles()
.inFolder('src/domain/**')
.shouldNot()
.dependOnFiles()
.inFolder('src/infrastructure/**');
await expect(rule).toPassAsync();
});Capabilities
What ArchUnitTS brings to the test suite.
The family shares a recognizable architecture vocabulary while each implementation stays honest about its language, toolchain, and maturity.
Layer, slice, Nx, and PlantUML policies
Cohesion, coupling, and distance metrics
Jest, Vitest, Jasmine, and runner-neutral APIs
HTML, Mermaid, D2, JSON, CSV, and DOT reports
Modern tsconfig paths and project references
Current maturity
Production ready
The most mature member of the family, published on npm with a stable fluent API and broad reporting support.
Where it fits
Put boundaries next to the code they protect.
Common starting points for ArchUnitTS include the following project shapes.
More ecosystems
The same intent, expressed natively.
Explore sibling implementations and carry the architecture vocabulary across a polyglot system.
Make the first boundary executable.
Add one meaningful rule, run it with the existing tests, and grow the architecture suite as the system reveals where it needs protection.
Start with ArchUnitTS ↗
