@teispace/next-maker 1.11.1 → 1.13.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.
Files changed (134) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +222 -271
  3. package/dist/index.js +353 -225
  4. package/dist/index.js.map +4 -4
  5. package/dist/src/commands/component.d.ts +3 -0
  6. package/dist/src/commands/component.d.ts.map +1 -0
  7. package/dist/src/commands/feature.d.ts.map +1 -1
  8. package/dist/src/commands/hook.d.ts +3 -0
  9. package/dist/src/commands/hook.d.ts.map +1 -0
  10. package/dist/src/commands/index.d.ts.map +1 -1
  11. package/dist/src/commands/locale.d.ts +3 -0
  12. package/dist/src/commands/locale.d.ts.map +1 -0
  13. package/dist/src/commands/page.d.ts +3 -0
  14. package/dist/src/commands/page.d.ts.map +1 -0
  15. package/dist/src/commands/service.d.ts.map +1 -1
  16. package/dist/src/commands/slice.d.ts.map +1 -1
  17. package/dist/src/config/paths.d.ts +4 -0
  18. package/dist/src/config/paths.d.ts.map +1 -1
  19. package/dist/src/detection/existence.checker.d.ts +9 -0
  20. package/dist/src/detection/existence.checker.d.ts.map +1 -0
  21. package/dist/src/detection/index.d.ts +4 -0
  22. package/dist/src/detection/index.d.ts.map +1 -0
  23. package/dist/src/{services/feature/detection.service.d.ts → detection/project.detector.d.ts} +1 -2
  24. package/dist/src/detection/project.detector.d.ts.map +1 -0
  25. package/dist/src/generators/component.generator.d.ts +9 -0
  26. package/dist/src/generators/component.generator.d.ts.map +1 -0
  27. package/dist/src/generators/crud-service.generator.d.ts +6 -0
  28. package/dist/src/generators/crud-service.generator.d.ts.map +1 -0
  29. package/dist/src/generators/feature.generator.d.ts +7 -0
  30. package/dist/src/generators/feature.generator.d.ts.map +1 -0
  31. package/dist/src/generators/hook.generator.d.ts +8 -0
  32. package/dist/src/generators/hook.generator.d.ts.map +1 -0
  33. package/dist/src/generators/index.d.ts +14 -0
  34. package/dist/src/generators/index.d.ts.map +1 -0
  35. package/dist/src/generators/locale.generator.d.ts +10 -0
  36. package/dist/src/generators/locale.generator.d.ts.map +1 -0
  37. package/dist/src/generators/page.generator.d.ts +10 -0
  38. package/dist/src/generators/page.generator.d.ts.map +1 -0
  39. package/dist/src/generators/service.generator.d.ts +6 -0
  40. package/dist/src/generators/service.generator.d.ts.map +1 -0
  41. package/dist/src/generators/slice.generator.d.ts +11 -0
  42. package/dist/src/generators/slice.generator.d.ts.map +1 -0
  43. package/dist/src/generators/templates/barrel.template.d.ts +12 -0
  44. package/dist/src/generators/templates/barrel.template.d.ts.map +1 -0
  45. package/dist/src/generators/templates/component.template.d.ts +5 -0
  46. package/dist/src/generators/templates/component.template.d.ts.map +1 -0
  47. package/dist/src/generators/templates/crud-service.template.d.ts +10 -0
  48. package/dist/src/generators/templates/crud-service.template.d.ts.map +1 -0
  49. package/dist/src/generators/templates/custom-hook.template.d.ts +5 -0
  50. package/dist/src/generators/templates/custom-hook.template.d.ts.map +1 -0
  51. package/dist/src/generators/templates/hook.template.d.ts +9 -0
  52. package/dist/src/generators/templates/hook.template.d.ts.map +1 -0
  53. package/dist/src/generators/templates/page.template.d.ts +18 -0
  54. package/dist/src/generators/templates/page.template.d.ts.map +1 -0
  55. package/dist/src/generators/templates/persist.template.d.ts +6 -0
  56. package/dist/src/generators/templates/persist.template.d.ts.map +1 -0
  57. package/dist/src/generators/templates/selectors.template.d.ts +6 -0
  58. package/dist/src/generators/templates/selectors.template.d.ts.map +1 -0
  59. package/dist/src/generators/templates/service.template.d.ts +5 -0
  60. package/dist/src/generators/templates/service.template.d.ts.map +1 -0
  61. package/dist/src/generators/templates/shared-component.template.d.ts +10 -0
  62. package/dist/src/generators/templates/shared-component.template.d.ts.map +1 -0
  63. package/dist/src/generators/templates/slice.template.d.ts +6 -0
  64. package/dist/src/generators/templates/slice.template.d.ts.map +1 -0
  65. package/dist/src/generators/templates/types.template.d.ts +5 -0
  66. package/dist/src/generators/templates/types.template.d.ts.map +1 -0
  67. package/dist/src/generators/types.d.ts +19 -0
  68. package/dist/src/generators/types.d.ts.map +1 -0
  69. package/dist/src/modifiers/api-registration.modifier.d.ts +6 -0
  70. package/dist/src/modifiers/api-registration.modifier.d.ts.map +1 -0
  71. package/dist/src/modifiers/app-paths.modifier.d.ts +5 -0
  72. package/dist/src/modifiers/app-paths.modifier.d.ts.map +1 -0
  73. package/dist/src/modifiers/crud-api-registration.modifier.d.ts +5 -0
  74. package/dist/src/modifiers/crud-api-registration.modifier.d.ts.map +1 -0
  75. package/dist/src/modifiers/helpers.d.ts +14 -0
  76. package/dist/src/modifiers/helpers.d.ts.map +1 -0
  77. package/dist/src/modifiers/index.d.ts +7 -0
  78. package/dist/src/modifiers/index.d.ts.map +1 -0
  79. package/dist/src/modifiers/root-reducer.modifier.d.ts +7 -0
  80. package/dist/src/modifiers/root-reducer.modifier.d.ts.map +1 -0
  81. package/dist/src/modifiers/translation.modifier.d.ts +5 -0
  82. package/dist/src/modifiers/translation.modifier.d.ts.map +1 -0
  83. package/dist/src/modifiers/types.d.ts +15 -0
  84. package/dist/src/modifiers/types.d.ts.map +1 -0
  85. package/dist/src/pipelines/feature.pipeline.d.ts +14 -0
  86. package/dist/src/pipelines/feature.pipeline.d.ts.map +1 -0
  87. package/dist/src/pipelines/index.d.ts +9 -0
  88. package/dist/src/pipelines/index.d.ts.map +1 -0
  89. package/dist/src/pipelines/runner.d.ts +7 -0
  90. package/dist/src/pipelines/runner.d.ts.map +1 -0
  91. package/dist/src/pipelines/service.pipeline.d.ts +8 -0
  92. package/dist/src/pipelines/service.pipeline.d.ts.map +1 -0
  93. package/dist/src/pipelines/slice.pipeline.d.ts +9 -0
  94. package/dist/src/pipelines/slice.pipeline.d.ts.map +1 -0
  95. package/dist/src/pipelines/types.d.ts +12 -0
  96. package/dist/src/pipelines/types.d.ts.map +1 -0
  97. package/dist/src/prompts/component.prompt.d.ts +6 -0
  98. package/dist/src/prompts/component.prompt.d.ts.map +1 -0
  99. package/dist/src/prompts/hook.prompt.d.ts +5 -0
  100. package/dist/src/prompts/hook.prompt.d.ts.map +1 -0
  101. package/dist/src/prompts/locale.prompt.d.ts +9 -0
  102. package/dist/src/prompts/locale.prompt.d.ts.map +1 -0
  103. package/dist/src/prompts/page.prompt.d.ts +7 -0
  104. package/dist/src/prompts/page.prompt.d.ts.map +1 -0
  105. package/dist/src/services/init/cleanup/dark-mode.cleanup.d.ts +3 -0
  106. package/dist/src/services/init/cleanup/dark-mode.cleanup.d.ts.map +1 -0
  107. package/dist/src/services/init/cleanup/http.cleanup.d.ts +3 -0
  108. package/dist/src/services/init/cleanup/http.cleanup.d.ts.map +1 -0
  109. package/dist/src/services/init/cleanup/i18n.cleanup.d.ts +3 -0
  110. package/dist/src/services/init/cleanup/i18n.cleanup.d.ts.map +1 -0
  111. package/dist/src/services/init/cleanup/index.d.ts +3 -0
  112. package/dist/src/services/init/cleanup/index.d.ts.map +1 -0
  113. package/dist/src/services/init/cleanup/misc.cleanup.d.ts +13 -0
  114. package/dist/src/services/init/cleanup/misc.cleanup.d.ts.map +1 -0
  115. package/dist/src/services/init/cleanup/redux.cleanup.d.ts +3 -0
  116. package/dist/src/services/init/cleanup/redux.cleanup.d.ts.map +1 -0
  117. package/package.json +9 -7
  118. package/dist/src/services/common/api-registration.service.d.ts +0 -7
  119. package/dist/src/services/common/api-registration.service.d.ts.map +0 -1
  120. package/dist/src/services/feature/detection.service.d.ts.map +0 -1
  121. package/dist/src/services/feature/registration.service.d.ts +0 -6
  122. package/dist/src/services/feature/registration.service.d.ts.map +0 -1
  123. package/dist/src/services/feature/templates.service.d.ts +0 -11
  124. package/dist/src/services/feature/templates.service.d.ts.map +0 -1
  125. package/dist/src/services/init/cleanup.service.d.ts +0 -3
  126. package/dist/src/services/init/cleanup.service.d.ts.map +0 -1
  127. package/dist/src/services/service/detection.service.d.ts +0 -2
  128. package/dist/src/services/service/detection.service.d.ts.map +0 -1
  129. package/dist/src/services/service/service.service.d.ts +0 -8
  130. package/dist/src/services/service/service.service.d.ts.map +0 -1
  131. package/dist/src/services/slice/detection.service.d.ts +0 -2
  132. package/dist/src/services/slice/detection.service.d.ts.map +0 -1
  133. package/dist/src/services/slice/slice.service.d.ts +0 -7
  134. package/dist/src/services/slice/slice.service.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @teispace/next-maker
