Nx Workspace Patterns

Nx Workspace Patterns

Explains how to set up and optimise Nx monorepos: workspace layout, library types, project boundaries, caching and affected commands for CI.

Skill files2 files

references/

SKILL.md70 lines
1
---
2
name: nx-workspace-patterns
3
description: Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.
4
---
5
6
# Nx Workspace Patterns
7
8
Production patterns for Nx monorepo management.
9
10
## When to Use This Skill
11
12
- Setting up new Nx workspaces
13
- Configuring project boundaries
14
- Optimizing CI with affected commands
15
- Implementing remote caching
16
- Managing dependencies between projects
17
- Migrating to Nx
18
19
## Core Concepts
20
21
### 1. Nx Architecture
22
23
```
24
workspace/
25
├── apps/ # Deployable applications
26
│ ├── web/
27
│ └── api/
28
├── libs/ # Shared libraries
29
│ ├── shared/
30
│ │ ├── ui/
31
│ │ └── utils/
32
│ └── feature/
33
│ ├── auth/
34
│ └── dashboard/
35
├── tools/ # Custom executors/generators
36
├── nx.json # Nx configuration
37
└── workspace.json # Project configuration
38
```
39
40
### 2. Library Types
41
42
| Type | Purpose | Example |
43
| --------------- | -------------------------------- | ------------------- |
44
| **feature** | Smart components, business logic | `feature-auth` |
45
| **ui** | Presentational components | `ui-buttons` |
46
| **data-access** | API calls, state management | `data-access-users` |
47
| **util** | Pure functions, helpers | `util-formatting` |
48
| **shell** | App bootstrapping | `shell-web` |
49
50
## Templates and detailed worked examples
51
52
Full template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.
53
54
## Best Practices
55
56
### Do's
57
58
- **Use tags consistently** - Enforce with module boundaries
59
- **Enable caching early** - Significant CI savings
60
- **Keep libs focused** - Single responsibility
61
- **Use generators** - Ensure consistency
62
- **Document boundaries** - Help new developers
63
64
### Don'ts
65
66
- **Don't create circular deps** - Graph should be acyclic
67
- **Don't skip affected** - Test only what changed
68
- **Don't ignore boundaries** - Tech debt accumulates
69
- **Don't over-granularize** - Balance lib count
70

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 11,695 prompts

More by @OpenSourceBuffGuy

See all
Iridescent Levitating Product Render prompt image

Iridescent Levitating Product Render

Renders any product you name as a levitating obsidian-glass object with vivid iridescent neon edges and inner glow on a pure black background.

image-prompt, json-prompt, structured-output, placeholders, template, negative-prompt, nano-banana, 3d-render, product-photography, still-life, neon, vibrant-colors, dramatic-lighting, futuristic, minimalist, luxury, advertising, for-designers, for-marketers, for-artists, symmetry

Lone runner in grey street with cyan glow prompt image

Lone runner in grey street with cyan glow

Generates a 15-second vertical animated ad in which a hesitant runner shatters grey mental noise into neon light, with a timeline, voiceover, music and a negative prompt.

video-prompt, hailuo, json-prompt, video-ad, motivation, short-form-video, vertical-format, timed-beats, animation, 3d-render, comics, neon, vibrant-colors, camera-movement, tracking-shot, voiceover, background-music, negative-prompt, multi-shot, scene-transitions, motion-graphics, running, sports, structured-output, long-form

Wind-Up Miniature World prompt image

Wind-Up Miniature World

Draws a collectible wind-up toy containing a tiny mechanical world, with close-ups of its key, spring and linkages, shot like premium product photography.

image-prompt, placeholders, template, miniature, toys, product-photography, whimsical, luxury, soft-lighting, pastel, macro, studio-lighting, multi-panel, still-life, cozy, gpt-image, chatgpt, for-artists, for-designers, concept-art, cinematic, close-up, sculpture

Reviews

Loading reviews…

Discussion

Loading comments…