
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
base-domain
Advanced tools
framework for Domain-Driven Design in JavaScript (or CoffeeScript, recommended.)
$ npm install -g base-domain
base-domain helps easier practice of Domain-Driven Design.

model is classified into "Entity" and "ValueObject"
Entity is model with id, ValueObject is model without id.
# {domain-dir}/hospital.coffee
class Hospital extends require('base-domain').Entity
# property types
@properties:
name : @TYPES.STRING
address : @TYPES.STRING
beds : @TYPES.NUMBER
registeredAt : @TYPES.DATE
isValidated : @TYPES.BOOLEAN
doctors : @TYPES.MODEL 'doctor-list'
flags : @TYPES.MODEL 'flag-dict'
state : @TYPES.ENUM ['PREPARED', 'RUNNING', 'CLOSED']
module.exports = Hospital
@TYPES.XXX is an object and also a function.
@properties:
aaa: @TYPES.STRING
bbb: @TYPES.NUMBER 3
ccc: @TYPES.MODEL 'foo-bar'
| mark | property type | meaning | arg1 | arg2 |
|---|---|---|---|---|
| x | @TYPES.ANY | prop accepts any type | default value | |
| x | @TYPES.STRING | prop is string | default value | |
| x | @TYPES.NUMBER | prop is number | default value | |
| x | @TYPES.DATE | prop is date | default value | |
| x | @TYPES.BOOLEAN | prop is boolean | default value | |
| x | @TYPES.ARRAY | prop is array | default value | |
| x | @TYPES.OBJECT | prop is object | default value | |
| x | @TYPES.BUFFER | prop is buffer | default value | |
| x | @TYPES.GEOPOINT | prop is geopoint | default value | |
| o | @TYPES.CREATED_AT | date set when first saved | default value | |
| o | @TYPES.UPDATED_AT | date set each time saved | default value | |
| o | @TYPES.MODEL | prop is BaseModel | model name | id prop name (if model is Entity) |
| o | @TYPES.ENUM | prop is index of the alternatives | alternatives | default value |
Types with marked "x" just provide the name of the type. base-domain does not validate the prop's type.
# {domain-dir}/hospital-factory.coffee
class HospitalFactory extends require('base-domain').BaseFactory
@modelName: 'hospital'
module.exports = HospitalFactory
# {domain-dir}/hospital-repository.coffee
class HospitalRepository extends require('base-domain').BaseRepository
@modelName: 'hospital'
module.exports = HospitalRepository
domain = require('base-domain').createInstance
dirname: '/path/to/domain-dir'
Hospital = domain.getModel('hospital')
hospitalFactory = domain.createFactory('hospital')
hospitalRepository = domain.createRepository('hospital')
hosp = hospitalFactory.createFromObject(name: 'Suzuki Clinic')
hospitalRepository.query(where: name: 'CureApp Hp.').then (hospitals)->
console.log hospitals
# {domain-dir}/hospital-list.coffee
class HospitalList extends require('base-domain').BaseList
@itemModelName: 'hospital'
module.exports = HospitalList
# {domain-dir}/hospital-dict.coffee
class HospitalDict extends require('base-domain').BaseDict
@itemModelName: 'hospital'
@key: (item) -> item.id
module.exports = HospitalDict
FAQs
simple module to help build Domain-Driven Design
We found that base-domain demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.