2
2
 
3
- A powerful CLI tool to scaffold Next.js applications with modern best practices and generate feature-based architecture components including Redux slices and API services.
3
+ A powerful CLI tool to scaffold Next.js applications with modern best practices and generate feature-based architecture components including pages, components, Redux slices, API services, and locales.
4
4
 
5
5
  ## Installation
6
6
 
@@ -31,31 +31,25 @@ npx @teispace/next-maker init [project-name]
31
31
 
32
32
  During initialization, you'll be prompted to configure:
33
33
 
34
- - 📦 **Package Manager** (npm, yarn, pnpm, bun)
35
- - 🔗 **GitHub Repository** (optional - configures remote origin)
36
- - 🌐 **HTTP Client** (axios, fetch, both, or none)
37
- - 🌙 **Dark Mode** (next-themes integration)
38
- - 🔄 **Redux Toolkit** (with redux-persist)
39
- - 🌍 **Internationalization** (next-intl)
40
- - 📋 **Community Files** (CODE_OF_CONDUCT, CONTRIBUTING, etc.)
41
- - 🐳 **Docker** support
42
- - 🔧 **CI/CD** configuration
43
- - 🎯 **Pre-commit hooks** (Husky)
34
+ - **Package Manager** (npm, yarn, pnpm, bun)
35
+ - **GitHub Repository** (optional - configures remote origin)
36
+ - **HTTP Client** (axios, fetch, both, or none)
37
+ - **Dark Mode** (next-themes integration)
38
+ - **Redux Toolkit** (with redux-persist)
39
+ - **Internationalization** (next-intl)
40
+ - **Community Files** (CODE_OF_CONDUCT, CONTRIBUTING, etc.)
41
+ - **Docker** support
42
+ - **CI/CD** configuration
43
+ - **Pre-commit hooks** (Husky)
44
44
 
