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

@domainlang/language

v0.1.82

Published

Core language library for DomainLang - parse, validate, and query Domain-Driven Design models programmatically

Readme

@domainlang/language

npm version License

Core language library for DomainLang - a Domain-Driven Design modeling language built with Langium.

Features

  • 🔤 Parser - Full DomainLang grammar with error recovery
  • Validation - Semantic validation for DDD best practices
  • 🔗 Linking - Cross-reference resolution across files and packages
  • 🔍 Model Query SDK - Programmatic access to DDD models with fluent queries
  • 🌐 Browser Support - Works in Node.js and browser environments

Installation

npm install @domainlang/language

Quick Start

Parse and Query Models

import { loadModelFromText } from '@domainlang/language/sdk';

const { query } = await loadModelFromText(`
  Domain Sales {
    vision: "Enable seamless commerce"
  }
  
  bc OrderContext for Sales as Core by SalesTeam {
    description: "Handles order lifecycle"
  }
`);

// Query bounded contexts
const coreContexts = query.boundedContexts()
  .withRole('Core')
  .toArray();

console.log(coreContexts[0].name); // 'OrderContext'

Load from File (Node.js)

import { loadModel } from '@domainlang/language/sdk/loader-node';

const { model, query } = await loadModel('./my-model.dlang');

// Access domains
for (const domain of query.domains()) {
  console.log(`${domain.name}: ${domain.vision}`);
}

API Overview

Entry Points

| Function | Environment | Use Case | | -------- | ----------- | -------- | | loadModelFromText(text) | Browser & Node | Parse inline DSL text | | loadModel(file) | Node.js only | Load from file system | | fromDocument(doc) | LSP integration | Zero-copy from Langium document | | fromModel(model) | Advanced | Direct AST wrapping |

Query Builder

The SDK provides fluent query builders with lazy evaluation:

// Find all bounded contexts owned by a team
const teamContexts = query.boundedContexts()
  .withTeam('PaymentsTeam')
  .toArray();

// Get context maps containing specific contexts
const maps = query.contextMaps()
  .containing('OrderContext')
  .toArray();

Direct Property Access

// Direct AST properties
const desc = boundedContext.description;
const vision = domain.vision;

// SDK-augmented properties (with precedence resolution)
const role = boundedContext.effectiveRole;  // Header 'as' wins over body 'role:'
const team = boundedContext.effectiveTeam;  // Header 'by' wins over body 'team:'

DomainLang Syntax

DomainLang models Domain-Driven Design concepts:

// Define domains with vision
Domain Sales {
  vision: "Drive revenue through great customer experience"
}

// Bounded contexts with ownership
bc OrderContext for Sales as Core by SalesTeam {
  description: "Order lifecycle management"
}

bc PaymentContext for Sales as Supporting by PaymentsTeam

// Context maps showing integrations
ContextMap SalesIntegration {
  contains OrderContext, PaymentContext
  
  [OHS,PL] OrderContext -> [CF] PaymentContext
}

Package Structure

| Path | Purpose | | ---- | ------- | | src/domain-lang.langium | Grammar definition | | src/generated/ | Auto-generated AST (do not edit) | | src/validation/ | Semantic validation rules | | src/lsp/ | LSP features (hover, completion, formatting) | | src/sdk/ | Model Query SDK |

Related Packages

Documentation

Development

From the workspace root (dsl/domain-lang/):

# After editing the grammar
npm run langium:generate

# Build this package
npm run build --workspace packages/language

# Run tests
npm test --workspace packages/language

License

Apache-2.0