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

@api-client/domain-templates

v0.3.5

Published

A package that has the definition of the well-know API Now domains.

Downloads

859

Readme

Domain Templates

This repository contains reusable data domain templates for the Quick API platform. These templates follow Domain-Driven Design (DDD) principles and provide pre-built structures for various industry verticals.

Features

  • Vertical Organization: Templates are categorized by industry verticals (e.g., E-commerce, Healthcare, Finance).
  • Distributed Metadata: Template metadata is defined alongside the implementation, making it easy to manage.
  • Automated Registry: The template registry is automatically generated from the source files.
  • Robust Testing: Comprehensive unit tests ensure template integrity using @japa/runner.

Usage

Using Templates in Code

You can import and instantiate templates directly in your application:

import { TEMPLATES, createDomain } from '@api-client/domain-templates'

// 1. Create a domain using its ID
const ecommerceDomain = createDomain('ecommerce-platform')

// 2. Or use the specific factory function
import createEcommerceDomain from '@api-client/domain-templates/verticals/business-services/ecommerce-domain.js'
const domain = createEcommerceDomain()

console.log(domain.info.name) // "E-Commerce Platform"

Using Generated Metadata

The build process generates JSON metadata files in the src/meta directory. These files are useful for building UI catalogs or preview tools.

Example Metadata (@api-client/domain-templates/meta/ecommerce-platform.json):

{
  "id": "ecommerce-platform",
  "name": "E-Commerce Platform",
  "description": "A comprehensive e-commerce platform...",
  "category": "Business Services",
  "structure": {
    "domain": {
      "totalEntities": 11,
      "totalProperties": 73
    },
    "namespaces": [ ... ]
  }
}

You can consume these JSON files to display template details without importing the entire domain logic.

Organization by Industry Verticals

Templates are organized into the following verticals in src/verticals/:

  • Business Services: E-commerce, Financial Services, Legal Services, Hospitality
  • Healthcare & Life Sciences: Healthcare
  • Education & Training: Education
  • Real Estate & Construction: Real Estate
  • Manufacturing & Logistics: Manufacturing
  • Technology & Media: Gaming, IoT, Blog, Content Management
  • Public Sector: Non-Profit

Developing a Template

1. Create the Template File

Create a new file in the appropriate vertical directory (e.g., src/verticals/my-vertical/my-domain.ts).

2. Implement the Template

Each template file must export a meta object and a default creation function.

import { DataDomain } from '@api-client/core/modeling/DataDomain.js'
import type { CreateTemplateOptions, DomainTemplateMetadata } from '../../types.js'

// 1. Define Metadata
export const meta: DomainTemplateMetadata = {
  id: 'my-domain-platform',
  name: 'My Domain Platform',
  description: 'A comprehensive domain for...',
  version: '1.0.0',
  author: 'Your Name',
  category: 'My Vertical',
  subcategory: 'My Subcategory',
  tags: ['tag1', 'tag2'],
  createdAt: '2025-01-01T00:00:00.000Z',
  updatedAt: '2025-01-01T00:00:00.000Z',
}

// 2. Define Creation Function
export default function createMyDomain(options: CreateTemplateOptions = {}): DataDomain {
  const domain = options.domain ?? new DataDomain({
    info: {
      name: meta.name,
      displayName: meta.name,
      description: meta.description,
    },
  })

  // ... implementation details ...

  return domain
}

3. Update the Registry

Run the registry generation script to include your new template:

npm run generate-metadata

This will update src/index.ts automatically.

Testing

Run the test suite to verify your changes:

npm test

Tests successfully validate:

  • Registry integrity (all templates are loadable)
  • Template structure (namespaces, entities, etc.)

building

To build the project and generate types:

npm run build

The build process also triggers the metadata generation script. JSON metadata files for UI previews are generated in the src/meta directory.