@alevnyacow/nzmt 0.39.3 → 0.39.4
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 +31 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,35 +164,35 @@ export default async function Page() {
|
|
|
164
164
|
|
|
165
165
|
## Initialization
|
|
166
166
|
|
|
167
|
-
| Command
|
|
168
|
-
|
|
169
|
-
| `npx nzmt init`
|
|
167
|
+
| Command | Scaffolding result | Options |
|
|
168
|
+
| --------------- | ------------------ | ------------------------------------------------------------------------------------------------------------- |
|
|
169
|
+
| `npx nzmt init` | **init**ialization | pass `prismaClientPath:` to work with Prisma. E.g. `npx nzmt init prismaClientPath:@/generated/prisma/client` |
|
|
170
170
|
|
|
171
171
|
## Complex scaffolding
|
|
172
172
|
|
|
173
|
-
| Command
|
|
174
|
-
|
|
175
|
-
| `npx nzmt crud-api <name>`
|
|
176
|
-
| `npx nzmt crud-service <name>` | CRUD via Server Actions (no Controllers, API Routes and React Query hooks).
|
|
177
|
-
| `npx nzmt se <name>`
|
|
178
|
-
| `npx nzmt rq`
|
|
173
|
+
| Command | Scaffolding result |
|
|
174
|
+
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
175
|
+
| `npx nzmt crud-api <name>` | CRUD via Server Actions and React Query hooks. |
|
|
176
|
+
| `npx nzmt crud-service <name>` | CRUD via Server Actions (no Controllers, API Routes and React Query hooks). |
|
|
177
|
+
| `npx nzmt se <name>` | **s**tored **e**ntity: entity + store (contracts linked). |
|
|
178
|
+
| `npx nzmt rq` | API **r**outes and React **q**ueries for all of your controllers. This command will also remove endpoints which don't exist anymore with according React query hooks |
|
|
179
179
|
|
|
180
180
|
## Primary server modules scaffolding
|
|
181
181
|
|
|
182
|
-
| Command
|
|
183
|
-
|
|
184
|
-
| `npx nzmt e <name>` | **e**ntity
|
|
185
|
-
| `npx nzmt vo <name>` | **v**alue **o**bject
|
|
186
|
-
| `npx nzmt cs <name>`
|
|
187
|
-
| `npx nzmt s <name>` | **s**ervice
|
|
188
|
-
| `npx nzmt c <name>` | **c**ontroller
|
|
182
|
+
| Command | Scaffolding result | Options |
|
|
183
|
+
| -------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
184
|
+
| `npx nzmt e <name>` | **e**ntity | |
|
|
185
|
+
| `npx nzmt vo <name>` | **v**alue **o**bject | |
|
|
186
|
+
| `npx nzmt cs <name>` | **c**ustom **s**tore (all schemas are `z.object({})`) | |
|
|
187
|
+
| `npx nzmt s <name>` | **s**ervice | `i:UserStore,Logger` will automatically inject `UserStore` and `Logger`. E.g. `npx nzmt s shop i:UserStore,ProductStore` will create `ShopService` with already injected `UserStore` and `ProductStore` |
|
|
188
|
+
| `npx nzmt c <name>` | **c**ontroller | `i:UserService` will automatically inject `UserService`. `Logger` and `Guards` are injected by default regardless of `i:` option |
|
|
189
189
|
|
|
190
190
|
## Auxiliary server modules scaffolding
|
|
191
191
|
|
|
192
|
-
| Command
|
|
193
|
-
|
|
194
|
-
| `npx nzmt p <name>`
|
|
195
|
-
| `npx nzmt i <name>`
|
|
192
|
+
| Command | Scaffolding result |
|
|
193
|
+
| ------------------- | ------------------------- |
|
|
194
|
+
| `npx nzmt p <name>` | **p**rovider |
|
|
195
|
+
| `npx nzmt i <name>` | **i**nfrastructure module |
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
# How to implement your own methods
|
|
@@ -299,17 +299,17 @@ Once you done implementing controller methods, just run `nmx nzmt rq`. This comm
|
|
|
299
299
|
|
|
300
300
|
`NZMT` combines the best of both worlds in one package while staying in plain Next.js:
|
|
301
301
|
|
|
302
|
-
| Feature
|
|
303
|
-
|
|
|
304
|
-
|
|
|
305
|
-
|
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
|
|
|
312
|
-
| Code ownership
|
|
302
|
+
| Feature | NZMT | tRPC | Nest |
|
|
303
|
+
| ---------------------- | --------------------------------------------- | ------ | ------------------------------- |
|
|
304
|
+
| Architecture | contract-first, domain-focused | ❌ | module-centric, tightly coupled |
|
|
305
|
+
| Learning curve | Medium | Low | High |
|
|
306
|
+
| Type safety | ✅ - including run-time checks out of the box | ✅ | ⚠️ |
|
|
307
|
+
| Scaffolding | ✅ - production-ready full-stack | ❌ | ⚠️ |
|
|
308
|
+
| Boilerplate | ✅ - Low | ✅ | ❌ - High |
|
|
309
|
+
| No framework lock-in | ✅ | ✅ | ❌ |
|
|
310
|
+
| Single source of truth | ✅ (schemas) | ⚠️ | ❌ |
|
|
311
|
+
| Time to first feature | ✅ instant full-stack | ⚡ fast | 🐢 slow |
|
|
312
|
+
| Code ownership | ✅ full (generated, editable) | ✅ | ⚠️ (framework patterns) |
|
|
313
313
|
|
|
314
314
|
|
|
315
315
|
## What does domain-focused mean?
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alevnyacow/nzmt",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.4",
|
|
4
4
|
"description": "Next Zod Modules Toolkit",
|
|
5
5
|
"keywords": ["next", "full-stack", "server", "backend", "cli", "scaffolding", "zod", "rest", "contract programming", "contract-first", "react-query", "ddd", "domain-driven"],
|
|
6
6
|
"repository": {
|