@alevnyacow/nzmt 0.18.6 → 0.18.7
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 +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,26 +15,26 @@ 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
|
+
## <p align="center">👀 TL;DR</p>
|
|
19
19
|
|
|
20
20
|
- initialize NZMT once
|
|
21
21
|
- run the scaffolder (e.g. `npx nzmt crud-api user`)
|
|
22
22
|
- tweak a few files
|
|
23
23
|
- get ready-to-use React Query hooks and a backend usable via Server Actions
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
## <p align="center">🎬 Quick start with Prisma</p>
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### <p align="center">⚙️ Setup</p>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Assuming you have a Next.js project with a generated Prisma client, and configured `@tanstack/react-query`:
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
#### 1. Install
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
34
|
npm i inversify zod reflect-metadata @alevnyacow/nzmt
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
#### 2. Enable decorators in tsconfig.json
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
40
|
{
|
|
@@ -45,7 +45,7 @@ npm i inversify zod reflect-metadata @alevnyacow/nzmt
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
#### 3. Initialize
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
51
|
npx nzmt init prismaClientPath:@/generated/prisma/client
|
|
@@ -57,11 +57,11 @@ This command takes absolute path to your Prisma client as input and generates:
|
|
|
57
57
|
- DI setup
|
|
58
58
|
- infrastructure helpers
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
#### 4. Plug Prisma adapter
|
|
61
61
|
|
|
62
62
|
Edit scaffolded `/server/infrastructure/prisma/client.ts` file
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
### <p align="center">🔍 Making full-stack CRUD for `User` entity with React queries and Server Actions</p>
|
|
65
65
|
|
|
66
66
|
Assuming you have `User` prisma schema.
|
|
67
67
|
|
|
@@ -86,9 +86,9 @@ Then tweak a few files:
|
|
|
86
86
|
- `/server/stores/user/user.store.ts` → store schemas (if default schemas do not fit your needs)
|
|
87
87
|
- `/server/stores/user/user.store.prisma.ts` → map `UserStore` contracts to Prisma client contracts
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
And after only one command and a few tweaks you have ready-to-use React Query hooks & Server Actions backend.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
### <p align="center">⚛️ Using scaffolded React query hooks</p>
|
|
92
92
|
|
|
93
93
|
```
|
|
94
94
|
Schema: Client → React Query → API → Controller → Service → Store → DB
|
|
@@ -120,7 +120,7 @@ export default function Page() {
|
|
|
120
120
|
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
### <p align="center">🔼 Using scaffolded Service methods as Next server actions</p>
|
|
124
124
|
|
|
125
125
|
```
|
|
126
126
|
Schema: Server Action → Service → Store → DB
|
|
@@ -148,7 +148,7 @@ export default async function Page() {
|
|
|
148
148
|
}
|
|
149
149
|
```
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
## <p align="center">❓ FAQ</p>
|
|
152
152
|
|
|
153
153
|
## What does DDD-inspired mean?
|
|
154
154
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alevnyacow/nzmt",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
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": {
|