nexstruct 1.0.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 (229) hide show
  1. package/AGENTS.md +122 -0
  2. package/LICENSE +21 -0
  3. package/README.md +103 -0
  4. package/package.json +99 -0
  5. package/scaffold/generator.js +409 -0
  6. package/scaffold/index.js +20 -0
  7. package/scaffold/prompts.js +108 -0
  8. package/templates/api/axios/src/api/axios/client.api.ts +30 -0
  9. package/templates/api/axios/src/api/axios/users.api.ts +15 -0
  10. package/templates/api/fetch/src/api/fetch/client.api.ts +68 -0
  11. package/templates/api/fetch/src/api/fetch/users.api.ts +15 -0
  12. package/templates/api/trpc/src/api/trpc/client.api.ts +4 -0
  13. package/templates/api/trpc/src/api/trpc/router.api.ts +15 -0
  14. package/templates/api/trpc/src/api/trpc/server.client.api.ts +4 -0
  15. package/templates/api/trpc/src/providers/trpc.provider.tsx +24 -0
  16. package/templates/auth/clerk/src/auth/clerk/auth.service.ts +4 -0
  17. package/templates/auth/clerk/src/hooks/use-auth.hook.ts +13 -0
  18. package/templates/auth/clerk/src/middleware.ts +7 -0
  19. package/templates/auth/clerk/src/providers/auth.provider.tsx +6 -0
  20. package/templates/auth/next-auth/src/app/api/auth/[...nextauth]/route.ts +5 -0
  21. package/templates/auth/next-auth/src/auth/next-auth/auth.service.ts +45 -0
  22. package/templates/auth/next-auth/src/hooks/use-session.hook.ts +13 -0
  23. package/templates/auth/next-auth/src/providers/session.provider.tsx +6 -0
  24. package/templates/forms/formik/src/components/forms/login-form.component.tsx +30 -0
  25. package/templates/forms/formik/src/forms/formik/hooks/use-form-config.hook.ts +7 -0
  26. package/templates/forms/formik/src/forms/formik/schemas/example.schema.ts +8 -0
  27. package/templates/forms/react-hook-form/src/components/forms/login-form.component.tsx +27 -0
  28. package/templates/forms/react-hook-form/src/forms/react-hook-form/hooks/use-form.hook.ts +13 -0
  29. package/templates/forms/react-hook-form/src/forms/react-hook-form/schemas/example.schema.ts +15 -0
  30. package/templates/nextjs-base/next.config.ts +5 -0
  31. package/templates/nextjs-base/postcss.config.mjs +9 -0
  32. package/templates/nextjs-base/src/app/_components/navbar.tsx +88 -0
  33. package/templates/nextjs-base/src/app/_components/sidebar.tsx +223 -0
  34. package/templates/nextjs-base/src/app/error.tsx +39 -0
  35. package/templates/nextjs-base/src/app/globals.css +71 -0
  36. package/templates/nextjs-base/src/app/layout.tsx +21 -0
  37. package/templates/nextjs-base/src/app/loading.tsx +13 -0
  38. package/templates/nextjs-base/src/app/not-found.tsx +22 -0
  39. package/templates/nextjs-base/src/app/page.tsx +10 -0
  40. package/templates/nextjs-base/tailwind.config.ts +69 -0
  41. package/templates/shared/src/components/common/theme-toggle.component.tsx +31 -0
  42. package/templates/shared/src/components/common/toast/custom-message.component.tsx +18 -0
  43. package/templates/shared/src/components/common/toast/index.ts +8 -0
  44. package/templates/shared/src/components/common/toast/toast-message.component.tsx +112 -0
  45. package/templates/shared/src/hooks/use-debounce.hook.ts +12 -0
  46. package/templates/shared/src/hooks/use-fetch.hook.ts +42 -0
  47. package/templates/shared/src/hooks/use-intersection-observer.hook.ts +39 -0
  48. package/templates/shared/src/hooks/use-local-storage.hook.ts +30 -0
  49. package/templates/shared/src/hooks/use-media-query.hook.ts +26 -0
  50. package/templates/shared/src/hooks/use-toggle.hook.ts +12 -0
  51. package/templates/shared/src/lib/utils.util.ts +361 -0
  52. package/templates/shared/src/providers/theme.provider.tsx +17 -0
  53. package/templates/shared/src/providers/toast.provider.tsx +32 -0
  54. package/templates/shared/src/types/common.type.ts +34 -0
  55. package/templates/state/context/src/store/context/auth.context.tsx +47 -0
  56. package/templates/state/context/src/store/context/counter.context.tsx +41 -0
  57. package/templates/state/context/src/store/context/index.ts +2 -0
  58. package/templates/state/redux/src/providers/redux.provider.tsx +7 -0
  59. package/templates/state/redux/src/store/redux/hooks.store.ts +5 -0
  60. package/templates/state/redux/src/store/redux/index.ts +4 -0
  61. package/templates/state/redux/src/store/redux/slices/api.slice.ts +8 -0
  62. package/templates/state/redux/src/store/redux/slices/counter.slice.ts +24 -0
  63. package/templates/state/redux/src/store/redux/store.store.ts +13 -0
  64. package/templates/state/zustand/src/store/zustand/counter.store.ts +15 -0
  65. package/templates/state/zustand/src/store/zustand/index.ts +2 -0
  66. package/templates/state/zustand/src/store/zustand/user.store.ts +32 -0
  67. package/templates/ui/antd/COMPONENT_GUIDE.md +326 -0
  68. package/templates/ui/antd/src/app/examples/dialog/page.tsx +205 -0
  69. package/templates/ui/antd/src/app/examples/form/page.tsx +160 -0
  70. package/templates/ui/antd/src/app/examples/layout.tsx +125 -0
  71. package/templates/ui/antd/src/app/examples/page.tsx +64 -0
  72. package/templates/ui/antd/src/app/examples/table/page.tsx +118 -0
  73. package/templates/ui/antd/src/app/page.tsx +283 -0
  74. package/templates/ui/antd/src/components/common/DynamicTable/dynamic-table.component.tsx +79 -0
  75. package/templates/ui/antd/src/components/common/button/action-button.component.tsx +63 -0
  76. package/templates/ui/antd/src/components/common/dialog/dialog-wrapper.component.tsx +63 -0
  77. package/templates/ui/antd/src/components/common/fields/assets/components/check-field.component.tsx +55 -0
  78. package/templates/ui/antd/src/components/common/fields/assets/components/date-picker-field.component.tsx +80 -0
  79. package/templates/ui/antd/src/components/common/fields/assets/components/limit-field.component.tsx +26 -0
  80. package/templates/ui/antd/src/components/common/fields/assets/components/multi-check-field.component.tsx +56 -0
  81. package/templates/ui/antd/src/components/common/fields/assets/components/number-field.component.tsx +100 -0
  82. package/templates/ui/antd/src/components/common/fields/assets/components/otp-field.component.tsx +63 -0
  83. package/templates/ui/antd/src/components/common/fields/assets/components/password-field.component.tsx +106 -0
  84. package/templates/ui/antd/src/components/common/fields/assets/components/phone-number-field.component.tsx +78 -0
  85. package/templates/ui/antd/src/components/common/fields/assets/components/radio-field.component.tsx +55 -0
  86. package/templates/ui/antd/src/components/common/fields/assets/components/range-date-picker.component.tsx +66 -0
  87. package/templates/ui/antd/src/components/common/fields/assets/components/search-field.component.tsx +24 -0
  88. package/templates/ui/antd/src/components/common/fields/assets/components/select-field.component.tsx +82 -0
  89. package/templates/ui/antd/src/components/common/fields/assets/components/single-check-field.component.tsx +50 -0
  90. package/templates/ui/antd/src/components/common/fields/assets/components/single-select-field.component.tsx +86 -0
  91. package/templates/ui/antd/src/components/common/fields/assets/components/string-number-field.component.tsx +80 -0
  92. package/templates/ui/antd/src/components/common/fields/assets/components/switch-field.component.tsx +62 -0
  93. package/templates/ui/antd/src/components/common/fields/assets/components/text-area-field.component.tsx +85 -0
  94. package/templates/ui/antd/src/components/common/fields/assets/components/text-field.component.tsx +88 -0
  95. package/templates/ui/antd/src/components/common/fields/assets/interface/input-props.type.ts +233 -0
  96. package/templates/ui/antd/src/components/common/fields/cusInputField.component.tsx +40 -0
  97. package/templates/ui/antd/src/components/common/pagination/pagination.component.tsx +27 -0
  98. package/templates/ui/antd/src/components/ui/avatar.component.tsx +8 -0
  99. package/templates/ui/antd/src/components/ui/badge.component.tsx +8 -0
  100. package/templates/ui/antd/src/components/ui/button.component.tsx +8 -0
  101. package/templates/ui/antd/src/components/ui/card.component.tsx +8 -0
  102. package/templates/ui/antd/src/components/ui/checkbox.component.tsx +8 -0
  103. package/templates/ui/antd/src/components/ui/dialog.component.tsx +9 -0
  104. package/templates/ui/antd/src/components/ui/dropdown-menu.component.tsx +10 -0
  105. package/templates/ui/antd/src/components/ui/form.component.tsx +12 -0
  106. package/templates/ui/antd/src/components/ui/input.component.tsx +13 -0
  107. package/templates/ui/antd/src/components/ui/label.component.tsx +18 -0
  108. package/templates/ui/antd/src/components/ui/popover.component.tsx +8 -0
  109. package/templates/ui/antd/src/components/ui/progress.component.tsx +8 -0
  110. package/templates/ui/antd/src/components/ui/radio-group.component.tsx +10 -0
  111. package/templates/ui/antd/src/components/ui/scroll-area.component.tsx +25 -0
  112. package/templates/ui/antd/src/components/ui/select.component.tsx +8 -0
  113. package/templates/ui/antd/src/components/ui/separator.component.tsx +8 -0
  114. package/templates/ui/antd/src/components/ui/sheet.component.tsx +8 -0
  115. package/templates/ui/antd/src/components/ui/switch.component.tsx +8 -0
  116. package/templates/ui/antd/src/components/ui/table.component.tsx +8 -0
  117. package/templates/ui/antd/src/components/ui/tabs.component.tsx +8 -0
  118. package/templates/ui/antd/src/components/ui/textarea.component.tsx +9 -0
  119. package/templates/ui/antd/src/components/ui/tooltip.component.tsx +8 -0
  120. package/templates/ui/antd/src/lib/theme.util.ts +40 -0
  121. package/templates/ui/antd/src/providers/antd.provider.tsx +13 -0
  122. package/templates/ui/mui/src/app/examples/layout.tsx +113 -0
  123. package/templates/ui/mui/src/app/examples/page.tsx +716 -0
  124. package/templates/ui/mui/src/app/page.tsx +298 -0
  125. package/templates/ui/mui/src/components/common/DynamicTable/dynamic-table.component.tsx +131 -0
  126. package/templates/ui/mui/src/components/common/button/action-button.component.tsx +57 -0
  127. package/templates/ui/mui/src/components/common/dialog/dialog-wrapper.component.tsx +55 -0
  128. package/templates/ui/mui/src/components/common/fields/assets/components/check-field.component.tsx +51 -0
  129. package/templates/ui/mui/src/components/common/fields/assets/components/date-picker-field.component.tsx +50 -0
  130. package/templates/ui/mui/src/components/common/fields/assets/components/multi-check-field.component.tsx +14 -0
  131. package/templates/ui/mui/src/components/common/fields/assets/components/number-field.component.tsx +59 -0
  132. package/templates/ui/mui/src/components/common/fields/assets/components/password-field.component.tsx +87 -0
  133. package/templates/ui/mui/src/components/common/fields/assets/components/phone-number-field.component.tsx +48 -0
  134. package/templates/ui/mui/src/components/common/fields/assets/components/radio-field.component.tsx +37 -0
  135. package/templates/ui/mui/src/components/common/fields/assets/components/search-field.component.tsx +41 -0
  136. package/templates/ui/mui/src/components/common/fields/assets/components/select-field.component.tsx +77 -0
  137. package/templates/ui/mui/src/components/common/fields/assets/components/single-check-field.component.tsx +39 -0
  138. package/templates/ui/mui/src/components/common/fields/assets/components/single-select-field.component.tsx +56 -0
  139. package/templates/ui/mui/src/components/common/fields/assets/components/string-number-field.component.tsx +52 -0
  140. package/templates/ui/mui/src/components/common/fields/assets/components/switch-field.component.tsx +35 -0
  141. package/templates/ui/mui/src/components/common/fields/assets/components/text-area-field.component.tsx +46 -0
  142. package/templates/ui/mui/src/components/common/fields/assets/components/text-field.component.tsx +51 -0
  143. package/templates/ui/mui/src/components/common/fields/assets/interface/input-props.type.ts +193 -0
  144. package/templates/ui/mui/src/components/common/fields/cusInputField.component.tsx +34 -0
  145. package/templates/ui/mui/src/components/common/pagination/pagination.component.tsx +59 -0
  146. package/templates/ui/mui/src/components/ui/avatar.component.tsx +19 -0
  147. package/templates/ui/mui/src/components/ui/badge.component.tsx +18 -0
  148. package/templates/ui/mui/src/components/ui/button.component.tsx +22 -0
  149. package/templates/ui/mui/src/components/ui/card.component.tsx +39 -0
  150. package/templates/ui/mui/src/components/ui/checkbox.component.tsx +21 -0
  151. package/templates/ui/mui/src/components/ui/dialog.component.tsx +38 -0
  152. package/templates/ui/mui/src/components/ui/dropdown-menu.component.tsx +43 -0
  153. package/templates/ui/mui/src/components/ui/form.component.tsx +98 -0
  154. package/templates/ui/mui/src/components/ui/input.component.tsx +15 -0
  155. package/templates/ui/mui/src/components/ui/label.component.tsx +15 -0
  156. package/templates/ui/mui/src/components/ui/popover.component.tsx +20 -0
  157. package/templates/ui/mui/src/components/ui/progress.component.tsx +19 -0
  158. package/templates/ui/mui/src/components/ui/radio-group.component.tsx +25 -0
  159. package/templates/ui/mui/src/components/ui/scroll-area.component.tsx +27 -0
  160. package/templates/ui/mui/src/components/ui/select.component.tsx +26 -0
  161. package/templates/ui/mui/src/components/ui/separator.component.tsx +11 -0
  162. package/templates/ui/mui/src/components/ui/sheet.component.tsx +44 -0
  163. package/templates/ui/mui/src/components/ui/switch.component.tsx +23 -0
  164. package/templates/ui/mui/src/components/ui/table.component.tsx +34 -0
  165. package/templates/ui/mui/src/components/ui/tabs.component.tsx +38 -0
  166. package/templates/ui/mui/src/components/ui/textarea.component.tsx +18 -0
  167. package/templates/ui/mui/src/components/ui/tooltip.component.tsx +24 -0
  168. package/templates/ui/mui/src/lib/theme.util.ts +73 -0
  169. package/templates/ui/mui/src/providers/mui.provider.tsx +13 -0
  170. package/templates/ui/shadcn/COMPONENT_GUIDE.md +306 -0
  171. package/templates/ui/shadcn/src/app/examples/dialog/page.tsx +122 -0
  172. package/templates/ui/shadcn/src/app/examples/form/page.tsx +107 -0
  173. package/templates/ui/shadcn/src/app/examples/layout.tsx +24 -0
  174. package/templates/ui/shadcn/src/app/examples/page.tsx +30 -0
  175. package/templates/ui/shadcn/src/app/examples/table/page.tsx +77 -0
  176. package/templates/ui/shadcn/src/app/page.tsx +20 -0
  177. package/templates/ui/shadcn/src/components/common/DynamicTable/dynamic-table.component.tsx +136 -0
  178. package/templates/ui/shadcn/src/components/common/button/action-button.component.tsx +68 -0
  179. package/templates/ui/shadcn/src/components/common/dialog/dialog-wrapper.component.tsx +58 -0
  180. package/templates/ui/shadcn/src/components/common/fields/assets/components/check-field.component.tsx +52 -0
  181. package/templates/ui/shadcn/src/components/common/fields/assets/components/date-picker-field.component.tsx +62 -0
  182. package/templates/ui/shadcn/src/components/common/fields/assets/components/dynamic-file-upload-field.component.tsx +152 -0
  183. package/templates/ui/shadcn/src/components/common/fields/assets/components/limit-field.component.tsx +73 -0
  184. package/templates/ui/shadcn/src/components/common/fields/assets/components/multi-check-field.component.tsx +46 -0
  185. package/templates/ui/shadcn/src/components/common/fields/assets/components/number-field.component.tsx +124 -0
  186. package/templates/ui/shadcn/src/components/common/fields/assets/components/otp-field.component.tsx +61 -0
  187. package/templates/ui/shadcn/src/components/common/fields/assets/components/password-field.component.tsx +110 -0
  188. package/templates/ui/shadcn/src/components/common/fields/assets/components/phone-number-field.component.tsx +90 -0
  189. package/templates/ui/shadcn/src/components/common/fields/assets/components/radio-field.component.tsx +41 -0
  190. package/templates/ui/shadcn/src/components/common/fields/assets/components/range-date-picker.component.tsx +71 -0
  191. package/templates/ui/shadcn/src/components/common/fields/assets/components/rich-text-editor.component.tsx +91 -0
  192. package/templates/ui/shadcn/src/components/common/fields/assets/components/search-field.component.tsx +34 -0
  193. package/templates/ui/shadcn/src/components/common/fields/assets/components/select-field.component.tsx +231 -0
  194. package/templates/ui/shadcn/src/components/common/fields/assets/components/single-check-field.component.tsx +42 -0
  195. package/templates/ui/shadcn/src/components/common/fields/assets/components/single-select-field.component.tsx +82 -0
  196. package/templates/ui/shadcn/src/components/common/fields/assets/components/string-number-field.component.tsx +68 -0
  197. package/templates/ui/shadcn/src/components/common/fields/assets/components/switch-field.component.tsx +61 -0
  198. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-field.component.tsx +62 -0
  199. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-with-file.component.tsx +142 -0
  200. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-field.component.tsx +80 -0
  201. package/templates/ui/shadcn/src/components/common/fields/assets/components/tiny-editor.component.tsx +51 -0
  202. package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-profile-picture.component.tsx +103 -0
  203. package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-video-file.component.tsx +86 -0
  204. package/templates/ui/shadcn/src/components/common/fields/assets/interface/input-props.type.ts +198 -0
  205. package/templates/ui/shadcn/src/components/common/fields/cusInputField.component.tsx +52 -0
  206. package/templates/ui/shadcn/src/components/common/pagination/pagination.component.tsx +68 -0
  207. package/templates/ui/shadcn/src/components/ui/avatar.component.tsx +37 -0
  208. package/templates/ui/shadcn/src/components/ui/badge.component.tsx +28 -0
  209. package/templates/ui/shadcn/src/components/ui/button.component.tsx +52 -0
  210. package/templates/ui/shadcn/src/components/ui/card.component.tsx +46 -0
  211. package/templates/ui/shadcn/src/components/ui/checkbox.component.tsx +25 -0
  212. package/templates/ui/shadcn/src/components/ui/dialog.component.tsx +98 -0
  213. package/templates/ui/shadcn/src/components/ui/dropdown-menu.component.tsx +163 -0
  214. package/templates/ui/shadcn/src/components/ui/form.component.tsx +110 -0
  215. package/templates/ui/shadcn/src/components/ui/input-otp.component.tsx +64 -0
  216. package/templates/ui/shadcn/src/components/ui/input.component.tsx +23 -0
  217. package/templates/ui/shadcn/src/components/ui/label.component.tsx +23 -0
  218. package/templates/ui/shadcn/src/components/ui/popover.component.tsx +27 -0
  219. package/templates/ui/shadcn/src/components/ui/progress.component.tsx +22 -0
  220. package/templates/ui/shadcn/src/components/ui/radio-group.component.tsx +33 -0
  221. package/templates/ui/shadcn/src/components/ui/scroll-area.component.tsx +37 -0
  222. package/templates/ui/shadcn/src/components/ui/select.component.tsx +139 -0
  223. package/templates/ui/shadcn/src/components/ui/separator.component.tsx +23 -0
  224. package/templates/ui/shadcn/src/components/ui/sheet.component.tsx +89 -0
  225. package/templates/ui/shadcn/src/components/ui/switch.component.tsx +26 -0
  226. package/templates/ui/shadcn/src/components/ui/table.component.tsx +71 -0
  227. package/templates/ui/shadcn/src/components/ui/tabs.component.tsx +52 -0
  228. package/templates/ui/shadcn/src/components/ui/textarea.component.tsx +20 -0
  229. package/templates/ui/shadcn/src/components/ui/tooltip.component.tsx +25 -0