45
45
  **Core Features:**
46
46
 
47
- - Next.js 16+ with App Router
48
- - 🔷 TypeScript (strict mode)
49
- - 🎨 Tailwind CSS v4
50
- - 📡 Result-based HTTP clients
51
- - 🏗️ Feature-based DDD architecture
52
- - 🎯 ESLint + Prettier configured
53
-
54
- **Example:**
55
-
56
- ```bash
57
- npx @teispace/next-maker init my-awesome-app
58
- ```
47
+ - Next.js 16+ with App Router
48
+ - TypeScript (strict mode)
49
+ - Tailwind CSS v4
50
+ - Result-based HTTP clients
51
+ - Feature-based DDD architecture
52
+ - ESLint + Prettier configured
59
53
 
60
54
  ---
61
55
 
@@ -74,73 +68,97 @@ npx @teispace/next-maker setup [options]
74
68
  - `--redux` - Setup Redux Toolkit with persistence
75
69
  - `--i18n` - Setup next-intl for internationalization
76
70
 
77
- **Features:**
78
-
79
- Each setup command:
80
-
81
- - ✅ Checks if already configured (exits gracefully)
82
- - 📁 Copies necessary files from template
83
- - 🔧 Updates configuration files
84
- - 📦 Installs required packages
85
- - 🔗 Integrates with existing providers
86
-
87
71
  **Examples:**
88
72
 
89
73
  ```bash
90
74
  # Interactive menu
91
75
  npx @teispace/next-maker setup
92
76
 
93
- # Add HTTP clients (Interactive)
77
+ # Add specific features
94
78
  npx @teispace/next-maker setup --http-client
95
-
96
- # Add dark mode
97
79
  npx @teispace/next-maker setup --dark-theme
98
-
99
- # Add Redux
100
80
  npx @teispace/next-maker setup --redux
101
-
102
- # Add internationalization
103
81
  npx @teispace/next-maker setup --i18n
104
82
  ```
105
83
 
106
- **What Gets Setup:**
84
+ ---
85
+
86
+ ### 3. Generate a Page
87
+
88
+ Create a new page/route with locale-aware boilerplate, SEO metadata, and optional loading/error states.
107
89
 
