@alevnyacow/nzmt 0.18.7 → 0.18.9
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 +18 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,26 +15,29 @@ Get **a DDD-inspired architecture with a contract-first approach** — and Serve
|
|
|
15
15
|
|
|
16
16
|
**API, services, stores, entities, validation, and React Query hooks — all generated for you.** No framework. No lock-in. Just production-ready Next.js.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
# TL;DR
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
- run the scaffolder (e.g. `npx nzmt crud-api user`)
|
|
22
|
-
- tweak a few files
|
|
23
|
-
- get ready-to-use React Query hooks and a backend usable via Server Actions
|
|
20
|
+
1\. initialize NZMT once
|
|
24
21
|
|
|
25
|
-
|
|
22
|
+
2\. run the scaffolder (e.g. `npx nzmt crud-api user`)
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
3\. tweak a few files
|
|
25
|
+
|
|
26
|
+
4\. get ready-to-use React Query hooks and a DDD-inspired backend usable via Server Actions
|
|
27
|
+
|
|
28
|
+
# Quick start with Prisma
|
|
29
|
+
|
|
30
|
+
## Setup
|
|
28
31
|
|
|
29
32
|
Assuming you have a Next.js project with a generated Prisma client, and configured `@tanstack/react-query`:
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
### 1. Install
|
|
32
35
|
|
|
33
36
|
```bash
|
|
34
37
|
npm i inversify zod reflect-metadata @alevnyacow/nzmt
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
### 2. Enable decorators in tsconfig.json
|
|
38
41
|
|
|
39
42
|
```ts
|
|
40
43
|
{
|
|
@@ -45,7 +48,7 @@ npm i inversify zod reflect-metadata @alevnyacow/nzmt
|
|
|
45
48
|
}
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
### 3. Initialize
|
|
49
52
|
|
|
50
53
|
```bash
|
|
51
54
|
npx nzmt init prismaClientPath:@/generated/prisma/client
|
|
@@ -57,11 +60,11 @@ This command takes absolute path to your Prisma client as input and generates:
|
|
|
57
60
|
- DI setup
|
|
58
61
|
- infrastructure helpers
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
### 4. Plug Prisma adapter
|
|
61
64
|
|
|
62
65
|
Edit scaffolded `/server/infrastructure/prisma/client.ts` file
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
## Making full-stack CRUD for `User` entity with React queries and Server Actions
|
|
65
68
|
|
|
66
69
|
Assuming you have `User` prisma schema.
|
|
67
70
|
|
|
@@ -88,7 +91,7 @@ Then tweak a few files:
|
|
|
88
91
|
|
|
89
92
|
And after only one command and a few tweaks you have ready-to-use React Query hooks & Server Actions backend.
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
## Using scaffolded React query hooks
|
|
92
95
|
|
|
93
96
|
```
|
|
94
97
|
Schema: Client → React Query → API → Controller → Service → Store → DB
|
|
@@ -120,7 +123,7 @@ export default function Page() {
|
|
|
120
123
|
|
|
121
124
|
```
|
|
122
125
|
|
|
123
|
-
|
|
126
|
+
## Using scaffolded Service methods as Next server actions
|
|
124
127
|
|
|
125
128
|
```
|
|
126
129
|
Schema: Server Action → Service → Store → DB
|
|
@@ -148,7 +151,7 @@ export default async function Page() {
|
|
|
148
151
|
}
|
|
149
152
|
```
|
|
150
153
|
|
|
151
|
-
|
|
154
|
+
# FAQ
|
|
152
155
|
|
|
153
156
|
## What does DDD-inspired mean?
|
|
154
157
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alevnyacow/nzmt",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.9",
|
|
4
4
|
"description": "Next Zod Modules Toolkit",
|
|
5
5
|
"keywords": ["next", "full-stack", "server", "backend", "cli", "scaffolder", "zod", "rest", "contract programming", "react-query", "ddd", "domain-driven"],
|
|
6
6
|
"repository": {
|