@alevnyacow/nzmt 0.15.0 → 0.15.1
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 +21 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,35 +6,32 @@
|
|
|
6
6
|
|
|
7
7
|
# About
|
|
8
8
|
|
|
9
|
-
NZMT is
|
|
9
|
+
**Not** a framework. Seriously, we have enough of those. NZMT is just the tools you always wanted in Next.js, plus a scaffolder that spins up server logic and client queries. Full-stack, the Next.js way!
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
while removing most of the boilerplate through code generation out of the box.
|
|
11
|
+
Think: dependency injection + Zod validation + DDD vibes... but without drowning in boilerplate. You write the fun stuff; NZMT handles the boring stuff.
|
|
13
12
|
|
|
14
|
-
Batteries included
|
|
13
|
+
Batteries included.
|
|
15
14
|
|
|
16
15
|
## Why NZMT?
|
|
17
16
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- You want your application to be runtime-safe
|
|
22
|
-
- You don't want to waste time on another framework, you want to keep using plain Next.js, but with better structure and speed
|
|
23
|
-
- You want a backend that can evolve into a full-stack solution
|
|
24
|
-
- You dig cool cartoonish fonts in logos and you don't see it this much nowadays
|
|
17
|
+
- Focus on your domain logic without drowning in full-blown DDD.
|
|
18
|
+
- Keep using plain Next.js, just faster and cleaner — no extra framework required.
|
|
19
|
+
- Watch entities, stores, services, controllers, handlers, and client-side queries appear automatically (and yes, it’s actually fun).
|
|
25
20
|
|
|
26
|
-
|
|
21
|
+
# Quick start (Prisma + client-side queries)
|
|
27
22
|
|
|
28
|
-
|
|
23
|
+
Assuming you have a Next.js project with a generated Prisma client, `User` Prisma model and configured `@tanstack/react-query`:
|
|
29
24
|
|
|
30
|
-
|
|
25
|
+
## Initialization
|
|
26
|
+
|
|
27
|
+
1. Install required dependencies and NZMT itself:
|
|
31
28
|
|
|
32
|
-
1. Install required peer dependencies and the toolkit itself.
|
|
33
29
|
```bash
|
|
34
30
|
npm install inversify zod reflect-metadata @alevnyacow/nzmt
|
|
35
31
|
```
|
|
36
32
|
|
|
37
33
|
2. Enable `Experimental decorators` and `Emit Decorator Metadata` options in your `tsconfig.json`.
|
|
34
|
+
|
|
38
35
|
```json
|
|
39
36
|
{
|
|
40
37
|
"compilerOptions": {
|
|
@@ -45,11 +42,15 @@ npm install inversify zod reflect-metadata @alevnyacow/nzmt
|
|
|
45
42
|
```
|
|
46
43
|
|
|
47
44
|
3. Initialize NZMT (must be done once). This will set up all required infrastructure and configuration for you:
|
|
45
|
+
|
|
48
46
|
```bash
|
|
49
47
|
npx nzmt init prismaClientPath:@/app/generated/prisma/client
|
|
50
48
|
```
|
|
51
49
|
|
|
52
|
-
|
|
50
|
+
## Scaffolding
|
|
51
|
+
|
|
52
|
+
Now you can scaffold everything you need for `User` entity CRUD API in one CLI command:
|
|
53
|
+
|
|
53
54
|
```bash
|
|
54
55
|
npx nzmt crud-api user
|
|
55
56
|
```
|
|
@@ -62,12 +63,13 @@ This will generate:
|
|
|
62
63
|
- `UserController` with ready-to-use API endpoints
|
|
63
64
|
- Fully typed `UserAPI` contract (endpoints + DTOs) for client usage
|
|
64
65
|
- API `route handlers` inside your `app` folder
|
|
66
|
+
- `React queries`. Fully typed and ready to be used in your client-side code!
|
|
65
67
|
|
|
66
|
-
All code is editable - you stay in full control
|
|
68
|
+
**All code is editable - you stay in full control!**
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
- **Describe entity properties and validation rules using Zod** for the `User` entity in the scaffolded file `/shared/entities/user/user.entity.ts`.
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
- **Implement Prisma mappers** in `/server/stores/user/user.store.prisma.ts`.
|
|
71
73
|
All methods and contracts are already scaffolded; you only need to describe the mappers themselves. RAM store implementation works out of the box.
|
|
72
74
|
|
|
73
75
|
# Design principles
|