@nestjs-ssr/react 0.2.3 → 0.2.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 +35 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,33 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nestjs-ssr/react
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@nestjs-ssr/react)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
> This package is currently in active development. The API may change between minor versions. Production use is not recommended yet.
|
|
6
|
+
React as a view layer for NestJS. Controllers return data. Components render it. One app.
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Clean Architecture: layers separated, dependencies inward, business logic framework-agnostic.
|
|
12
|
-
|
|
13
|
-
## When To Use
|
|
14
|
-
|
|
15
|
-
**Use this when:**
|
|
16
|
-
|
|
17
|
-
- You have NestJS and want React instead of Handlebars/EJS
|
|
18
|
-
- Testable layers matter more than file-based routing
|
|
19
|
-
- You want feature modules (controller + service + view together)
|
|
20
|
-
|
|
21
|
-
**Use Next.js when:**
|
|
22
|
-
|
|
23
|
-
- You're starting fresh without NestJS
|
|
24
|
-
- You want the React ecosystem's defaults
|
|
25
|
-
- File-based routing fits your mental model
|
|
8
|
+
**[Documentation](https://georgialexandrov.github.io/nest-ssr/)** | **[Getting Started](https://georgialexandrov.github.io/nest-ssr/guide/installation)**
|
|
26
9
|
|
|
27
10
|
## Quick Start
|
|
28
11
|
|
|
29
12
|
```bash
|
|
30
|
-
npx @nestjs-ssr/react
|
|
13
|
+
npx @nestjs-ssr/react init
|
|
31
14
|
```
|
|
32
15
|
|
|
33
16
|
```typescript
|
|
@@ -58,32 +41,52 @@ expect(await controller.getProduct('123')).toEqual({ product: { id: '123' } });
|
|
|
58
41
|
render(<ProductDetail data={{ product: mockProduct }} />);
|
|
59
42
|
```
|
|
60
43
|
|
|
61
|
-
##
|
|
44
|
+
## What You Get
|
|
62
45
|
|
|
63
46
|
**Rendering:**
|
|
64
47
|
|
|
65
48
|
- Type-safe data flow from controller to component
|
|
66
|
-
- Hierarchical layouts (
|
|
67
|
-
- Head tags
|
|
49
|
+
- Hierarchical layouts (root → controller → method)
|
|
50
|
+
- Head tags (title, meta, OG, JSON-LD)
|
|
51
|
+
- Stream or string mode
|
|
68
52
|
|
|
69
53
|
**Request Context:**
|
|
70
54
|
|
|
71
|
-
- Hooks:
|
|
55
|
+
- Hooks: `useParams()`, `useQuery()`, `useHeader()`, `useCookie()`
|
|
72
56
|
- Whitelist what reaches the client
|
|
73
57
|
|
|
74
58
|
**Development:**
|
|
75
59
|
|
|
76
|
-
- Integrated mode:
|
|
77
|
-
-
|
|
60
|
+
- Integrated mode: Vite inside NestJS, one process
|
|
61
|
+
- Separate mode: standalone Vite server, true HMR
|
|
78
62
|
|
|
79
|
-
##
|
|
63
|
+
## Requirements
|
|
80
64
|
|
|
81
|
-
|
|
65
|
+
- Node.js 20+
|
|
66
|
+
- NestJS 11+
|
|
67
|
+
- React 19+
|
|
68
|
+
- Vite 6+
|
|
69
|
+
- TypeScript 5+
|
|
82
70
|
|
|
83
|
-
##
|
|
71
|
+
## Documentation
|
|
84
72
|
|
|
85
|
-
**[
|
|
86
|
-
|
|
73
|
+
**[georgialexandrov.github.io/nest-ssr](https://georgialexandrov.github.io/nest-ssr/)**
|
|
74
|
+
|
|
75
|
+
- [Installation](https://georgialexandrov.github.io/nest-ssr/guide/installation)
|
|
76
|
+
- [Rendering](https://georgialexandrov.github.io/nest-ssr/guide/rendering)
|
|
77
|
+
- [Request Context](https://georgialexandrov.github.io/nest-ssr/guide/request-context)
|
|
78
|
+
- [Configuration](https://georgialexandrov.github.io/nest-ssr/guide/configuration)
|
|
79
|
+
- [API Reference](https://georgialexandrov.github.io/nest-ssr/guide/api)
|
|
80
|
+
|
|
81
|
+
## Contributing
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/georgialexandrov/nestjs-ssr.git
|
|
85
|
+
cd nestjs-ssr
|
|
86
|
+
pnpm install
|
|
87
|
+
pnpm build:package
|
|
88
|
+
pnpm test
|
|
89
|
+
```
|
|
87
90
|
|
|
88
91
|
## License
|
|
89
92
|
|