{"id":17498192,"url":"https://github.com/timreynolds/js-domain","last_synced_at":"2025-08-04T11:34:55.404Z","repository":{"id":48324609,"uuid":"101496969","full_name":"timReynolds/js-domain","owner":"timReynolds","description":"Base classes and ts declarations for using the domain model pattern with DDD in js","archived":false,"fork":false,"pushed_at":"2021-08-01T11:51:37.000Z","size":187,"stargazers_count":3,"open_issues_count":13,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T01:56:50.884Z","etag":null,"topics":["ddd","ddd-patterns","domain-driven-design","events","javascript","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timReynolds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-26T16:09:04.000Z","updated_at":"2021-06-07T23:19:04.000Z","dependencies_parsed_at":"2022-08-20T11:10:52.925Z","dependency_job_id":null,"html_url":"https://github.com/timReynolds/js-domain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/timReynolds/js-domain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Fjs-domain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Fjs-domain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Fjs-domain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Fjs-domain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timReynolds","download_url":"https://codeload.github.com/timReynolds/js-domain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timReynolds%2Fjs-domain/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268689479,"owners_count":24291077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ddd","ddd-patterns","domain-driven-design","events","javascript","typescript"],"created_at":"2024-10-19T16:10:38.941Z","updated_at":"2025-08-04T11:34:55.367Z","avatar_url":"https://github.com/timReynolds.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"JS DDD Classes\n=========================\n\n[![Build Status](https://travis-ci.org/timReynolds/js-domain.svg?branch=master)](https://travis-ci.org/timReynolds/js-domain)\n[![Coverage Status](https://coveralls.io/repos/github/timReynolds/js-domain/badge.svg?branch=master)](https://coveralls.io/github/timReynolds/js-domain?branch=master)\n\nA set of base classes used to implement [DDD](https://en.wikipedia.org/wiki/Domain-driven_design) style [domain model](https://martinfowler.com/eaaCatalog/domainModel.html) pattern in JavaScript.\n\n# Classes\n\nBelow outlines the classes provided in this package and the functionality encapsulated in each.\n\n## Value Object\n\u003e Objects that matter only as the combination of their attributes. Two value objects with the same values for all their attributes are considered equal.\n\nProvides a createdOn date which is can either be set via the constructor or defaults to Moment utc.\n\n\n## Entity\n\u003e Objects that have a distinct identity that runs through time and different representations.\n\nExtends ```ValueObject``` but provides an id to distinguishes the objects identity throughout time. Defaulted to a v4 GUID when not provided.\n\n## Aggregate Root\n\u003e Cluster of domain objects that can be treated as a single unit and the basic element of transfer of data storage.\n\nExtends ```Entity``` with the additional responsibility of tracking and queuing ```Events```.\n\nWithin these classes the Aggregate takes responsibility for eventing for any entity it manages. Events are stored within the class and made accessible vis the ```enqueuedEvents``` method. The advantages of this approach are;\n\n* Class isn't coupled to a publisher\n* Events can be batched processed\n* Events can be encapsulated within a transactional boundary\n\n## Event\n\u003e Captures the memory of something interesting which affects the domain\n\nUsed to provide a consistent interface for events from the domain expecting a ```type``` and ```data``` properties via the constructor. The following common event properties are default unless provided;\n\n* id\n* correlationId\n* raisedOn\n\nIntended to be extended by specific event classes that include data validation.\n\n#Example Usage\n\nAll classes are exposed at root level.\n\n```\nconst { ValueObject } = require('@reynolds/domain');\nclass Example extends ValueObject {\n```\n\nAs are typescript declarations\n\n```\nconst { ICreatedOn } = require('@reynolds/domain');\nclass Example implements ICreatedOn {}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimreynolds%2Fjs-domain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimreynolds%2Fjs-domain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimreynolds%2Fjs-domain/lists"}