108
- **HTTP Client:**
90
+ ```bash
91
+ npx @teispace/next-maker page <name> [options]
92
+ ```
93
+
94
+ **Options:**
109
95
 
110
- - Copies axios-client and/or fetch-client to `src/lib/utils/http/`
111
- - Updates `src/lib/utils/http/index.ts` with exports
112
- - Installs axios package (if selected)
96
+ - `--dynamic <param>` - Create dynamic route (e.g., `--dynamic id` creates `[id]/page.tsx`)
97
+ - `--loading` - Generate `loading.tsx`
98
+ - `--error` - Generate `error.tsx`
113
99
 
114
- **Dark Theme:**
100
+ **What it generates:**
115
101
 
116
- - Copies `CustomThemeProvider.tsx` to `src/providers/`
117
- - Adds `@custom-variant dark` to `src/styles/globals.css`
118
- - Adds CSS variables `--color-dark` and `--color-light`
119
- - Updates layout.tsx with `bg-light dark:bg-dark` classes
120
- - Integrates with RootProvider
121
- - Installs next-themes package
102
+ - `page.tsx` with full locale support (if i18n is set up), `generateMetadata`, `setRequestLocale`
103
+ - Registers route in `src/lib/config/app-paths.ts`
104
+ - Adds translation namespace to `en.json` (if i18n)
105
+ - Optional `loading.tsx` and `error.tsx`
122
106
 
123
- **Redux Toolkit:**
107
+ **Examples:**
124
108
 
125
- - Copies store configuration to `src/store/`
126
- - Creates hooks, persistor, and rootReducer
127
- - Copies `StoreProvider.tsx` to `src/providers/`
128
- - Integrates with RootProvider
129
- - Installs @reduxjs/toolkit, react-redux, redux-persist
109
+ ```bash
110
+ # Simple page
111
+ npx @teispace/next-maker page about
130
112
 
131
- **Internationalization:**
113
+ # Page with loading and error states
114
+ npx @teispace/next-maker page dashboard --loading --error
132
115
 
133
- - Copies i18n directory (`routing.ts`, `request.ts`, `navigation.ts`, `translations/`)
134
- - Copies `types/i18n.ts` and `lib/config/app-locales.ts`
135
- - Creates/updates `src/proxy.ts` (middleware)
136
- - Updates `next.config.ts` with createNextIntlPlugin
137
- - Updates RootProvider with NextIntlClientProvider
138
- - Creates `[locale]` route structure
139
- - Installs next-intl package
116
+ # Dynamic route (e.g., /products/[id])
117
+ npx @teispace/next-maker page products --dynamic id --loading --error
118
+ ```
140
119
 
141
120
  ---
142
121
 
143
- ### 3. Generate a Feature Module
122
+ ### 4. Generate a Component
123
+
124
+ Create a shared component with automatic barrel export wiring across all index files.
125
+
126
+ ```bash
127
+ npx @teispace/next-maker component <name> [options]
128
+ ```
129
+
130
+ **Options:**
131
+
132
+ - `--client` - Add `'use client'` directive
133
+ - `--i18n` - Add `useTranslations` hook
134
+ - `--feature <path>` - Generate inside a feature directory
135
+
136
+ **Generated structure (shared):**
137
+
138
+ ```
139
+ src/components/common/MyButton/
140
+ ├── MyButton.tsx
141
+ └── index.ts
142
+ ```
143
+
144
+ Auto-updates `src/components/common/index.ts` and `src/components/index.ts`.
145
+
146
+ **Examples:**
147
+
148
+ ```bash
149
+ # Shared component
150
+ npx @teispace/next-maker component data-table --client
151
+
152
+ # Component with i18n
153
+ npx @teispace/next-maker component nav-bar --client --i18n
154
+
155
+ # Feature-specific component
156
+ npx @teispace/next-maker component user-card --client --feature src/features/auth
157
+ ```
158
+
159
+ ---
160
+
161
+ ### 5. Generate a Feature Module
144
162
 
145
163
  Create a complete feature module following Domain-Driven Design principles.
146
164
 
@@ -182,7 +200,7 @@ src/features/user-dashboard/
182
200
  # Full feature with Redux and API service
183
201
  npx @teispace/next-maker feature user-profile --store persist --service axios
184
202
 
185
- # Feature with Redux only (no persistence)
203
+ # Feature with Redux only
186
204
  npx @teispace/next-maker feature shopping-cart --store no-persist --skip-service
187
205
 
188
206
  # Feature in custom location
@@ -191,7 +209,7 @@ npx @teispace/next-maker feature auth --store persist --service fetch --path src
191
209
 
192
210
  ---
193
211
 
194
- ### 4. Generate a Redux Slice
212
+ ### 6. Generate a Redux Slice
195
213
 
