Skip to content

Installation

Get Stricture running in your project in minutes.

Prerequisites

Before installing Stricture, ensure your project has:

  • Node.js 18.x or later
  • ESLint 8.x or 9.x (flat config recommended)

Optional (recommended for better path resolution):

  • TypeScript 4.5 or later with tsconfig.json

Choose Your Architecture

Stricture supports two workflows:

🎯 Use a Preset

Recommended for most projects

Get started with proven architecture patterns:

  • Hexagonal (Ports & Adapters)
  • Layered (N-tier)
  • Clean Architecture
  • Next.js / NestJS specific

Browse all presets →

🔧 Custom Architecture

For unique patterns

Define your own boundaries and rules for:

  • Company-specific patterns
  • Domain-specific constraints
  • Reusable internal presets

Create custom presets →


The fastest way to get started:

Step 1: Install Package

Terminal window
npm install -D @stricture/eslint-plugin

Step 2: Configure ESLint

Add Stricture to your existing ESLint config:

eslint.config.js
import stricture from '@stricture/eslint-plugin'
export default [
{
// Your existing ESLint config
files: ['**/*.ts', '**/*.tsx'],
plugins: { /* your other plugins */ },
rules: { /* your other rules */ }
},
stricture.configs.hexagonal() // Add Stricture
]

Step 3: Verify Installation

Run ESLint to verify Stricture is working:

Terminal window
npx eslint .

If you have architecture violations, you’ll see errors like:

src/domain/user.ts
5:1 error Import from 'infrastructure' to 'domain' is not allowed
Domain cannot depend on infrastructure
@stricture/enforce-boundaries

✅ Stricture is now enforcing your architecture!


Alternative: CLI Setup

Let Stricture set everything up automatically:

Terminal window
npx stricture init

The CLI will:

  • ✅ Detect your project framework (Next.js, NestJS, etc.)
  • ✅ Recommend appropriate presets
  • ✅ Configure ESLint automatically
  • ✅ Install required dependencies

View full CLI documentation →


Customizing Your Configuration

Need to add ignore patterns or custom rules? Pass options to the config:

eslint.config.js
import stricture from '@stricture/eslint-plugin'
export default [
stricture.configs.hexagonal({
ignorePatterns: ['**/*.test.ts', 'src/legacy/**'],
rules: [
{
id: 'no-legacy-imports',
from: { pattern: 'src/**' },
to: { pattern: 'src/legacy/**' },
allowed: false,
message: 'No new code should depend on legacy modules'
}
]
})
]

For complex configurations with many custom rules, you can use a separate config file:

eslint.config.js
import stricture from '@stricture/eslint-plugin'
export default [
{
// Your existing ESLint config
files: ['**/*.ts', '**/*.tsx'],
plugins: { /* your other plugins */ },
rules: { /* your other rules */ }
},
stricture.configs.recommended() // Reads .stricture/config.json
]
.stricture/config.json
{
"preset": "@stricture/hexagonal",
"boundaries": [ /* many boundaries */ ],
"rules": [ /* many rules */ ]
}

Learn more in the Configuration Files Guide.


IDE Integration

VS Code

ESLint violations appear inline with the ESLint extension:

  1. Install the ESLint extension
  2. Restart VS Code
  3. Architecture violations appear as red squiggly lines

WebStorm / IntelliJ

ESLint integration is built-in:

  1. Go to Settings → Languages & Frameworks → JavaScript → Code Quality Tools → ESLint
  2. Enable Automatic ESLint configuration
  3. Violations appear inline

TypeScript Path Aliases (Optional)

If your project uses TypeScript path aliases, Stricture automatically resolves them using your tsconfig.json:

tsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/domain/*": ["src/domain/*"],
"@/infrastructure/*": ["src/infrastructure/*"]
}
}
}

No additional configuration needed.


Monorepo Setup

For monorepos, configure Stricture per-package:

my-monorepo/
├── packages/
│ ├── api/
│ │ ├── eslint.config.js # stricture.configs.hexagonal()
│ │ └── package.json
│ ├── web/
│ │ ├── eslint.config.js # stricture.configs.nextjs()
│ │ └── package.json
│ └── shared/
│ └── package.json
└── package.json

Each package can use a different preset. See the Monorepos Guide for details.


Troubleshooting

ESLint not finding violations

Solution:

  1. Check ESLint config has stricture.configs.xxx()
  2. Verify @stricture/eslint-plugin is installed
  3. Run npx eslint --debug . to see detailed output

TypeScript paths not resolving

Solution:

  1. Ensure tsconfig.json is in your project root
  2. Verify baseUrl and paths are configured correctly
  3. Restart your IDE/ESLint server

For more troubleshooting help, see the Troubleshooting Guide.


Next Steps