package/AGENTS.md ADDED
@@ -0,0 +1,122 @@
1
+ # nexstruct — AGENTS.md
2
+
3
+ CLI tool that scaffolds production-ready Next.js 15 + TypeScript frontend projects from composable templates.
4
+
5
+ ## Commands
6
+
7
+ | Command | Action |
8
+ |---------|--------|
9
+ | `npx nexstruct` | Run the interactive scaffolder (no install needed) |
10
+
11
+ The CLI requires a TTY (interactive prompts via `@inquirer/prompts`).
12
+
13
+ **No test, lint, or typecheck commands exist for this repo itself** — it has zero devDependencies. Only generated projects get those scripts.
14
+
15
+ ## Architecture
16
+
17
+ - **Entry:** `scaffold/index.js` (ESM; `"type": "module"` in package.json)
18
+ - **Prompts:** `scaffold/prompts.js` — asks about project name, UI libs, state mgmt, API layer, auth, forms, examples flag
19
+ - **Generator:** `scaffold/generator.js` — copies template dirs into output, generates `package.json`/`tsconfig.json`/`Providers`/`README.md`
20
+ - **Templates:** `templates/{nextjs-base,ui,state,api,auth,forms,shared}/` — each subdir under a category is a self-contained `fs.copy` overlay onto the base project
21
+
22
+ ## Key conventions
23
+
24
+ - **Naming convention in templates:** `[name].[category].[ext]` — e.g. `button.component.tsx`, `counter.store.ts`, `auth.service.ts`, `users.api.ts`, `use-toggle.hook.ts`, `common.type.ts`, `utils.util.ts`. Always preserve this when adding template files.
25
+ - **Template overlay order matters.** Later copies can overwrite earlier ones: nextjs-base → ui → state → api → auth → forms → shared.
26
+ - **`includeExamples` removal** runs *after* all copies. If false, `src/app/page.tsx` and `src/app/examples/` are deleted.
27
+ - **`Providers` composition** is code-generated based on the answer selections (nested provider components in `src/providers/index.tsx`), then injected into `src/app/layout.tsx`.
28
+ - **Generated project default scripts:** `dev` (next dev), `build` (next build), `start` (next start), `lint` (next lint), `typecheck` (tsc --noEmit).
29
+ - **No CI, no git hooks, no linter config for this repo.** Only the generated projects get eslint-config-next.
30
+
31
+ ## shadcn template — custom component system
32
+
33
+ When the user selects `shadcn/ui`, the generated project includes a reusable component system in `src/components/`:
34
+
35
+ ### UI Primitives (`ui/`)
36
+ button, badge, card, dialog, input, label, select, form, switch, checkbox, radio-group, textarea, table, tooltip, popover, scroll-area, avatar, sheet, dropdown-menu, tabs, progress, separator, input-otp.
37
+
38
+ ### `CustomField` (`common/fields/`)
39
+ Compound object with **26+ field types**:
40
+
41
+ | Field | Mode | Features |
42
+ |-------|------|----------|
43
+ | `CustomField.Text` | dual | left/right icons, array splitting |
44
+ | `CustomField.TextArea` | dual | configurable rows |
45
+ | `CustomField.Number` | dual | integer/float mode, scroll prevention, key filtering, min=0 |
46
+ | `CustomField.StringNumber` | dual | numeric string input |
47
+ | `CustomField.Password` | dual | show/hide toggle, **strength validation rules** when `mode="validate"` |
48
+ | `CustomField.PhoneNumber` | dual | **react-phone-input-2** (country dropdown, flag, search), maskable view mode |
49
+ | `CustomField.OTP` | dual | one-time password input |
50
+ | `CustomField.SingleSelectField` | dual | shadcn Select with loading/empty states |
51
+ | `CustomField.SelectField` | form-only | multi-select, search, avatars, tags, "show more" |
52
+ | `CustomField.SwitchField` | dual | with description, border mode |
53
+ | `CustomField.RadioField` | form-only | radio group |
54
+ | `CustomField.CheckField` | form-only | single checkbox with label |
55
+ | `CustomField.MultiCheckField` | form-only | multi-checkbox group |
56
+ | `CustomField.SingleCheckField` | form-only | standalone checkbox |
57
+ | `CustomField.SearchField` | dual | search with callback |
58
+ | `CustomField.DatePickerField` | dual | date picker |
59
+ | `CustomField.RangeDatePicker` | form-only | date range picker |
60
+ | `CustomField.LimitField` | standalone | pagination limit selector with **URL sync** |
61
+ | `CustomField.TextAreaWithFile` | form-only | textarea + file attachments |
62
+ | `CustomField.UploadProfilePicture` | dual | avatar upload with preview, **FileReader data URL (no raw File in form state)** |
63
+ | `CustomField.UploadVideoFile` | dual | video upload with preview |
64
+ | `CustomField.DynamicFileUploadField` | form-only | drag-and-drop file upload, supports optional `onUpload` callback |
65
+ | `CustomField.RichTextEditor` | form-only | rich text editing |
66
+ | `CustomField.TinyEditor` | form-only | lightweight editor |
67
+
68
+ ### Common Components
69
+ | Component | Description |
70
+ |-----------|-------------|
71
+ | `ActionButton` | Button with icon positions, loading spinner (`isPending`), and optional Tooltip |
72
+ | `DialogWrapper` | Scrollable dialog with sticky header, close button, optional trigger, and footer slot |
73
+ | `DynamicTable` | Config-driven table with loading/empty states, checkbox selection, expandable rows |
74
+ | `Pagination` | Page navigation with ellipsis for large page counts |
75
+
76
+ ### Toast Notification System (`common/toast/`)
77
+ | Function | Description |
78
+ |----------|-------------|
79
+ | `ToastMessageShow(type, message, options)` | Unified toast API — success, error, loading, custom |
80
+ | `toastSuccessMessage(msg)` | Shortcut for success toasts |
81
+ | `toastErrorMessage(msg)` | Shortcut for error toasts with API error extraction |
82
+ | `toastLoadingMessage(msg)` | Shortcut for loading toasts |
83
+ | `toastCustomMessage(msg)` | Shortcut for custom toasts |
84
+ | `ToastMessageChange(msg)` | Transform known error messages into human-friendly text |
85
+
86
+ The `ToastProvider` is auto-injected into the generated `Providers` composition.
87
+
88
+ ### Shared Utilities (`src/lib/utils.util.ts`)
89
+ | Function | Description |
90
+ |----------|-------------|
91
+ | `cn()` | Merge Tailwind classes with clsx + tailwind-merge |
92
+ | `LabelAndPlaceholderTextFormat()` | Auto-format labels to title case (preposition-aware) |
93
+ | `formatDate()` | "June 17, 2026" |
94
+ | `formatRelativeTime()` | "just now", "3m ago", "2h ago", "5d ago" |
95
+ | `toMonthYear()` | "Jun 2025" |
96
+ | `time12h()` | "2:30 PM" (with relative mode for today/yesterday) |
97
+ | `time24h()` | "14:30" |
98
+ | `customFormatDate()` | "YYYY-MM-DD" / "DD-MM-YYYY" / "YYYY" |
99
+ | `fullDateTime()` | "24 August 2025, 03:30 PM" |
100
+ | `duration()` | "2y 3m" between two dates |
101
+ | `localDateTime()` | "20-10-2025 at 10:07 am" |
102
+ | `localDateToISO()` | UTC midnight ISO string |
103
+ | `truncate()` | String truncation with ellipsis |
104
+ | `slugify()` | URL-safe slug generation |
105
+ | `maskString()` | "Hel***ld" — show first N / last N chars |
106
+ | `maskEmail()` | "j***@example.com" |
107
+ | `passwordRules` | 5 rules array (length, uppercase, number, special, no sequential) |
108
+ | `isPasswordStrong()` | Check all rules pass |
109
+
110
+ ### Field Patterns
111
+ - **Dual-mode**: every `CustomField.*` component checks `if (form)` — with form it wraps in shadcn `<FormField>` for validation/errors, without it renders standalone.
112
+ - **View-only mode**: `viewOnly` prop renders a styled read-only div instead of the input.
113
+ - **No raw File objects in form state**: File upload components use `FileReader.readAsDataURL()` or `URL.createObjectURL()` to store string URLs. Keep actual `File` references in local state or refs for submission.
114
+
115
+ ### Providers Stack
116
+ Auto-generated `src/providers/index.tsx` wraps the app with selected providers in order:
117
+ 1. `ToastProvider` — react-hot-toast with themed `<Toaster />`
118
+ 2. `ThemeProvider` — next-themes (if dark mode enabled)
119
+ 3. `MuiProvider` / `AntdProvider` — UI framework theme (if selected)
120
+ 4. `ReduxProvider` / Zustand store — state management (if selected)
121
+ 5. `TrpcProvider` — tRPC (if selected)
122
+ 6. `NextAuthProvider` / `ClerkAuthProvider` — auth (if selected)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Naimur Rahman
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 ADDED
@@ -0,0 +1,103 @@
1
+ <div align="center">
2
+ <br />
3
+ <h1>⚒️ Nexstruct</h1>
4
+ <p><strong>Scaffold production-ready Next.js 15 + TypeScript projects — instantly.</strong></p>
5
+ <p>Choose your UI library, state management, API layer, auth, and forms — all from one interactive CLI prompt.</p>
6
+ <br />
7
+
8
+ <p>
9
+ <a href="#-quick-start">Quick Start</a> •
10
+ <a href="#-features">Features</a> •
11
+ <a href="#-usage">Usage</a> •
12
+ <a href="#-templates">Templates</a>
13
+ </p>
14
+ <br />
15
+ </div>
16
+
17
+ ## ⚡ Quick Start
18
+
19
+ ```bash
20
+ # No install needed — just run:
21
+ npx nexstruct
22
+ ```
23
+
24
+ Follow the interactive prompts to select your stack, and your project will be scaffolded in seconds.
25
+
26
+ ## ✨ Features
27
+
28
+ - **3 UI Libraries** — shadcn/ui (Tailwind), Material UI, Ant Design — each with 15–24 custom field types
29
+ - **3 State Management** — Redux Toolkit, Zustand, React Context
30
+ - **3 API Layers** — Fetch, Axios, tRPC
31
+ - **2 Auth Providers** — NextAuth.js, Clerk
32
+ - **Form Handling** — react-hook-form with Zod validation
33
+ - **CustomField System** — Dual-mode fields that work with or without react-hook-form
34
+ - **Common Components** — ActionButton, DialogWrapper, DynamicTable, Pagination
35
+ - **TypeScript Strict** — Fully typed, production-ready code
36
+
37
+ ## 🚀 Usage
38
+
39
+ ```bash
40
+ # Scaffold a new project
41
+ npx nexstruct
42
+
43
+ # Or install globally
44
+ npm install -g nexstruct
45
+ nexstruct
46
+ ```
47
+
48
+ The CLI will ask you about:
49
+
50
+ | Prompt | Options |
51
+ |--------|---------|
52
+ | UI Library | shadcn/ui, Material UI, Ant Design |
53
+ | State Management | Redux Toolkit, Zustand, React Context |
54
+ | API Layer | Fetch, Axios, tRPC |
55
+ | Auth | NextAuth.js, Clerk |
56
+ | Forms | react-hook-form + Zod |
57
+ | Include Examples | Yes / No |
58
+
59
+ ## 📦 What You Get
60
+
61
+ A fully configured Next.js 15 project with:
62
+
63
+ ```
64
+ my-app/
65
+ ├── src/
66
+ │ ├── app/ # App Router pages & layouts
67
+ │ ├── components/ # UI primitives + common components
68
+ │ │ ├── ui/ # Base primitives (button, card, dialog, etc.)
69
+ │ │ ├── common/ # ActionButton, DialogWrapper, DynamicTable, Pagination
70
+ │ │ └── fields/ # CustomField.* (24 types for shadcn, 14 for MUI, 17 for antd)
71
+ │ ├── providers/ # Composable provider wrappers
72
+ │ ├── lib/ # Utilities, types, API clients
73
+ │ └── store/ # State management (if selected)
74
+ ├── public/
75
+ ├── next.config.ts
76
+ ├── tsconfig.json
77
+ └── package.json
78
+ ```
79
+
80
+ ## 🧩 Template Architecture
81
+
82
+ Templates are composable overlays applied in order:
83
+
84
+ ```
85
+ nextjs-base → ui → state → api → auth → forms → shared
86
+ ```
87
+
88
+ Each layer adds its own files and configurations. Later layers can override earlier ones.
89
+
90
+ ## 🛠️ Development
91
+
92
+ This repo itself is a Next.js 15 app that serves as a component lab and documentation site:
93
+
94
+ ```bash
95
+ git clone https://github.com/naimur61/Nexstruct.git
96
+ cd Nexstruct
97
+ npm install
98
+ npm run dev
99
+ ```
100
+
101
+ ## 📄 License
102
+
103
+ MIT © Naimur Rahman
package/package.json ADDED
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "nexstruct",
3
+ "version": "1.0.0",
4
+ "description": "Scaffold production-ready Next.js 15 + TypeScript projects with your choice of UI library, state management, API layer, auth, and forms — all from one interactive CLI.",
5
+ "type": "module",
6
+ "bin": {
7
+ "nexstruct": "./scaffold/index.js"
8
+ },
9
+ "files": [
10
+ "scaffold/",
11
+ "templates/",
12
+ "AGENTS.md",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "dev": "next dev",
18
+ "build": "next build",
19
+ "start": "next start",
20
+ "lint": "next lint",
21
+ "typecheck": "tsc --noEmit"
22
+ },
23
+ "dependencies": {
24
+ "@inquirer/prompts": "^7.0.0",
25
+ "chalk": "^5.3.0",
26
+ "fs-extra": "^11.2.0",
27
+ "ora": "^8.1.0",
28
+ "react-phone-input-2": "^2.15.1"
29
+ },
30
+ "devDependencies": {
31
+ "@eslint/eslintrc": "^3.0.0",
32
+ "@hookform/resolvers": "^3.0.0",
33
+ "@radix-ui/react-avatar": "^1.0.0",
34
+ "@radix-ui/react-checkbox": "^1.0.0",
35
+ "@radix-ui/react-dialog": "^1.0.0",
36
+ "@radix-ui/react-dropdown-menu": "^2.0.0",
37
+ "@radix-ui/react-label": "^2.0.0",
38
+ "@radix-ui/react-popover": "^1.0.0",
39
+ "@radix-ui/react-progress": "^1.0.0",
40
+ "@radix-ui/react-radio-group": "^1.0.0",
41
+ "@radix-ui/react-scroll-area": "^1.0.0",
42
+ "@radix-ui/react-select": "^2.0.0",
43
+ "@radix-ui/react-separator": "^1.0.0",
44
+ "@radix-ui/react-slot": "^1.0.0",
45
+ "@radix-ui/react-switch": "^1.0.0",
46
+ "@radix-ui/react-tabs": "^1.0.0",
47
+ "@radix-ui/react-toast": "^1.0.0",
48
+ "@radix-ui/react-tooltip": "^1.0.0",
49
+ "@types/node": "^20.0.0",
50
+ "@types/react": "^18.3.0",
51
+ "@types/react-dom": "^18.3.0",
52
+ "autoprefixer": "^10.0.0",
53
+ "class-variance-authority": "^0.7.0",
54
+ "clsx": "^2.0.0",
55
+ "eslint": "^9.0.0",
56
+ "eslint-config-next": "^15.0.0",
57
+ "fuse.js": "^7.4.2",
58
+ "input-otp": "^1.0.0",
59
+ "lucide-react": "^0.400.0",
60
+ "next": "^15.0.0",
61
+ "next-themes": "^0.4.6",
62
+ "postcss": "^8.0.0",
63
+ "react": "^18.3.0",
64
+ "react-dom": "^18.3.0",
65
+ "react-hook-form": "^7.0.0",
66
+ "tailwind-merge": "^2.0.0",
67
+ "tailwindcss": "^3.4.0",
68
+ "tailwindcss-animate": "^1.0.0",
69
+ "typescript": "^5.4.0",
70
+ "zod": "^3.0.0"
71
+ },
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "git+https://github.com/naimur61/Nexstruct.git"
75
+ },
76
+ "homepage": "https://github.com/naimur61/Nexstruct#readme",
77
+ "bugs": {
78
+ "url": "https://github.com/naimur61/Nexstruct/issues"
79
+ },
80
+ "keywords": [
81
+ "nextjs",
82
+ "nextjs-15",
83
+ "scaffold",
84
+ "cli",
85
+ "typescript",
86
+ "react",
87
+ "shadcn",
88
+ "mui",
89
+ "ant-design",
90
+ "frontend",
91
+ "template",
92
+ "boilerplate"
93
+ ],
94
+ "license": "MIT",
95
+ "author": "Naimur Rahman",
96
+ "engines": {
97
+ "node": ">=18"
98
+ }
99
+ }