@domain-first/project-structure 4.0.0 → 4.2.0

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.
package/README.md CHANGED
@@ -13,7 +13,7 @@ Spend less time setting up files. Spend more time building your domain.
13
13
 
14
14
  In most TypeScript codebases you choose between convenience and architecture. Clear boundaries and roles around the domain mean more files, more contracts and more wiring, so under deadline pressure the logic ends up wherever it is quickest to write it. The boundaries blur one shortcut at a time.
15
15
 
16
- Domain First Project Structure removes that choice: **the cleanest path is also the shortest one**. An interactive CLI asks which bounded context, layer and role a new piece of code has, and generates it in its place, with contracts, implementations, test skeletons and wiring that respect the boundaries. Dependencies are offered only where the layers allow them. Doing it right takes a few prompts; doing it wrong takes extra effort. It knows the `@domain-first` packages: types, errors, handlers, wire and handlers-rest. The generated files belong to your project; you write the business rules.
16
+ Domain First Project Structure removes that choice: **the cleanest path is also the shortest one**. An interactive CLI asks which bounded context, layer and role a new piece of code has, and generates it in its place, with contracts, implementations, test skeletons and wiring that respect the boundaries. Dependencies are offered only where the dependency rules allow them. Doing it right takes a few prompts; doing it wrong takes extra effort. It knows the `@domain-first` packages: types, errors, handlers, wire and handlers-rest. The generated files belong to your project; you write the business rules.
17
17
 
18
18
  ```
19
19
  npm i -D @domain-first/project-structure
@@ -101,7 +101,7 @@ export class PlaceOrderUseCase {
101
101
  }
102
102
  ```
103
103
 
104
- Commands and queries come in two modes. **Execution** creates an abstract contract in `application/` and implementations in `infrastructure/`, like a repository. **Orchestrator** creates one application class that coordinates execution commands and queries.
104
+ Commands and queries come in two modes. **Execution** creates an abstract contract in `application/` and implementations in `infrastructure/`, like a repository. **Orchestrator** creates one application class that coordinates execution commands and queries (an orchestrator query, execution queries and repositories only, reading methods only). A query only reads and never changes data; any change is a command.
105
105
 
106
106
  ### How to switch implementations
107
107
 
@@ -207,6 +207,31 @@ Choose **Add integration** to configure Storybook, Prisma 8, Vitest, Playwright,
207
207
 
208
208
  **Missing domain-first packages** prints the `npm i` command for packages from the config that are not in `package.json`.
209
209
 
210
+ ### How to check the rules
211
+
212
+ ```
213
+ npx df-lint
214
+ ```
215
+
216
+ It reports what breaks the Domain-First rules: imports between bounded contexts, imports against the layers, modules using kinds the dependency rules don't allow (in imports and in wiring), React modules importing what they shouldn't, and reading the time without the clock port. It exits with 1 when something is found, so you can run it in CI.
217
+
218
+ The rules are a default. Teams that work differently change them in the config: what each kind of module may depend on (`rules.dependencies`) and which checks run (`rules.lint`). `df-ps` offers dependencies by the same rules. Without `rules`, the defaults apply and every check runs; kinds and checks you don't mention keep their defaults.
219
+
220
+ - Kinds in `rules.dependencies` (as keys and in lists): `repositories`, `domain-services`, `application-ports`, `application-services`, `use-cases`, `execution-commands`, `execution-queries`, `orchestration-commands`, `orchestration-queries`, `infrastructure-services`, `presentation-services`.
221
+ - A kind's value: a list that replaces its defaults, or `{ "add": [...], "remove": [...] }`.
222
+ - Checks in `rules.lint`: `context-isolation`, `shared-layer`, `layers`, `dependencies`, `react`, `clock`.
223
+
224
+ Defaults and details: [Dependency rules](API.md#dependency-rules), [`df-lint`](API.md#df-lint).
225
+
226
+ ```json
227
+ {
228
+ "rules": {
229
+ "dependencies": { "use-cases": { "add": ["use-cases"] } },
230
+ "lint": { "clock": false }
231
+ }
232
+ }
233
+ ```
234
+
210
235
  ### How to teach your coding agent
211
236
 
212
237
  The package ships skills that teach coding agents to plan features, scaffold with `df-ps` and implement the generated code.