196
214
  Create a Redux Toolkit slice with persistence support.
197
215
 
@@ -205,18 +223,7 @@ npx @teispace/next-maker slice <name> [options]
205
223
  - `--no-persist` - Disable persistence
206
224
  - `--path <path>` - Custom path (default: create new feature)
207
225
 
208
- **Generated structure:**
209
-
210
- ```
211
- src/features/auth/store/auth/
212
- ├── auth.slice.ts
213
- ├── auth.selectors.ts
214
- ├── auth.types.ts
215
- ├── persist.ts (optional)
216
- └── index.ts
217
- ```
218
-
219
- **Auto-registers in rootReducer** with correct imports!
226
+ **Auto-registers in rootReducer** with correct imports.
220
227
 
221
228
  **Examples:**
222
229
 
@@ -226,16 +233,13 @@ npx @teispace/next-maker slice auth --persist
226
233
 
227
234
  # Add slice to existing feature
228
235
  npx @teispace/next-maker slice user-settings --path features/auth/store
229
-
230
- # Slice in custom location
231
- npx @teispace/next-maker slice theme --no-persist --path src/store/slices
232
236
  ```
233
237
 
234
238
  ---
235
239
 
236
- ### 5. Generate an API Service
240
+ ### 7. Generate an API Service
237
241
 
238
- Create an API service with HTTP client integration.
242
+ Create an API service with HTTP client integration. Supports both simple and full CRUD generation.
239
243
 
240
244
  ```bash
241
245
  npx @teispace/next-maker service <name> [options]
@@ -245,219 +249,191 @@ npx @teispace/next-maker service <name> [options]
245
249
 
246
250
  - `--axios` - Use AxiosClient
247
251
  - `--fetch` - Use FetchClient
252
+ - `--crud` - Generate full CRUD service (getAll, getById, create, update, delete)
248
253
  - `--path <path>` - Custom path (default: create new feature)
249
254
 
250
- **Generated structure:**
255
+ **CRUD mode** generates:
251
256
 
252
- ```
253
- src/features/payment/services/
254
- └── payment.service.ts
255
- ```
256
-
257
- **Validates HTTP client setup** before generation!
257
+ - Service with 5 methods: `getAll`, `getById`, `create`, `update`, `delete`
258
+ - `<Name>Summary` type for list responses (cards, tables) and `<Name>Detail` type for single-item responses (detail pages)
259
+ - DTO types: `Create<Name>Dto`, `Update<Name>Dto`
260
+ - Full API config with dynamic routes (`getById(id)`, `update(id)`, `delete(id)`)
258
261
 
259
262
  **Examples:**
260
263
 
261
264
  ```bash
262
- # Create new feature with service
265
+ # Simple service
263
266
  npx @teispace/next-maker service payment --axios
264
267
 
265
- # Add service to existing feature
266
- npx @teispace/next-maker service user --fetch --path features/auth/services
268
+ # Full CRUD service with types and endpoints
269
+ npx @teispace/next-maker service users --fetch --crud
267
270
 
268
- # Service in custom location
269
- npx @teispace/next-maker service analytics --axios --path src/api/services
271
+ # CRUD service in existing feature
272
+ npx @teispace/next-maker service orders --axios --crud --path features/products/services
270
273
  ```
271
274
 
272
275
  ---
273
276
 
274
- ## Usage Examples
277
+ ### 8. Add a Locale
275
278
 
276
- ### Quick Start - New Project
279
+ Add a new language/locale to your internationalized project.
277
280
 
278
281
  ```bash
279
- # Create a new Next.js app with interactive setup
280
- npx @teispace/next-maker my-project
282
+ npx @teispace/next-maker locale [code] [options]
283
+ ```
281
284
 
282
- # Navigate to the project
283
- cd my-project
285
+ **Options:**
284
286
 
285
- # Generate your first feature
286
- npx @teispace/next-maker feature auth --store persist --service axios
287
+ - `--copy-translations` - Copy English translations instead of empty values
287
288
 
288
- # Start development server
289
- npm run dev
290
- ```
289
+ **What it does:**
291
290
 
292
- ### Setup Existing Project
291
+ - Creates `src/i18n/translations/<code>.json` (empty or copied from English)
292
+ - Updates `SupportedLocale` type in `src/types/i18n.ts`
293
+ - Adds entry to `src/lib/config/app-locales.ts` with name, flag, country
293
294
 
294
- ```bash
295
- # Add features to existing Next.js project
295
+ **Examples:**
296
296
 
297
- # Add HTTP clients if you initially selected 'none'
298
- npx @teispace/next-maker setup --http-client
297
+ ```bash
298
+ # Add Spanish (interactive prompts for name, country, flag)
299
+ npx @teispace/next-maker locale es
299
300
 
300
- # Add dark mode support
301
- npx @teispace/next-maker setup --dark-theme
301
+ # Add French with English translations as starting point
302
+ npx @teispace/next-maker locale fr --copy-translations
303
+ ```
302
304
 
