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
Copy file name to clipboardExpand all lines: docs/architecture.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,6 +71,30 @@ Each feature follows feature slice architecture patterns with four layers:
71
71
72
72
**Cross-slice primitives:**`features/auth/` and `features/authv2/` are cross-cutting concerns (identity, permissions, auth state). Any feature slice may import from them.
When a feature grows to contain multiple distinct domain sub-areas, each sub-area becomes a **sub-feature slice** — a nested directory with its own four-layer structure (`components/`, `application/`, `providers/`, `models/`).
@@ -79,6 +103,25 @@ The parent feature's layers hold code that is either reusable across sub-feature
79
103
80
104
The same layer dependency rules apply within sub-feature slices. Additionally, sub-feature layers may import from the parent feature's same or lower layers. Sub-feature slices **may not import from sibling sub-feature slices**.
81
105
106
+
```text
107
+
features/marketing/
108
+
├── components/ ← shared across sub-features
109
+
├── providers/ ←┐ parent layers accessible
110
+
├── models/ ←┘ from sub-features (same/lower only)
111
+
│
112
+
├── rating/ ✗ cannot import from reviews/
113
+
│ ├── components/
114
+
│ ├── application/
115
+
│ ├── providers/
116
+
│ └── models/
117
+
│
118
+
└── reviews/ ✗ cannot import from rating/
119
+
├── components/
120
+
├── application/
121
+
├── providers/
122
+
└── models/
123
+
```
124
+
82
125
## API Library
83
126
84
127
`src/lib/api/` is the global home for all HTTP logic: `queryOptions` factories, loaders, mutation hooks, query keys, domain errors, and DTOs, organised by resource. Query files expose `queryOptions` factories (no `useQuery` hooks — hook composition belongs in `providers/`). Feature `providers/` compose hooks on top of those factories and re-export them for feature slice. New API logic always goes in `src/lib/api/` first, then gets exposed through the relevant feature's `providers/`.
@@ -92,6 +135,22 @@ The same layer dependency rules apply within sub-feature slices. Additionally, s
2–5 sentences answering _what problem does this solve and why now_. Constrains intent, not approach. The agent reads this to understand the purpose — if it can't explain the goal, the feature isn't well enough defined.
0 commit comments