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.

Production readyTypeScript & JavaScriptMIT

npm

npm install --save-dev archunit
architecture.test.ts
import { 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.

01

Cycle and dependency-direction rules

02

Layer, slice, Nx, and PlantUML policies

03

Cohesion, coupling, and distance metrics

04

Jest, Vitest, Jasmine, and runner-neutral APIs

05

HTML, Mermaid, D2, JSON, CSV, and DOT reports

06

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.

LanguageTypeScript
ReleasePublished package
RuntimeTypeScript & JavaScript
LicenseMIT

Where it fits

Put boundaries next to the code they protect.

Common starting points for ArchUnitTS include the following project shapes.

Frontend boundariesNode.js servicesNx monoreposClean architecture

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 ↗