303
- # Add Redux state management
304
- npx @teispace/next-maker setup --redux
305
+ ---
305
306
 
306
- # Add internationalization
307
- npx @teispace/next-maker setup --i18n
308
- ```
307
+ ### 9. Generate a Hook
309
308
 
310
- ### Feature-Based Development
309
+ Create a custom React hook with loading/error state boilerplate.
311
310
 
312
311
  ```bash
313
- # E-commerce example
314
- npx @teispace/next-maker feature products --store persist --service axios
315
- npx @teispace/next-maker feature cart --store persist --skip-service
316
- npx @teispace/next-maker slice checkout --path features/cart/store
317
- npx @teispace/next-maker service orders --axios --path features/products/services
318
-
319
- # Dashboard example
320
- npx @teispace/next-maker feature dashboard --store no-persist --service fetch
321
- npx @teispace/next-maker slice analytics --path features/dashboard/store
322
- npx @teispace/next-maker service metrics --fetch --path features/dashboard/services
312
+ npx @teispace/next-maker hook <name> [options]
323
313
  ```
324
314
 
325
- ### Get Help
315
+ **Options:**
316
+
317
+ - `--client` - Add `'use client'` directive (default: true)
318
+ - `--feature <path>` - Generate in feature directory
319
+
320
+ **Examples:**
326
321
 
327
322
  ```bash
328
- # General help
329
- npx @teispace/next-maker --help
323
+ # Shared hook in src/hooks/
324
+ npx @teispace/next-maker hook auth-session
330
325
 
331
- # Command-specific help
332
- npx @teispace/next-maker init --help
333
- npx @teispace/next-maker setup --help
334
- npx @teispace/next-maker feature --help
335
- npx @teispace/next-maker slice --help
336
- npx @teispace/next-maker service --help
326
+ # Hook inside a feature
327
+ npx @teispace/next-maker hook user-profile --feature src/features/auth
337
328
  ```
338
329
 
339
330
  ---
340
331
 
341
- ## Key Features
332
+ ## Usage Examples
342
333
 
343
- ### 🚀 Post-Installation Setup
334
+ ### Quick Start - New Project
344
335
 
345
- Add features to your project anytime with the `setup` command:
336
+ ```bash
337
+ # Create a new Next.js app with interactive setup
338
+ npx @teispace/next-maker init my-project
339
+ cd my-project
346
340
 
347
- - HTTP clients (axios/fetch) even if you initially chose "none"
348
- - Dark theme with automatic CSS and layout updates
349
- - Redux Toolkit with complete store configuration
350
- - Internationalization with routing and middleware
351
- - Smart detection prevents duplicate setups
352
- - Automatic package installation
341
+ # Generate pages
342
+ npx @teispace/next-maker page dashboard --loading --error
343
+ npx @teispace/next-maker page settings --loading
353
344
 
354
- ### 🏗️ Feature-First Architecture
345
+ # Generate features with CRUD
346
+ npx @teispace/next-maker feature users --store persist --service fetch
347
+ npx @teispace/next-maker service users --fetch --crud --path features/users/services
355
348
 
356
- All generators follow a feature-based DDD approach by default, organizing code by business domain rather than technical layers.
349
+ # Add a locale
350
+ npx @teispace/next-maker locale es
357
351
 
358
- ### 🔄 Smart Redux Integration
352
+ # Start development
353
+ npm run dev
354
+ ```
359
355
 
360
- - Auto-registers slices in `rootReducer`
361
- - Correct import paths for any custom location
362
- - Optional redux-persist configuration
363
- - Demo actions included (setLoading, setError, resetState)
364
- - Can be added post-initialization via `setup --redux`
356
+ ### Feature-Based Development
365
357
 
366
- ### 📡 HTTP Client Support
358
+ ```bash
359
+ # E-commerce example
360
+ npx @teispace/next-maker feature products --store persist --service axios
361
+ npx @teispace/next-maker service products --axios --crud --path features/products/services
362
+ npx @teispace/next-maker page products --dynamic id --loading --error
363
+ npx @teispace/next-maker component product-card --client --feature src/features/products
367
364
 
