Registry / database / metadomain

metadomain

JSON →
library2.0.0-alpha.2jsnpmunverified

Metadomain is a Metarhia core model library for defining database schemas using a meta-model approach. Current stable version is 1.0.10, with 2.0.0-alpha.2 available for testing. It provides a declarative schema definition using domain objects with relationships, validation, and hooks. Key differentiators: schema-driven data modeling integrated with Metarhia's Impress application server and other Metarhia libraries, supporting PostgreSQL and other databases. Released under the MIT license, it is part of the Metarhia ecosystem for building scalable Node.js applications.

npm install metadomain
INSTALL
IMPORT
SIG · METADOMAIN
M
metadomain
databasejavascriptv2.0.0-alpha.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Domain
import { Domain } from 'metadomain'
const Domain = require('metadomain')
ESM-only; no CommonJS support.
Schema
import { Schema } from 'metadomain'
import Schema from 'metadomain'
Named export, not default.
Field
import { Field } from 'metadomain'
const { Field } = require('metadomain')
ESM-only.

Demonstrates creating a domain, defining a schema with fields, and creating an entity instance.

import { Domain, Schema, Field } from 'metadomain'; const schema = new Schema('example', { fields: [ new Field('id').integer().primary(), new Field('name').string(100).required(), new Field('email').string().email(), ], }); const domain = new Domain(); domain.entity('User', schema); const user = domain.create('User', { name: 'John', email: 'john@example.com' }); console.log(user.toObject());
Debug
Known issues
breakingMetadomain v2.0.0-alpha.x is not backward compatible with v1.x; schema definition API has changed.
fix
Refer to migration guide; use new Field and Schema constructors.
affects: >=2.0.0-alpha.0 <2.0.0
breakingRemoved support for Node.js versions below 18 in v2.0.0-alpha.
fix
Upgrade Node.js to version 18, 20, 21, or 22.
affects: >=2.0.0-alpha.0
deprecatedThe `Domain` constructor with string arguments for types is deprecated; use object configuration.
fix
Pass configuration object: new Domain({ types: ... }).
affects: >=1.0.0 <2.0.0
gotchaFields must be added to a Schema using an array in the constructor; mutations after creation are not reflected.
fix
Define all fields in the schema constructor.
affects: >=1.0.0
gotchaThe library is ESM-only; using require() will throw an error.
fix
Use ES module imports or dynamic import().
affects: >=2.0.0-alpha.0
Errors
Common errors & fixes
Cannot find module 'metadomain'
Package not installed or wrong import path in CJS project.
fix
Install: npm install metadomain. If using CJS, use dynamic import: import('metadomain').
TypeError: Domain is not a constructor
Using require() on an ESM-only package.
fix
Switch to ES module syntax: import { Domain } from 'metadomain'.
Error: Unknown field type 'custom'
Trying to use an unsupported field type.
fix
Use built-in types: integer, string, boolean, etc. Or define custom type via schema options.
Schema validation error: Field 'email' must be a valid email
Email validation fails on entity creation.
fix
Ensure field value passes built-in email validation; or remove .email() constraint.
Upgrade
Version history
2.0.0-alpha.2latest on npm
Audit
Dependencies
@metarhia/commonrequiredProvides common utilities used by Metadomain.
metatypesrequiredProvides type checking and validation utilities.
Agent activity
2 hits · last 30 days
node
2
Resources
metadomain — npm install metadomain · libregistry