archstone 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -17
  3. package/package.json +29 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 João Henrique Benatti Coimbra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,10 +1,32 @@
1
1
  # archstone
2
2
 
3
- A TypeScript-first architecture foundation for backend services, built around Domain-Driven Design (DDD) and Clean Architecture principles.
3
+ [![npm version](https://img.shields.io/npm/v/archstone?style=flat-square)](https://www.npmjs.com/package/archstone)
4
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat-square)](./LICENSE)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
6
+ [![Bun](https://img.shields.io/badge/Bun-runtime-black?style=flat-square&logo=bun)](https://bun.sh)
7
+
8
+ > TypeScript architecture foundation for backend services based on Domain-Driven Design (DDD) and Clean Architecture.
4
9
 
5
10
  Archstone provides the core building blocks — entities, value objects, aggregates, domain events, use cases, and repository contracts — so you can focus on your domain logic instead of re-implementing the same structural patterns across every project.
6
11
 
7
- ## Layers
12
+ ## Installation
13
+
14
+ ```bash
15
+ bun add archstone
16
+ # or
17
+ npm install archstone
18
+ ```
19
+
20
+ ## Packages
21
+
22
+ | Import path | Contents |
23
+ |---|---|
24
+ | `archstone/core` | `Either`, `ValueObject`, `UniqueEntityId`, `WatchedList`, `Optional` |
25
+ | `archstone/domain` | All domain exports |
26
+ | `archstone/domain/enterprise` | `Entity`, `AggregateRoot`, `DomainEvent`, `DomainEvents`, `EventHandler` |
27
+ | `archstone/domain/application` | `UseCase`, `UseCaseError`, repository contracts |
28
+
29
+ ## Architecture
8
30
 
9
31
  ```
10
32
  src/
@@ -45,7 +67,7 @@ src/
45
67
  Use cases never throw. They return an `Either<Error, Value>` — left for failure, right for success.
46
68
 
47
69
  ```ts
48
- import { Either, left, right } from "@/core/either"
70
+ import { Either, left, right } from "archstone/core"
49
71
 
50
72
  type Result = Either<UserNotFoundError, User>
51
73
 
@@ -65,9 +87,8 @@ else console.log(result.value) // User
65
87
  Entities are defined by identity. Aggregates extend that with domain event support.
66
88
 
67
89
  ```ts
68
- import { AggregateRoot } from "@/domain/enterprise/entities/aggregate-root"
69
- import { UniqueEntityId } from "@/core/unique-entity-id"
70
- import { Optional } from "@/core/types/optional"
90
+ import { AggregateRoot } from "archstone/domain/enterprise"
91
+ import { UniqueEntityId, Optional } from "archstone/core"
71
92
 
72
93
  interface OrderProps {
73
94
  customerId: UniqueEntityId
@@ -94,7 +115,7 @@ class Order extends AggregateRoot<OrderProps> {
94
115
  Value objects are equal by their properties, not by reference.
95
116
 
96
117
  ```ts
97
- import { ValueObject } from "@/core/value-object"
118
+ import { ValueObject } from "archstone/core"
98
119
 
99
120
  interface EmailProps { value: string }
100
121
 
@@ -113,6 +134,8 @@ class Email extends ValueObject<EmailProps> {
113
134
  Track additions and removals in a collection without rewriting the whole thing on save.
114
135
 
115
136
  ```ts
137
+ import { WatchedList } from "archstone/core"
138
+
116
139
  class TagList extends WatchedList<Tag> {
117
140
  compareItems(a: Tag, b: Tag) { return a.id.equals(b.id) }
118
141
  }
@@ -130,6 +153,8 @@ tags.getRemovedItems() // [existingTag]
130
153
  Events are raised inside aggregates and dispatched by the infrastructure layer after successful persistence.
131
154
 
132
155
  ```ts
156
+ import { DomainEvents } from "archstone/domain/enterprise"
157
+
133
158
  // register a handler
134
159
  DomainEvents.register(
135
160
  (event) => sendWelcomeEmail(event as UserCreatedEvent),
@@ -146,6 +171,8 @@ DomainEvents.dispatchEventsForAggregate(user.id)
146
171
  Repositories are defined as interfaces in the application layer. Implementations live in infrastructure.
147
172
 
148
173
  ```ts
174
+ import { Repository, Creatable } from "archstone/domain/application"
175
+
149
176
  // application/repositories/user-repository.ts
150
177
  export interface UserRepository extends Repository<User> {
151
178
  findByEmail(email: string): Promise<User | null>
@@ -155,19 +182,14 @@ export interface UserRepository extends Repository<User> {
155
182
  export interface AuditRepository extends Creatable<AuditLog> {}
156
183
  ```
157
184
 
158
- ## Getting Started
185
+ ## Contributing
159
186
 
160
- ```bash
161
- bun install
162
- bun test
163
- ```
187
+ Contributions are welcome! Please read [CONTRIBUTING.md](./CONTRIBUTING.md) first.
164
188
 
165
- ## Tech
189
+ ## Code of Conduct
166
190
 
167
- - [Bun](https://bun.sh) — runtime, bundler, and test runner
168
- - TypeScript 5 with strict mode
169
- - Zero runtime dependencies
191
+ This project follows the [Contributor Covenant](./CODE_OF_CONDUCT.md).
170
192
 
171
193
  ## License
172
194
 
173
- MIT
195
+ MIT — see [LICENSE](./LICENSE).
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "archstone",
3
- "version": "1.0.1",
3
+ "description": "TypeScript architecture foundation for backend services based on Domain-Driven Design and Clean Architecture",
4
+ "version": "1.0.2",
4
5
  "type": "module",
5
6
  "private": false,
6
7
  "files": [
@@ -41,6 +42,33 @@
41
42
  },
42
43
  "./package.json": "./package.json"
43
44
  },
45
+ "keywords": [
46
+ "ddd",
47
+ "domain-driven-design",
48
+ "clean-architecture",
49
+ "typescript",
50
+ "entity",
51
+ "aggregate",
52
+ "value-object",
53
+ "either",
54
+ "domain-events",
55
+ "repository",
56
+ "use-case",
57
+ "bun"
58
+ ],
59
+ "author": {
60
+ "name": "João Henrique Benatti Coimbra",
61
+ "url": "https://github.com/joao-coimbra"
62
+ },
63
+ "license": "MIT",
64
+ "homepage": "https://github.com/joao-coimbra/archstone#readme",
65
+ "repository": {
66
+ "type": "git",
67
+ "url": "git+https://github.com/joao-coimbra/archstone.git"
68
+ },
69
+ "bugs": {
70
+ "url": "https://github.com/joao-coimbra/archstone/issues"
71
+ },
44
72
  "scripts": {
45
73
  "build": "bunup",
46
74
  "dev": "bunup --watch",