368
- - **AxiosClient**: Result-based error handling with `isOk()/isErr()`
369
- - **FetchClient**: Same Result pattern with native fetch
370
- - Auto-detects available clients
371
- - Type-safe API calls with generics
372
- - Can be added later via `setup --http-client`
365
+ npx @teispace/next-maker feature cart --store persist --skip-service
366
+ npx @teispace/next-maker page checkout --loading --error
367
+ ```
373
368
 
374
- ### 🌙 Dark Mode Support
369
+ ### Get Help
375
370
 
376
- - next-themes integration with CustomThemeProvider
377
- - Automatic CSS variable setup (`--color-dark`, `--color-light`)
378
- - Tailwind CSS v4 custom variant (`@custom-variant dark`)
379
- - Layout className updates (`bg-light dark:bg-dark`)
380
- - Can be added via `setup --dark-theme`
371
+ ```bash
372
+ npx @teispace/next-maker --help
373
+ npx @teispace/next-maker page --help
374
+ npx @teispace/next-maker component --help
375
+ npx @teispace/next-maker locale --help
376
+ ```
381
377
 
382
- ### 🌍 Internationalization
378
+ ---
383
379
 
384
- - next-intl with routing middleware
385
- - Translation management system
386
- - Locale type safety
387
- - [locale] route structure
388
- - Can be added via `setup --i18n`
380
+ ## Key Features
389
381
 
390
- ### 🎯 Intelligent Path Handling
382
+ ### Pages with Full Locale Support
391
383
 
392
- All commands support `--path` for custom locations:
384
+ Auto-generates `generateMetadata`, `setRequestLocale`, typed Props, SEO metadata, and translation namespace. Supports dynamic routes with `--dynamic`.
393
385
 
394
- - Relative: `features/auth` `src/features/auth`
395
- - Absolute: `src/modules/auth` → `src/modules/auth`
396
- - Auto-creates directory structure
397
- - Adapts imports based on location
386
+ ### Shared Components with Auto-Wiring
398
387
 
399
- ### Built-in Validations
388
+ Creates component in `src/components/common/<Name>/` and auto-updates all barrel exports so you can immediately `import { MyComponent } from '@/components'`.
400
389
 
401
- - Checks for required dependencies (Redux, HTTP clients)
402
- - Prevents duplicate generation and setups
403
- - Validates naming conventions (kebab-case)
404
- - Ensures consistent project structure
405
- - Validates GitHub repository URLs
390
+ ### CRUD Service Generation
406
391
 
407
- ---
392
+ `--crud` flag generates a complete service with 5 REST methods, separate `Summary` and `Detail` response types (list vs detail views), typed DTOs, and full API config with dynamic route helpers.
408
393
 
409
- ## Command Reference
394
+ ### Locale Management
410
395
 
411
- ### Generator Options (feature, slice, service)
396
+ One command adds a new language: translation file, type update, and config entry. No manual file editing.
412
397
 
413
- These commands support:
398
+ ### Feature-First Architecture
414
399
 
415
- - `[name]` - Resource name (kebab-case, prompted if omitted)
416
- - `--path <path>` - Custom generation path
417
- - `--help` - Show command help
400
+ All generators follow a feature-based DDD approach, organizing code by business domain rather than technical layers.
418
401
 
419
- ### Init/App Options
402
+ ### Smart Redux Integration
420
403
 
421
- Interactive prompts guide you through:
404
+ Auto-registers slices in `rootReducer` with correct import paths and optional redux-persist configuration.
422
405
 
423
- - Project name, description, version
424
- - Package manager selection
425
- - GitHub repository (optional)
426
- - HTTP client selection
427
- - Dark mode, Redux, i18n toggles
428
- - Docker, CI/CD, pre-commit hooks
406
+ ### HTTP Client Support
429
407
 
430
- ### Setup Options
408
+ - **AxiosClient**: Result-based error handling
409
+ - **FetchClient**: Same Result pattern with native fetch
410
+ - Auto-detects available clients
431
411
 
432
- ```bash
433
- --http-client <type> # Setup HTTP client (axios|fetch|both)
434
- --dark-theme # Setup dark theme support
435
- --redux # Setup Redux Toolkit
436
- --i18n # Setup internationalization
437
- ```
412
+ ### Intelligent Path Handling
438
413
 
439
- ### Feature Options
414
+ All commands support `--path` for custom locations. Relative paths like `features/auth` are resolved to `src/features/auth`.
440
415
 
441
- ```bash
442
- --store <persist|no-persist> # Generate Redux store
443
- --skip-store # Don't generate store
444
- --service <axios|fetch> # Generate API service
445
- --skip-service # Don't generate service
446
- ```
416
+ ### Built-in Validations
447
417
 
448
- ### Slice Options
418
+ - Checks for required dependencies (Redux, HTTP clients, i18n)
419
+ - Prevents duplicate generation
420
+ - Validates naming conventions (kebab-case)
449
421
 
450
- ```bash
451
- --persist # Enable redux-persist
452
- --no-persist # Disable persistence
453
- ```
422
+ ---
454
423
 
455
- ### Service Options
424
+ ## Command Reference
456
425
 
457
- ```bash
458
- --axios # Use AxiosClient
459
- --fetch # Use FetchClient
460
- ```
426
+ | Command | Description |
427
+ | ------------------ | -------------------------------- |
428
+ | `init [name]` | Create a new Next.js application |
429
+ | `setup` | Add features to existing project |
430
+ | `page <name>` | Generate a new page/route |
431
+ | `component <name>` | Generate a shared component |
432
+ | `feature <name>` | Generate a feature module |
433
+ | `slice <name>` | Generate a Redux slice |
434
+ | `service <name>` | Generate an API service |
435
+ | `locale [code]` | Add a new locale/language |
436
+ | `hook <name>` | Generate a custom React hook |
461
437
 
462
438
  ---
463
439
 
@@ -469,6 +445,7 @@ Generated apps follow this structure:
469
445
  my-project/
470
446
  ├── src/
471
447
  │ ├── app/ # Next.js App Router
448
+ │ │ └── [locale]/ # Locale-aware routes (if i18n)
472
449
  │ ├── features/ # Feature modules (DDD)
473
450
  │ │ └── counter/
474
451
  │ │ ├── components/
@@ -477,21 +454,18 @@ my-project/
477
454
  │ │ ├── types/
478
455
  │ │ └── index.ts
479
456
  │ ├── components/ # Shared components
457
+ │ │ └── common/ # Reusable UI components
480
458
  │ ├── lib/
481
459
  │ │ ├── config/ # App configuration
482
460
  │ │ ├── utils/
483
461
  │ │ │ └── http/ # AxiosClient & FetchClient
484
- │ │ ├── errors/ # Error classes
485
- │ │ └── validations/ # Validation schemas
462
+ │ │ └── errors/ # Error classes
486
463
  │ ├── providers/ # React providers
487
464
  │ ├── store/ # Redux store setup
488
- │ ├── services/ # Global services
489
465
  │ ├── i18n/ # Internationalization
466
+ │ │ └── translations/ # Translation files
490
467
  │ └── styles/ # Global styles
491
468
  ├── public/ # Static assets
492
- ├── .husky/ # Git hooks
493
- ├── Dockerfile
494
- ├── docker-compose.yml
495
469
  └── package.json
496
470
  ```
