npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@j2blasco/ts-boundaries

v0.1.3

Published

A tool to generate ESLint boundaries configuration from TypeScript boundary definitions

Readme

@j2blasco/ts-boundaries

A tool to generate ESLint boundaries configuration from TypeScript boundary definitions. This package helps you enforce architectural boundaries in your TypeScript projects by automatically generating ESLint rules based on .boundaries.ts files.

Installation

npm install --save-dev @j2blasco/ts-boundaries eslint-plugin-boundaries tsx

Usage

1. Define Boundaries

Create .boundaries.ts files in your source directory to define architectural boundaries:

// src/domain/domain.boundaries.ts
export default {
  name: 'domain',
  internal: ['domain'], // Can import from other domain modules
  external: ['@types/*'] // Can only import these external packages
};

// src/infrastructure/infrastructure.boundaries.ts  
export default {
  name: 'infrastructure',
  internal: ['infrastructure'], // Can import from other infrastructure modules
  external: ['axios', 'fs', 'path'] // Can import these external packages
};

// src/root.boundaries.ts
export default {
  name: 'root',
  internal: ['domain', 'infrastructure'], // Root can import from domain and infrastructure
  external: ['@types/*']
};

2. Generate ESLint Configuration

Add a script to your package.json:

{
  "scripts": {
    "boundaries:generate": "ts-boundaries"
  }
}

Then run:

npm run boundaries:generate

This will generate eslint.boundaries.generated.mjs in your project root.

Note: The tool automatically uses tsx to handle TypeScript .boundaries.ts files. Make sure tsx is installed as a dev dependency.

3. Include in ESLint Configuration

Import the generated configuration in your eslint.config.mjs:

import boundariesConfig from './eslint.boundaries.generated.mjs';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';

export default [
  js.configs.recommended,
  ...tseslint.configs.recommended,
  ...boundariesConfig, // Include the generated boundaries configuration
  {
    // Your other ESLint rules...
  }
];

Boundary File Format

Each .boundaries.ts file should export a default object with the following structure:

export default {
  name: string;        // Unique name for this boundary
  internal: string[];  // Array of boundary types this boundary can import from
  external: string[];  // Array of external packages this boundary can import
};

Example Project Structure

src/
├── domain/
│   ├── user/
│   │   ├── user.entity.ts
│   │   └── user.repository.ts
│   └── domain.boundaries.ts
├── infrastructure/
│   ├── database/
│   │   └── user.repository.impl.ts
│   └── infrastructure.boundaries.ts
├── application/
│   ├── services/
│   │   └── user.service.ts
│   └── application.boundaries.ts
└── root.boundaries.ts

This will enforce that:

  • Domain layer can only import from domain and specified external packages
  • Infrastructure can only import from infrastructure and its allowed externals
  • Application layer follows its defined boundaries
  • Root level can coordinate between all layers

How Other Projects Use It

Once you publish this package, other projects can use it like this:

  1. Install the package:

    npm install --save-dev @j2blasco/ts-boundaries eslint-plugin-boundaries tsx
  2. Add the script to their package.json:

    {
      "scripts": {
        "boundaries:generate": "ts-boundaries"
      }
    }
  3. Create their boundary files in src/ directory

  4. Run the generator:

    npm run boundaries:generate
  5. Include in their ESLint config:

    import boundariesConfig from './eslint.boundaries.generated.mjs';
    // ... rest of their ESLint config

License

MIT