You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✨ A template repository showcasing key [Nx](https://nx.dev) features for React monorepos ✨
5
+
✨ A repository showcasing key [Nx](https://nx.dev) features for React monorepos ✨
6
6
7
7
## 📦 Project Overview
8
8
9
-
This template demonstrates a production-ready React monorepo with:
9
+
This repository demonstrates a production-ready React monorepo with:
10
10
11
11
-**2 Applications**
12
12
-`shop` - React e-commerce application with product listings and detail views
@@ -35,34 +35,34 @@ cd react-template
35
35
npm install
36
36
37
37
# Serve the React shop application
38
-
nx serve shop
38
+
npx nx serve shop
39
39
40
40
# Serve the API backend
41
-
nx serve api
41
+
npx nx serve api
42
42
43
43
# Build all projects
44
-
nx run-many -t build
44
+
npx nx run-many -t build
45
45
46
46
# Run tests
47
-
nx run-many -t test
47
+
npx nx run-many -t test
48
48
49
49
# Lint all projects
50
-
nx run-many -t lint
50
+
npx nx run-many -t lint
51
51
52
52
# Run e2e tests
53
-
nx e2e shop-e2e
53
+
npx nx e2e shop-e2e
54
54
55
55
# Run tasks in parallel
56
56
57
-
nx run-many -t lint test build e2e --parallel=3
57
+
npx nx run-many -t lint test build e2e --parallel=3
58
58
59
59
# Visualize the project graph
60
-
nx graph
60
+
npx nx graph
61
61
```
62
62
63
63
## ⭐ Featured Nx Capabilities
64
64
65
-
This template showcases several powerful Nx features:
65
+
This repository showcases several powerful Nx features:
66
66
67
67
### 1. 🔒 Module Boundaries
68
68
@@ -78,10 +78,10 @@ Enforces architectural constraints using tags. Each project has specific depende
78
78
**Try it out:**
79
79
```bash
80
80
# See the current project graph and boundaries
81
-
nx graph
81
+
npx nx graph
82
82
83
83
# View a specific project's details
84
-
nx show project shop --web
84
+
npx nx show project shop --web
85
85
```
86
86
87
87
[Learn more about module boundaries →](https://nx.dev/features/enforce-module-boundaries)
@@ -92,13 +92,13 @@ The API project includes Docker support with automated targets and release manag
92
92
93
93
```bash
94
94
# Build Docker image
95
-
nx docker:build api
95
+
npx nx docker:build api
96
96
97
97
# Run Docker container
98
-
nx docker:run api
98
+
npx nx docker:run api
99
99
100
100
# Release with automatic Docker image versioning
101
-
nx release
101
+
npx nx release
102
102
```
103
103
104
104
**Nx Release for Docker:** The repository is configured to use Nx Release for managing Docker image versioning and publishing. When running `nx release`, Docker images for the API project are automatically versioned and published based on the release configuration in `nx.json`. This integrates seamlessly with semantic versioning and changelog generation.
@@ -111,10 +111,10 @@ End-to-end testing with Playwright is pre-configured:
111
111
112
112
```bash
113
113
# Run e2e tests
114
-
nx e2e shop-e2e
114
+
npx nx e2e shop-e2e
115
115
116
116
# Run e2e tests in CI mode
117
-
nx e2e-ci shop-e2e
117
+
npx nx e2e-ci shop-e2e
118
118
```
119
119
120
120
[Learn more about E2E testing →](https://nx.dev/technologies/test-tools/playwright/introduction#e2e-testing)
@@ -125,10 +125,10 @@ Fast unit testing with Vitest for React libraries:
125
125
126
126
```bash
127
127
# Test a specific library
128
-
nx test shop-data
128
+
npx nx test shop-data
129
129
130
130
# Test all projects
131
-
nx run-many -t test
131
+
npx nx run-many -t test
132
132
```
133
133
134
134
[Learn more about Vite testing →](https://nx.dev/recipes/vite)
@@ -189,29 +189,29 @@ This repository uses tags to enforce module boundaries:
189
189
190
190
```bash
191
191
# Project exploration
192
-
nx graph # Interactive dependency graph
193
-
nx list # List installed plugins
194
-
nx show project shop --web # View project details
192
+
npx nx graph # Interactive dependency graph
193
+
npx nx list # List installed plugins
194
+
npx nx show project shop --web # View project details
195
195
196
196
# Development
197
-
nx serve shop # Serve React app
198
-
nx serve api # Serve backend API
199
-
nx build shop # Build React app
200
-
nx test shop-data # Test a specific library
201
-
nx lint shop-feature-products # Lint a specific library
197
+
npx nx serve shop # Serve React app
198
+
npx nx serve api # Serve backend API
199
+
npx nx build shop # Build React app
200
+
npx nx test shop-data # Test a specific library
201
+
npx nx lint shop-feature-products # Lint a specific library
202
202
203
203
# Running multiple tasks
204
-
nx run-many -t build # Build all projects
205
-
nx run-many -t test --parallel=3 # Test in parallel
206
-
nx run-many -t lint test build # Run multiple targets
204
+
npx nx run-many -t build # Build all projects
205
+
npx nx run-many -t test --parallel=3 # Test in parallel
206
+
npx nx run-many -t lint test build # Run multiple targets
207
207
208
208
# Affected commands (great for CI)
209
-
nx affected -t build # Build only affected projects
210
-
nx affected -t test# Test only affected projects
209
+
npx nx affected -t build # Build only affected projects
210
+
npx nx affected -t test# Test only affected projects
211
211
212
212
# Docker operations
213
-
nx docker:build api # Build Docker image
214
-
nx docker:run api # Run Docker container
213
+
npx nx docker:build api # Build Docker image
214
+
npx nx docker:run api # Run Docker container
215
215
```
216
216
217
217
## 🎯 Adding New Features
@@ -238,6 +238,28 @@ npx nx g @nx/node:lib my-api-lib
238
238
239
239
You can use `npx nx list` to see all available plugins and `npx nx list <plugin-name>` to see all generators for a specific plugin.
240
240
241
+
## Nx Cloud
242
+
243
+
244
+
Nx Cloud ensures a [fast and scalable CI](https://nx.dev/ci/intro/why-nx-cloud?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) pipeline. It includes features such as:
-[Task distribution across multiple machines](https://nx.dev/ci/features/distribute-task-execution?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
248
+
-[Automated e2e test splitting](https://nx.dev/ci/features/split-e2e-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
249
+
-[Task flakiness detection and rerunning](https://nx.dev/ci/features/flaky-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
250
+
251
+
### Set up CI (non-Github Actions CI)
252
+
253
+
**Note:** This is only required if your CI provider is not GitHub Actions.
254
+
255
+
Use the following command to configure a CI workflow for your workspace:
256
+
257
+
```sh
258
+
npx nx g ci-workflow
259
+
```
260
+
261
+
[Learn more about Nx on CI](https://nx.dev/ci/intro/ci-with-nx#ready-get-started-with-your-provider?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
262
+
241
263
## Install Nx Console
242
264
243
265
Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
0 commit comments