497
471
 
@@ -501,20 +475,11 @@ my-project/
501
475
 
502
476
  **CLI:**
503
477
 
504
- - TypeScript - Type-safe development
505
- - esbuild - Fast bundling
506
- - Commander.js - CLI framework
507
- - Enquirer - Interactive prompts
478
+ - TypeScript, esbuild, Commander.js, Enquirer, Vitest
508
479
 
509
480
  **Generated Apps:**
510
481
 
511
- - Next.js 16+ - React framework
512
- - TypeScript - Static typing
513
- - Redux Toolkit - State management
514
- - Tailwind CSS v4 - Styling
515
- - next-intl - Internationalization
516
- - Axios - HTTP client
517
- - ESLint + Prettier - Code quality
482
+ - Next.js 16+, TypeScript, Redux Toolkit, Tailwind CSS v4, next-intl, Axios, ESLint + Prettier
518
483
 
519
484
  ---
520
485
 
@@ -525,46 +490,32 @@ my-project/
525
490
  ```bash
526
491
  git clone <repository-url>
527
492
  cd npm-packages/packages/next-maker
528
- yarn install
493
+ npm install
529
494
  ```
530
495
 
531
496
  ### Build
532
497
 
533
498
  ```bash
534
- yarn build
499
+ npm run build
535
500
  ```
536
501
 
537
- ### Test Locally
502
+ ### Test
538
503
 
539
504
  ```bash
540
- # Test app generation
541
- node dist/index.js init test-project
542
-
543
- # Navigate to test project
544
- cd test-project
545
-
546
- # Test setup commands
547
- node ../dist/index.js setup --http-client
548
- node ../dist/index.js setup --dark-theme
549
- node ../dist/index.js setup --redux
550
- node ../dist/index.js setup --i18n
551
-
552
- # Test feature generation
553
- node ../dist/index.js feature auth --store persist --service axios
554
-
555
- # Test slice generation
556
- node ../dist/index.js slice user-profile --persist
557
-
558
- # Test service generation
559
- node ../dist/index.js service payment --axios
505
+ npm test
506
+ npm run test:watch
560
507
  ```
561
508
 
562
- ### Link for Global Testing
509
+ ### Test Locally
563
510
 
564
511
  ```bash
565
- npm link
566
- next-maker feature my-feature
567
- npm unlink -g
512
+ node dist/index.js init test-project
513
+ cd test-project
514
+ node ../dist/index.js page dashboard --loading --error
515
+ node ../dist/index.js component sidebar --client
516
+ node ../dist/index.js feature auth --store persist --service axios
517
+ node ../dist/index.js service users --fetch --crud
518
+ node ../dist/index.js locale es
568
519
  ```
569
520
 
570
521
  ---