To enforce Clean Architecture in TypeScript, define which parts of your code may import which other parts, then make a dependency checker fail when that policy is broken. Directory names and code-review reminders are not enforcement. In an Nx workspace, tagged project constraints can check TypeScript and JavaScript imports during lint; in other repositories, dependency-cruiser can check configurable dependency-graph rules. TypeScript project references help organize builds, but they are not a complete architecture rule by themselves.
Start with the dependency rule, not the tool
Clean Architecture is about the direction of dependencies, not a required folder tree. Choose layer names that describe your system and write down the permitted edges before configuring a checker. A common arrangement is domain policy at the center, application or use-case policy around it, then adapters and framework or driver details farther out. Dependencies point inward: outer implementation details can depend on inner policy, but inner policy should not import outer details.
For example, a domain model should not need to import a database client or web framework. If application policy needs persistence, put the boundary-facing interface in the policy layer that owns the requirement; let an outer adapter implement it. Wire the implementation to the interface at an outer composition point, such as the application root.
Here is one possible allowed-dependency matrix. It is a starting point, not a universal schema:
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
| Source project type | May depend on |
|---|---|
| domain | domain |
| application | application, domain |
| adapter | adapter, application, domain |
| composition/root | Any project type, where needed to wire the application |
Decide separately how tests, generated code, shared utilities, package manifests, and framework packages fit. A broad shared category can become a loophole if it allows business policy to import infrastructure through a supposedly neutral package. Keep project types few and their meanings clear, as Nx recommends in its project dependency rules.
Choose enforcement that fits your repository
| Approach | Best fit | What it checks or organizes | Important limitation |
|---|---|---|---|
Nx @nx/enforce-module-boundaries |
Nx workspaces with tagged projects | Checks TypeScript and JavaScript imports and package dependencies during lint; tag constraints express allowed project dependencies. | Its standard ESLint rule is for JS/TS projects and is oriented around imports and package dependencies. |
Nx Conformance enforce-project-boundaries |
Nx workspaces needing graph checks across project types | Checks dependencies represented in the Nx project graph using tag constraints. | Requires Nx Enterprise. |
| dependency-cruiser | Repositories needing configurable source dependency rules without Nx | Supports rules that forbid, allow, or require dependencies, with an error severity that can fail a command. |
You must configure it and validate its resolution and coverage against your repository. |
| TypeScript project references | TypeScript build projects that need logical separation and build organization | Organizes projects; tsc --build finds and builds referenced projects in dependency order. |
References alone are not a full Clean Architecture import policy. |
For an Nx workspace
Nx’s @nx/enforce-module-boundaries ESLint rule uses project tags and dependency constraints to check TypeScript and JavaScript imports. For example, you might tag projects layer:domain, layer:application, layer:adapter, and layer:composition, then configure each source tag with the target tags it may depend on. Nx documents options for constraining external imports as well, which can help stop core projects from importing frameworks or adapters. See the boundary enforcement guide, rule options, and external-import guidance; configuration details depend on the Nx version and workspace layout.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Nx also describes Conformance checks for dependencies in its project graph, including across project types, but that option requires Nx Enterprise. Its documentation labels the Oxlint integration experimental, so do not treat it as a stable substitute without checking the current status in the Nx enforcement approaches documentation.
For a non-Nx repository
Use dependency-cruiser when you need explicit rules over a source dependency graph and do not want Nx project conventions. Its rules can forbid, allow, or require dependencies; assigning a forbidden rule an error severity makes a violation fail the command. Start with the dependency-cruiser rules reference, then verify how the checker resolves your TypeScript path aliases, type-only imports, and dynamic imports. A rule only protects edges the configured checker actually sees.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
For TypeScript build boundaries
Project references are useful when you want separate TypeScript build projects and a build graph. The TypeScript project references documentation explains that tsc --build finds referenced projects and builds them in dependency order; ordinary tsc -p does not automatically build dependencies. References also involve declaration output and can affect editor and clone workflows. Use them for build organization where appropriate, alongside an import-boundary checker if you need a more expressive architecture policy.
Implement the policy in deliberate steps
- Map what exists. Draw the current dependency graph and label domain, application/use-case, adapter, and framework/driver code using the smallest useful vocabulary. Represent boundaries in the way your repository is actually organized rather than forcing a folder layout.
- Record allowed edges. Write down the permitted dependencies, including how tests, generated files, shared utilities, and package manifests are treated. Avoid wildcard permissions that erase the distinction between inner policy and outer details.
- Put interfaces on the policy side. Place boundary-facing interfaces in the layer that owns the requirement, implement them in an outer layer, and keep dependency-injection wiring at an outer edge.
- Select the checker. Use Nx lint constraints when Nx projects and tags fit your workspace; use dependency-cruiser or another import-graph checker for custom file- or path-level rules; add TypeScript references when separate build projects are useful. These approaches can complement each other, but they do not enforce identical things.
- Make the check routine. Run it locally and make it a required CI check. If the tool supports reporting existing violations, use that mode first to classify and fix them or add narrowly scoped temporary exceptions. Then make the intended policy an error and remove migration exceptions as the work is completed.
- Test for bypasses. Add an intentional forbidden import and confirm that the relevant check fails. Probe the paths that matter in your repository: deep relative imports, aliases, package exports, re-exports or barrels, type-only edges, dynamic imports, generated code, and tests. Checker behavior differs, so do not assume every path is covered.
- Keep exceptions accountable. Record an owner and reason, and an expiry where practical, next to each exception or in adjacent documentation. Review exceptions and graph changes when architecture changes.
What a green check does—and does not—prove
A successful lint or graph check proves only that the dependencies it recognizes comply with the rules you configured. TypeScript types constrain assignability; they do not define the intended source dependency graph. Likewise, checking local project edges alone may miss package dependencies or imports of external frameworks.
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
- Keep tag meanings precise; catch-all tags and broad allow rules can nullify the policy.
- Check local project dependencies and external package imports when both matter to the architecture.
- Verify aliases, re-exports, dynamic imports, type-only imports, and runtime loading paths instead of assuming tool coverage.
- Review the configured rules and exceptions as projects, packages, and build boundaries evolve.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

