create-fsaa 0.1.7 → 0.2.0
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/LICENSE +21 -21
- package/README.md +160 -160
- package/bin/fsaa.mjs +15 -15
- package/lib/cli.mjs +97 -92
- package/lib/download.mjs +66 -66
- package/lib/generate.mjs +316 -161
- package/lib/init.mjs +171 -171
- package/lib/net.mjs +12 -12
- package/lib/snippets.mjs +283 -221
- package/package.json +32 -32
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Veaceslav Bezusco
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Veaceslav Bezusco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
<img width="814" height="243" alt="image" src="https://github.com/user-attachments/assets/047ea0c4-ae54-43f1-9dd9-2a8805839ed0" />
|
|
2
|
-
|
|
3
|
-
# FSAA — Feature-Sliced Atomic Architecture ⚡
|
|
4
|
-
|
|
5
|
-
> **FSD + Atomic Design with the missing decision rules: *where does UI go?***
|
|
6
|
-
|
|
7
|
-
[](https://aramex86.github.io/fsaa/)
|
|
8
|
-
[](https://aramex86.github.io/fsaa/)
|
|
9
|
-

|
|
10
|
-

|
|
11
|
-
|
|
12
|
-
* 💡 **Three decision rules** — graduation, boundary test, organisms eliminated
|
|
13
|
-
* 🔒 **ESLint-enforced boundaries** — wrong imports fail lint, not code review
|
|
14
|
-
* 🧩 **Two templates** — Next.js App Router · plain React (Vite + react-router)
|
|
15
|
-
* 🤖 **Agentic by default** — AGENTS.md contract with CI drift-check, step-by-step agent procedures, navigation skill for external agents
|
|
16
|
-
* 🚀 **Self-demonstrating** — the docs site is itself built on FSAA
|
|
17
|
-
* 🏭 **Production-proven** — internal financial tool, real daily users
|
|
18
|
-
* 📖 **Inspectable without NDA** — open code, open docs, open issues
|
|
19
|
-
|
|
20
|
-
<div align="center">
|
|
21
|
-
|
|
22
|
-
**[Read the docs →](https://aramex86.github.io/fsaa/)** · **[Next.js template →](https://github.com/Aramex86/fsaa-next)** · **[Plain React template →](https://github.com/Aramex86/fsaa-vite)**
|
|
23
|
-
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
FSAA is not a new architecture theory. It is a practical, opinionated assembly of two proven methods — Feature-Sliced Design and Atomic Design — with the missing decision rules added. We do not claim a revolution.
|
|
27
|
-
|
|
28
|
-
## Status
|
|
29
|
-
|
|
30
|
-
> **Phase 0–2 (done):** methodology frozen, docs site live and indexed, starter templates shipped — [fsaa-next](https://github.com/Aramex86/fsaa-next) (Next.js App Router) and [fsaa-vite](https://github.com/Aramex86/fsaa-vite) (plain React) with **ESLint-enforced layer boundaries**: wrong imports fail lint, not code review. **Phase 3 (in progress):** the agentic machine — an [AGENTS.md contract](https://github.com/Aramex86/fsaa-next/blob/main/AGENTS.md) where every rule carries a CI check marker, a **drift-check** that fails the build when docs and code drift apart, `agents/` step-by-step procedures, and [`where-ui-goes`](https://github.com/Aramex86/fsaa-next/blob/main/agents/where-ui-goes.md) — a navigation skill for external agents ([how it works →](https://aramex86.github.io/fsaa/agentic/)).
|
|
31
|
-
|
|
32
|
-
Used in production (internal tool) with real daily users — and **self-demonstrating**: this documentation site is itself built on FSAA (features/entities/shared, thin routes), so the architecture is inspectable without NDA. Both templates clone the same structure with working Projects/Orders examples. Public example app — Phase 2.
|
|
33
|
-
|
|
34
|
-
## The problem
|
|
35
|
-
|
|
36
|
-
Every frontend developer on a medium+ project hits the same wall: **"where do I put this component?"**
|
|
37
|
-
|
|
38
|
-
- Feature-Sliced Design (FSD) answers *where does code live and how does it access business logic* — but is silent on UI composition, and its `widgets` layer is controversial.
|
|
39
|
-
- Atomic Design answers *how does a component look and compose* (atoms → molecules → organisms) — but says nothing about business logic, and `organisms/` folders tend to become dumping grounds.
|
|
40
|
-
- Bulletproof React is a set of good advice, not an architecture — nothing enforces boundaries.
|
|
41
|
-
|
|
42
|
-
FSAA combines them additively and adds the three missing decision rules.
|
|
43
|
-
|
|
44
|
-
## The layer stack
|
|
45
|
-
|
|
46
|
-
Imports flow **only downward**, with **no layer skipping** and **no circular dependencies**. Every module exposes a public API via `index.ts`.
|
|
47
|
-
|
|
48
|
-
| Layer | Responsibility | Can import from |
|
|
49
|
-
|---|---|---|
|
|
50
|
-
| `app` | Router, providers, global config, initialization | `shared` only |
|
|
51
|
-
| `pages` | Route-level compositions | `features`, `shared` |
|
|
52
|
-
| `features` | User scenarios **and** large page-level blocks | `entities`, `shared` |
|
|
53
|
-
| `entities` | Business models + data access | `shared` |
|
|
54
|
-
| `shared` | Design tokens, generic UI primitives, utilities | external libs only |
|
|
55
|
-
|
|
56
|
-
There is deliberately **no `widgets` layer** — features double as page-level blocks. One decision less per component.
|
|
57
|
-
|
|
58
|
-
### FSAA & Next.js App Router
|
|
59
|
-
|
|
60
|
-
Next.js names collide with FSAA layers: its `app/` folder holds routes and `pages/` is the Pages Router. Renaming layers to `_app`/`_pages` (the standard FSD workaround) is not needed in FSAA. Instead, **the `pages` layer is replaced by the App Router itself** — route files are the page compositions:
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
src/
|
|
64
|
-
features/ # user scenarios incl. large page-level blocks
|
|
65
|
-
entities/ # business models + data access
|
|
66
|
-
shared/ # tokens, atoms/molecules, utilities
|
|
67
|
-
app/
|
|
68
|
-
dashboard/page.tsx # thin: import DashboardOverview, render, wrap in <Suspense>
|
|
69
|
-
orders/page.tsx # thin: import OrdersOverview, render, wrap in <Suspense>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
A thin route file (import → render → Suspense) **is** the page composition — no `_app`/`_pages` prefixes, no lint conflict. Everything else works unchanged: the three decision rules and the layer stack above.
|
|
73
|
-
|
|
74
|
-
## Three decision rules (the actual value)
|
|
75
|
-
|
|
76
|
-
### 1. The Graduation pattern
|
|
77
|
-
|
|
78
|
-
Feature-local UI lives **flat** in `features/<name>/ui/` — 5–10 components, no Atomic Design inside a feature, the scope is already narrow. When a component proves reusable **in another feature**, it graduates: promoted to `shared/ui` and reorganized into atoms/molecules.
|
|
79
|
-
|
|
80
|
-
Features own their UI until it earns sharing.
|
|
81
|
-
|
|
82
|
-
**Mechanics.** The trigger is objective — a component is needed by a *second independent feature*. The first duplicate is legal: one copy is a signal, not a catastrophe. Promotion = **one PR**: the component moves to `shared/ui/molecules/`, both features import it from the shared public API (`index.ts`), and the feature-local copies are deleted inside that same changeset. Cross-feature imports are a lint error, so a copy-pasted component fails CI — drift cannot hide, the only legal cross-feature sources are entities (data) and shared (UI). (The starter templates ship this enforcement — see Phase 2 in the roadmap.)
|
|
83
|
-
|
|
84
|
-
### 2. The boundary test for `shared`
|
|
85
|
-
|
|
86
|
-
> *If I removed this component from the app entirely, could it still be described without mentioning users, orders, or projects?*
|
|
87
|
-
|
|
88
|
-
Yes → `shared`. No → feature. A generic `DataTable` passes this test; `projectColumns` does not.
|
|
89
|
-
|
|
90
|
-
### 3. Organisms are eliminated
|
|
91
|
-
|
|
92
|
-
A large composition — what Atomic Design would call an organism — **is a feature**. The Presentational/Container split happens at the export level (one file may export both `UserListContainer` and `UserList`), not the filesystem level.
|
|
93
|
-
|
|
94
|
-
## Atomic Design placement
|
|
95
|
-
|
|
96
|
-
Atomic levels live **inside `shared/ui` only**:
|
|
97
|
-
|
|
98
|
-
| Level | Location | Examples |
|
|
99
|
-
|---|---|---|
|
|
100
|
-
| Atoms | `shared/ui/atoms` | `Button`, `Input`, `TableCell` |
|
|
101
|
-
| Molecules | `shared/ui/molecules` | `DataTable`, `FormRow`, `SearchField` |
|
|
102
|
-
|
|
103
|
-
## Canonical example: one table, two entities
|
|
104
|
-
|
|
105
|
-
```
|
|
106
|
-
src/
|
|
107
|
-
shared/ui/atoms/TableCell.tsx
|
|
108
|
-
shared/ui/atoms/TableHeaderCell.tsx
|
|
109
|
-
shared/ui/molecules/table/DataTable.tsx # generic: columns, data, isLoading
|
|
110
|
-
entities/project/ # project data access + types
|
|
111
|
-
entities/order/ # order data access + types
|
|
112
|
-
features/projects-overview/
|
|
113
|
-
config/projectColumns.tsx # columns from shared atoms + feature actions
|
|
114
|
-
ui/ProjectsOverview.tsx # wires useProjects + projectColumns + DataTable
|
|
115
|
-
features/orders-overview/
|
|
116
|
-
config/orderColumns.tsx
|
|
117
|
-
ui/OrdersOverview.tsx
|
|
118
|
-
pages/ProjectsPage.tsx # renders ProjectsOverview
|
|
119
|
-
pages/OrdersPage.tsx # renders OrdersOverview
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
**The rule:** the table stays generic; business-specific columns live in their features. If two entities need the same visual pattern, extract the pattern into `shared` — keep the entity-specific configuration in `features`.
|
|
123
|
-
|
|
124
|
-
**Runnable code:** this exact structure ships in the starter templates — [fsaa-next (Next.js App Router)](https://github.com/Aramex86/fsaa-next) and [fsaa-vite (plain React SPA)](https://github.com/Aramex86/fsaa-vite), both with the Projects/Orders example working (`npm run dev` → `/projects`, `/orders`). A step-by-step trace lives in the [docs' worked example](https://aramex86.github.io/fsaa/example/).
|
|
125
|
-
|
|
126
|
-
## Comparison
|
|
127
|
-
|
|
128
|
-
| Method | What it answers | What it misses |
|
|
129
|
-
|---|---|---|
|
|
130
|
-
| **FSAA** | Where UI goes + where code lives + how UI composes | — (this is the assembly) |
|
|
131
|
-
| FSD | Where code lives, import boundaries | Where UI goes; `widgets` is controversial; high entry threshold |
|
|
132
|
-
| Atomic Design | How components look and compose | Nothing about business logic; `organisms/` becomes a dumping ground |
|
|
133
|
-
| Bulletproof React | Good defaults per concern | No enforced boundaries — not an architecture |
|
|
134
|
-
|
|
135
|
-
**"Isn't this just FSD + Atomic Design?"** — Yes, deliberately. The value is not novelty; it is the three decision rules neither method provides: graduation, the boundary test, no organisms.
|
|
136
|
-
|
|
137
|
-
## When to use it
|
|
138
|
-
|
|
139
|
-
**Good fit:** medium+ projects, teams of 3+, long-lived products, design-system-driven UI.
|
|
140
|
-
|
|
141
|
-
**Not a fit:** throwaway prototypes, MVPs with a 2-week lifespan, tiny apps where folder structure is not the bottleneck.
|
|
142
|
-
|
|
143
|
-
## Roadmap
|
|
144
|
-
|
|
145
|
-
| Phase | Focus | Status |
|
|
146
|
-
|---|---|---|
|
|
147
|
-
| 0 | Repo, honest README, CONTRIBUTING | ✅ done (this repo) |
|
|
148
|
-
| 1 | Docs site (indexable: OG, sitemap, GSC) | ✅ [aramex86.github.io/fsaa](https://aramex86.github.io/fsaa/) |
|
|
149
|
-
| 2 | Boilerplate — two templates: [Next.js App Router](https://github.com/Aramex86/fsaa-next) + [plain React (Vite)](https://github.com/Aramex86/fsaa-vite), ESLint-enforced boundaries, Projects/Orders example | ✅ done |
|
|
150
|
-
| 3 | Agentic layer — AGENTS.md contract, CI drift-check, `agents/` procedures, external-agent skill | ✅ done ([docs](https://aramex86.github.io/fsaa/agentic/)) |
|
|
151
|
-
| 4 | CLI — `npm create fsaa@latest` (scaffolds next/vite) + `fsaa g
|
|
152
|
-
| 5 | Promotion, adoption feedback loop | — |
|
|
153
|
-
|
|
154
|
-
## Contributing
|
|
155
|
-
|
|
156
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md). Questions about a component's place in the structure are the most valuable contributions — open an issue with your case.
|
|
157
|
-
|
|
158
|
-
## License
|
|
159
|
-
|
|
160
|
-
MIT © Veaceslav Bezusco
|
|
1
|
+
<img width="814" height="243" alt="image" src="https://github.com/user-attachments/assets/047ea0c4-ae54-43f1-9dd9-2a8805839ed0" />
|
|
2
|
+
|
|
3
|
+
# FSAA — Feature-Sliced Atomic Architecture ⚡
|
|
4
|
+
|
|
5
|
+
> **FSD + Atomic Design with the missing decision rules: *where does UI go?***
|
|
6
|
+
|
|
7
|
+
[](https://aramex86.github.io/fsaa/)
|
|
8
|
+
[](https://aramex86.github.io/fsaa/)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
* 💡 **Three decision rules** — graduation, boundary test, organisms eliminated
|
|
13
|
+
* 🔒 **ESLint-enforced boundaries** — wrong imports fail lint, not code review
|
|
14
|
+
* 🧩 **Two templates** — Next.js App Router · plain React (Vite + react-router)
|
|
15
|
+
* 🤖 **Agentic by default** — AGENTS.md contract with CI drift-check, step-by-step agent procedures, navigation skill for external agents
|
|
16
|
+
* 🚀 **Self-demonstrating** — the docs site is itself built on FSAA
|
|
17
|
+
* 🏭 **Production-proven** — internal financial tool, real daily users
|
|
18
|
+
* 📖 **Inspectable without NDA** — open code, open docs, open issues
|
|
19
|
+
|
|
20
|
+
<div align="center">
|
|
21
|
+
|
|
22
|
+
**[Read the docs →](https://aramex86.github.io/fsaa/)** · **[Next.js template →](https://github.com/Aramex86/fsaa-next)** · **[Plain React template →](https://github.com/Aramex86/fsaa-vite)**
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
FSAA is not a new architecture theory. It is a practical, opinionated assembly of two proven methods — Feature-Sliced Design and Atomic Design — with the missing decision rules added. We do not claim a revolution.
|
|
27
|
+
|
|
28
|
+
## Status
|
|
29
|
+
|
|
30
|
+
> **Phase 0–2 (done):** methodology frozen, docs site live and indexed, starter templates shipped — [fsaa-next](https://github.com/Aramex86/fsaa-next) (Next.js App Router) and [fsaa-vite](https://github.com/Aramex86/fsaa-vite) (plain React) with **ESLint-enforced layer boundaries**: wrong imports fail lint, not code review. **Phase 3 (in progress):** the agentic machine — an [AGENTS.md contract](https://github.com/Aramex86/fsaa-next/blob/main/AGENTS.md) where every rule carries a CI check marker, a **drift-check** that fails the build when docs and code drift apart, `agents/` step-by-step procedures, and [`where-ui-goes`](https://github.com/Aramex86/fsaa-next/blob/main/agents/where-ui-goes.md) — a navigation skill for external agents ([how it works →](https://aramex86.github.io/fsaa/agentic/)).
|
|
31
|
+
|
|
32
|
+
Used in production (internal tool) with real daily users — and **self-demonstrating**: this documentation site is itself built on FSAA (features/entities/shared, thin routes), so the architecture is inspectable without NDA. Both templates clone the same structure with working Projects/Orders examples. Public example app — Phase 2.
|
|
33
|
+
|
|
34
|
+
## The problem
|
|
35
|
+
|
|
36
|
+
Every frontend developer on a medium+ project hits the same wall: **"where do I put this component?"**
|
|
37
|
+
|
|
38
|
+
- Feature-Sliced Design (FSD) answers *where does code live and how does it access business logic* — but is silent on UI composition, and its `widgets` layer is controversial.
|
|
39
|
+
- Atomic Design answers *how does a component look and compose* (atoms → molecules → organisms) — but says nothing about business logic, and `organisms/` folders tend to become dumping grounds.
|
|
40
|
+
- Bulletproof React is a set of good advice, not an architecture — nothing enforces boundaries.
|
|
41
|
+
|
|
42
|
+
FSAA combines them additively and adds the three missing decision rules.
|
|
43
|
+
|
|
44
|
+
## The layer stack
|
|
45
|
+
|
|
46
|
+
Imports flow **only downward**, with **no layer skipping** and **no circular dependencies**. Every module exposes a public API via `index.ts`.
|
|
47
|
+
|
|
48
|
+
| Layer | Responsibility | Can import from |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| `app` | Router, providers, global config, initialization | `shared` only |
|
|
51
|
+
| `pages` | Route-level compositions | `features`, `shared` |
|
|
52
|
+
| `features` | User scenarios **and** large page-level blocks | `entities`, `shared` |
|
|
53
|
+
| `entities` | Business models + data access | `shared` |
|
|
54
|
+
| `shared` | Design tokens, generic UI primitives, utilities | external libs only |
|
|
55
|
+
|
|
56
|
+
There is deliberately **no `widgets` layer** — features double as page-level blocks. One decision less per component.
|
|
57
|
+
|
|
58
|
+
### FSAA & Next.js App Router
|
|
59
|
+
|
|
60
|
+
Next.js names collide with FSAA layers: its `app/` folder holds routes and `pages/` is the Pages Router. Renaming layers to `_app`/`_pages` (the standard FSD workaround) is not needed in FSAA. Instead, **the `pages` layer is replaced by the App Router itself** — route files are the page compositions:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
src/
|
|
64
|
+
features/ # user scenarios incl. large page-level blocks
|
|
65
|
+
entities/ # business models + data access
|
|
66
|
+
shared/ # tokens, atoms/molecules, utilities
|
|
67
|
+
app/
|
|
68
|
+
dashboard/page.tsx # thin: import DashboardOverview, render, wrap in <Suspense>
|
|
69
|
+
orders/page.tsx # thin: import OrdersOverview, render, wrap in <Suspense>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A thin route file (import → render → Suspense) **is** the page composition — no `_app`/`_pages` prefixes, no lint conflict. Everything else works unchanged: the three decision rules and the layer stack above.
|
|
73
|
+
|
|
74
|
+
## Three decision rules (the actual value)
|
|
75
|
+
|
|
76
|
+
### 1. The Graduation pattern
|
|
77
|
+
|
|
78
|
+
Feature-local UI lives **flat** in `features/<name>/ui/` — 5–10 components, no Atomic Design inside a feature, the scope is already narrow. When a component proves reusable **in another feature**, it graduates: promoted to `shared/ui` and reorganized into atoms/molecules.
|
|
79
|
+
|
|
80
|
+
Features own their UI until it earns sharing.
|
|
81
|
+
|
|
82
|
+
**Mechanics.** The trigger is objective — a component is needed by a *second independent feature*. The first duplicate is legal: one copy is a signal, not a catastrophe. Promotion = **one PR**: the component moves to `shared/ui/molecules/`, both features import it from the shared public API (`index.ts`), and the feature-local copies are deleted inside that same changeset. Cross-feature imports are a lint error, so a copy-pasted component fails CI — drift cannot hide, the only legal cross-feature sources are entities (data) and shared (UI). (The starter templates ship this enforcement — see Phase 2 in the roadmap.)
|
|
83
|
+
|
|
84
|
+
### 2. The boundary test for `shared`
|
|
85
|
+
|
|
86
|
+
> *If I removed this component from the app entirely, could it still be described without mentioning users, orders, or projects?*
|
|
87
|
+
|
|
88
|
+
Yes → `shared`. No → feature. A generic `DataTable` passes this test; `projectColumns` does not.
|
|
89
|
+
|
|
90
|
+
### 3. Organisms are eliminated
|
|
91
|
+
|
|
92
|
+
A large composition — what Atomic Design would call an organism — **is a feature**. The Presentational/Container split happens at the export level (one file may export both `UserListContainer` and `UserList`), not the filesystem level.
|
|
93
|
+
|
|
94
|
+
## Atomic Design placement
|
|
95
|
+
|
|
96
|
+
Atomic levels live **inside `shared/ui` only**:
|
|
97
|
+
|
|
98
|
+
| Level | Location | Examples |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| Atoms | `shared/ui/atoms` | `Button`, `Input`, `TableCell` |
|
|
101
|
+
| Molecules | `shared/ui/molecules` | `DataTable`, `FormRow`, `SearchField` |
|
|
102
|
+
|
|
103
|
+
## Canonical example: one table, two entities
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
src/
|
|
107
|
+
shared/ui/atoms/TableCell.tsx
|
|
108
|
+
shared/ui/atoms/TableHeaderCell.tsx
|
|
109
|
+
shared/ui/molecules/table/DataTable.tsx # generic: columns, data, isLoading
|
|
110
|
+
entities/project/ # project data access + types
|
|
111
|
+
entities/order/ # order data access + types
|
|
112
|
+
features/projects-overview/
|
|
113
|
+
config/projectColumns.tsx # columns from shared atoms + feature actions
|
|
114
|
+
ui/ProjectsOverview.tsx # wires useProjects + projectColumns + DataTable
|
|
115
|
+
features/orders-overview/
|
|
116
|
+
config/orderColumns.tsx
|
|
117
|
+
ui/OrdersOverview.tsx
|
|
118
|
+
pages/ProjectsPage.tsx # renders ProjectsOverview
|
|
119
|
+
pages/OrdersPage.tsx # renders OrdersOverview
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**The rule:** the table stays generic; business-specific columns live in their features. If two entities need the same visual pattern, extract the pattern into `shared` — keep the entity-specific configuration in `features`.
|
|
123
|
+
|
|
124
|
+
**Runnable code:** this exact structure ships in the starter templates — [fsaa-next (Next.js App Router)](https://github.com/Aramex86/fsaa-next) and [fsaa-vite (plain React SPA)](https://github.com/Aramex86/fsaa-vite), both with the Projects/Orders example working (`npm run dev` → `/projects`, `/orders`). A step-by-step trace lives in the [docs' worked example](https://aramex86.github.io/fsaa/example/).
|
|
125
|
+
|
|
126
|
+
## Comparison
|
|
127
|
+
|
|
128
|
+
| Method | What it answers | What it misses |
|
|
129
|
+
|---|---|---|
|
|
130
|
+
| **FSAA** | Where UI goes + where code lives + how UI composes | — (this is the assembly) |
|
|
131
|
+
| FSD | Where code lives, import boundaries | Where UI goes; `widgets` is controversial; high entry threshold |
|
|
132
|
+
| Atomic Design | How components look and compose | Nothing about business logic; `organisms/` becomes a dumping ground |
|
|
133
|
+
| Bulletproof React | Good defaults per concern | No enforced boundaries — not an architecture |
|
|
134
|
+
|
|
135
|
+
**"Isn't this just FSD + Atomic Design?"** — Yes, deliberately. The value is not novelty; it is the three decision rules neither method provides: graduation, the boundary test, no organisms.
|
|
136
|
+
|
|
137
|
+
## When to use it
|
|
138
|
+
|
|
139
|
+
**Good fit:** medium+ projects, teams of 3+, long-lived products, design-system-driven UI.
|
|
140
|
+
|
|
141
|
+
**Not a fit:** throwaway prototypes, MVPs with a 2-week lifespan, tiny apps where folder structure is not the bottleneck.
|
|
142
|
+
|
|
143
|
+
## Roadmap
|
|
144
|
+
|
|
145
|
+
| Phase | Focus | Status |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| 0 | Repo, honest README, CONTRIBUTING | ✅ done (this repo) |
|
|
148
|
+
| 1 | Docs site (indexable: OG, sitemap, GSC) | ✅ [aramex86.github.io/fsaa](https://aramex86.github.io/fsaa/) |
|
|
149
|
+
| 2 | Boilerplate — two templates: [Next.js App Router](https://github.com/Aramex86/fsaa-next) + [plain React (Vite)](https://github.com/Aramex86/fsaa-vite), ESLint-enforced boundaries, Projects/Orders example | ✅ done |
|
|
150
|
+
| 3 | Agentic layer — AGENTS.md contract, CI drift-check, `agents/` procedures, external-agent skill | ✅ done ([docs](https://aramex86.github.io/fsaa/agentic/)) |
|
|
151
|
+
| 4 | CLI — `npm create fsaa@latest` (scaffolds next/vite) + `fsaa g` generators (pair, entity, feature, atom, molecule, page) | 🟢 core shipped ([`fsaa` repo](https://github.com/Aramex86/fsaa)); npm registry package next |
|
|
152
|
+
| 5 | Promotion, adoption feedback loop | — |
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
|
|
156
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md). Questions about a component's place in the structure are the most valuable contributions — open an issue with your case.
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT © Veaceslav Bezusco
|
package/bin/fsaa.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* FSAA CLI — scaffold apps from the official starters and generate canonical slices. */
|
|
3
|
-
import { run } from "../lib/cli.mjs";
|
|
4
|
-
run(process.argv.slice(2)).then(
|
|
5
|
-
(code) => process.exit(code),
|
|
6
|
-
(err) => {
|
|
7
|
-
if (err && err.userError) {
|
|
8
|
-
console.error("fsaa: " + (err.message || "invalid input"));
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
console.error("fsaa: unexpected error");
|
|
12
|
-
if (err && err.stack) console.error(err.stack.split("\n").slice(0, 3).join("\n"));
|
|
13
|
-
else console.error(String(err));
|
|
14
|
-
process.exit(1);
|
|
15
|
-
},
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* FSAA CLI — scaffold apps from the official starters and generate canonical slices. */
|
|
3
|
+
import { run } from "../lib/cli.mjs";
|
|
4
|
+
run(process.argv.slice(2)).then(
|
|
5
|
+
(code) => process.exit(code),
|
|
6
|
+
(err) => {
|
|
7
|
+
if (err && err.userError) {
|
|
8
|
+
console.error("fsaa: " + (err.message || "invalid input"));
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
console.error("fsaa: unexpected error");
|
|
12
|
+
if (err && err.stack) console.error(err.stack.split("\n").slice(0, 3).join("\n"));
|
|
13
|
+
else console.error(String(err));
|
|
14
|
+
process.exit(1);
|
|
15
|
+
},
|
|
16
16
|
);
|
package/lib/cli.mjs
CHANGED
|
@@ -1,93 +1,98 @@
|
|
|
1
|
-
/* fsaa/lib/cli.mjs — command dispatch, flag parsing, interactive prompts (zero deps). */
|
|
2
|
-
import readline from "node:readline/promises";
|
|
3
|
-
import { stdin, stdout } from "node:process";
|
|
4
|
-
import { initCmd } from "./init.mjs";
|
|
5
|
-
import { generateCmd } from "./generate.mjs";
|
|
6
|
-
|
|
7
|
-
export function parseFlags(argv) {
|
|
8
|
-
const flags = {};
|
|
9
|
-
const rest = [];
|
|
10
|
-
for (let i = 0; i < argv.length; i++) {
|
|
11
|
-
const a = argv[i];
|
|
12
|
-
if (a.startsWith("--")) {
|
|
13
|
-
const k = a.slice(2);
|
|
14
|
-
const next = argv[i + 1];
|
|
15
|
-
if (next === undefined || next.startsWith("--")) {
|
|
16
|
-
flags[k] = true; // boolean flag
|
|
17
|
-
} else {
|
|
18
|
-
flags[k] = next;
|
|
19
|
-
i++;
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
rest.push(a);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return { flags, rest };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function isInteractive() {
|
|
29
|
-
return stdin.isTTY === true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function prompt(question, fallback = "") {
|
|
33
|
-
const rl = readline.createInterface({ input: stdin, output: stdout });
|
|
34
|
-
try {
|
|
35
|
-
const answer = await rl.question(question);
|
|
36
|
-
return answer.trim() || fallback;
|
|
37
|
-
} finally {
|
|
38
|
-
rl.close();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const HELP = `FSAA CLI v0.
|
|
43
|
-
(npm package: create-fsaa — run it as: npm create fsaa@latest)
|
|
44
|
-
|
|
45
|
-
init Scaffold a new app from an official FSAA starter template
|
|
46
|
-
g Generate
|
|
47
|
-
help Show this help
|
|
48
|
-
|
|
49
|
-
init usage:
|
|
50
|
-
fsaa init # interactive (name, template)
|
|
51
|
-
npx create-fsaa my-app # positional name (create-app convention)
|
|
52
|
-
fsaa init --name my-app --template vite # non-interactive
|
|
53
|
-
(no TTY -> defaults my-app / next; manager is contract-pinned: pnpm)
|
|
54
|
-
|
|
55
|
-
g usage (run inside a project scaffolded by fsaa init):
|
|
56
|
-
fsaa g <slice-name>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
case "
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
return
|
|
79
|
-
}
|
|
80
|
-
case "
|
|
81
|
-
case "
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1
|
+
/* fsaa/lib/cli.mjs — command dispatch, flag parsing, interactive prompts (zero deps). */
|
|
2
|
+
import readline from "node:readline/promises";
|
|
3
|
+
import { stdin, stdout } from "node:process";
|
|
4
|
+
import { initCmd } from "./init.mjs";
|
|
5
|
+
import { generateCmd } from "./generate.mjs";
|
|
6
|
+
|
|
7
|
+
export function parseFlags(argv) {
|
|
8
|
+
const flags = {};
|
|
9
|
+
const rest = [];
|
|
10
|
+
for (let i = 0; i < argv.length; i++) {
|
|
11
|
+
const a = argv[i];
|
|
12
|
+
if (a.startsWith("--")) {
|
|
13
|
+
const k = a.slice(2);
|
|
14
|
+
const next = argv[i + 1];
|
|
15
|
+
if (next === undefined || next.startsWith("--")) {
|
|
16
|
+
flags[k] = true; // boolean flag
|
|
17
|
+
} else {
|
|
18
|
+
flags[k] = next;
|
|
19
|
+
i++;
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
rest.push(a);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return { flags, rest };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function isInteractive() {
|
|
29
|
+
return stdin.isTTY === true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export async function prompt(question, fallback = "") {
|
|
33
|
+
const rl = readline.createInterface({ input: stdin, output: stdout });
|
|
34
|
+
try {
|
|
35
|
+
const answer = await rl.question(question);
|
|
36
|
+
return answer.trim() || fallback;
|
|
37
|
+
} finally {
|
|
38
|
+
rl.close();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const HELP = `FSAA CLI v0.2 — Feature-Sliced Atomic Architecture
|
|
43
|
+
(npm package: create-fsaa — run it as: npm create fsaa@latest)
|
|
44
|
+
|
|
45
|
+
init Scaffold a new app from an official FSAA starter template
|
|
46
|
+
g Generate canonical FSAA entities inside an existing FSAA app
|
|
47
|
+
help Show this help
|
|
48
|
+
|
|
49
|
+
init usage:
|
|
50
|
+
fsaa init # interactive (name, template)
|
|
51
|
+
npx create-fsaa my-app # positional name (create-app convention)
|
|
52
|
+
fsaa init --name my-app --template vite # non-interactive
|
|
53
|
+
(no TTY -> defaults my-app / next; manager is contract-pinned: pnpm)
|
|
54
|
+
|
|
55
|
+
g usage (run inside a project scaffolded by fsaa init):
|
|
56
|
+
fsaa g <slice-name> # pair: entity + feature + thin route (e.g. fsaa g checkout)
|
|
57
|
+
fsaa g entity <noun> # entity only: index/types/api/slice/__tests__
|
|
58
|
+
fsaa g feature <name> # feature only: index/ui/config/__tests__
|
|
59
|
+
fsaa g atom <Name> # shared/ui/atoms/<Name>.tsx (stateless primitive)
|
|
60
|
+
fsaa g molecule <Name> # shared/ui/molecules/<Name>/ (+ graduation hint)
|
|
61
|
+
fsaa g page <name> [route] # thin page composing an existing feature
|
|
62
|
+
|
|
63
|
+
Docs: https://aramex86.github.io/fsaa`;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
async function unknown(cmd) {
|
|
67
|
+
console.error(`fsaa: unknown command "${cmd}" — run "fsaa help" for usage.`);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function run(argv) {
|
|
72
|
+
const [cmd, ...rest] = argv;
|
|
73
|
+
const { flags } = parseFlags(rest);
|
|
74
|
+
switch (cmd) {
|
|
75
|
+
case "init": {
|
|
76
|
+
const { flags: f2, rest: positionals } = parseFlags(rest);
|
|
77
|
+
if (positionals.length && !f2.name && typeof f2.name !== "string") f2.name = positionals[0]; // create-app convention: npx create-fsaa my-app
|
|
78
|
+
return initCmd({ flags: { ...flags, ...f2 }, interactive: isInteractive() });
|
|
79
|
+
}
|
|
80
|
+
case "g":
|
|
81
|
+
case "generate": {
|
|
82
|
+
const { rest: positionals } = parseFlags(rest);
|
|
83
|
+
return generateCmd({ args: positionals, flags, interactive: isInteractive() });
|
|
84
|
+
}
|
|
85
|
+
case "help":
|
|
86
|
+
case "--help":
|
|
87
|
+
case "-h":
|
|
88
|
+
console.log(HELP);
|
|
89
|
+
return 0;
|
|
90
|
+
default:
|
|
91
|
+
if (!cmd) {
|
|
92
|
+
// `npm create fsaa@latest` invokes the bin with NO arguments — the
|
|
93
|
+
// create-* convention is that this STARTS the scaffold, like create-vite.
|
|
94
|
+
return initCmd({ flags, interactive: isInteractive() });
|
|
95
|
+
}
|
|
96
|
+
return unknown(cmd);
|
|
97
|
+
}
|
|
93
98
|
}
|