create-react-starter-kit 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 (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -0
  3. package/bin/create-react-starter-kit.js +7 -0
  4. package/dist/cli-args.d.ts +15 -0
  5. package/dist/cli-args.d.ts.map +1 -0
  6. package/dist/cli-args.js +78 -0
  7. package/dist/cli-args.js.map +1 -0
  8. package/dist/generator/dependencies.d.ts +8 -0
  9. package/dist/generator/dependencies.d.ts.map +1 -0
  10. package/dist/generator/dependencies.js +356 -0
  11. package/dist/generator/dependencies.js.map +1 -0
  12. package/dist/generator/index.d.ts +5 -0
  13. package/dist/generator/index.d.ts.map +1 -0
  14. package/dist/generator/index.js +358 -0
  15. package/dist/generator/index.js.map +1 -0
  16. package/dist/index.d.ts +3 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +38 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/prompts/index.d.ts +3 -0
  21. package/dist/prompts/index.d.ts.map +1 -0
  22. package/dist/prompts/index.js +267 -0
  23. package/dist/prompts/index.js.map +1 -0
  24. package/dist/templates/.env.example.ejs +21 -0
  25. package/dist/templates/.husky/commit-msg +2 -0
  26. package/dist/templates/.husky/pre-commit +2 -0
  27. package/dist/templates/README.md.ejs +169 -0
  28. package/dist/templates/__js__/jsconfig.json +9 -0
  29. package/dist/templates/__ts__/src/vite-env.d.ts +16 -0
  30. package/dist/templates/__ts__/tsconfig.json +24 -0
  31. package/dist/templates/__when_buildTool_esbuild__/scripts/esbuild.build.mjs.ejs +23 -0
  32. package/dist/templates/__when_buildTool_esbuild__/scripts/esbuild.dev.mjs.ejs +48 -0
  33. package/dist/templates/__when_buildTool_parcel__/.parcelrc +9 -0
  34. package/dist/templates/__when_buildTool_rollup__/rollup.config.js.ejs +33 -0
  35. package/dist/templates/__when_buildTool_rspack__/rspack.config.js.ejs +36 -0
  36. package/dist/templates/__when_buildTool_vite__/vite.config.ts.ejs +37 -0
  37. package/dist/templates/__when_buildTool_webpack__/webpack.config.js.ejs +68 -0
  38. package/dist/templates/__when_e2eTesting_cypress__/cypress/e2e/home.cy.ts.ejs +6 -0
  39. package/dist/templates/__when_e2eTesting_cypress__/cypress.config.ts.ejs +8 -0
  40. package/dist/templates/__when_e2eTesting_playwright__/playwright.config.ts.ejs +16 -0
  41. package/dist/templates/__when_e2eTesting_playwright__/tests/e2e/home.spec.ts.ejs +6 -0
  42. package/dist/templates/__when_formatting_prettier__/.prettierrc +7 -0
  43. package/dist/templates/__when_formatting_stylelint__/.stylelintrc.json +3 -0
  44. package/dist/templates/__when_linting_biome__/biome.json +19 -0
  45. package/dist/templates/__when_linting_eslint__/eslint.config.js.ejs +42 -0
  46. package/dist/templates/__when_serverState_rtk-query__/src/store/postsApi.ts.ejs +19 -0
  47. package/dist/templates/__when_stateManagement_context__/src/store/context.tsx.ejs +57 -0
  48. package/dist/templates/__when_styling_tailwind__/postcss.config.js +6 -0
  49. package/dist/templates/__when_styling_tailwind__/tailwind.config.js.ejs +23 -0
  50. package/dist/templates/__when_unitTesting_jest__/jest.config.json.ejs +11 -0
  51. package/dist/templates/__when_unitTesting_jest__/tests/App.test.tsx.ejs +13 -0
  52. package/dist/templates/__when_unitTesting_jest__/tests/setup.ts.ejs +1 -0
  53. package/dist/templates/__when_unitTesting_jest__/tests/styleMock.ts.ejs +1 -0
  54. package/dist/templates/__when_unitTesting_rtl__/tests/App.test.tsx.ejs +13 -0
  55. package/dist/templates/__when_unitTesting_vitest__/tests/App.test.tsx.ejs +16 -0
  56. package/dist/templates/__when_unitTesting_vitest__/tests/setup.ts.ejs +1 -0
  57. package/dist/templates/__when_visualTesting_storybook__/.storybook/main.js.ejs +11 -0
  58. package/dist/templates/__when_visualTesting_storybook__/.storybook/preview.js +8 -0
  59. package/dist/templates/__when_visualTesting_storybook__/src/components/ui/UiButton.stories.tsx.ejs +15 -0
  60. package/dist/templates/commitlint.config.js +3 -0
  61. package/dist/templates/docs/architecture.md.ejs +74 -0
  62. package/dist/templates/docs/best-practices.md.ejs +56 -0
  63. package/dist/templates/docs/examples/README.md.ejs +14 -0
  64. package/dist/templates/docs/examples/api.md.ejs +17 -0
  65. package/dist/templates/docs/examples/data-fetching.md.ejs +18 -0
  66. package/dist/templates/docs/examples/forms.md.ejs +18 -0
  67. package/dist/templates/docs/examples/state.md.ejs +17 -0
  68. package/dist/templates/docs/examples/styling.md.ejs +23 -0
  69. package/dist/templates/docs/examples/testing.md.ejs +27 -0
  70. package/dist/templates/docs/getting-started.md.ejs +55 -0
  71. package/dist/templates/docs/selected-stack.md.ejs +55 -0
  72. package/dist/templates/index.html.ejs +19 -0
  73. package/dist/templates/public/vite.svg +4 -0
  74. package/dist/templates/src/app/App.tsx.ejs +71 -0
  75. package/dist/templates/src/app/providers.tsx.ejs +93 -0
  76. package/dist/templates/src/assets/.gitkeep +0 -0
  77. package/dist/templates/src/components/StackBadge.tsx.ejs +15 -0
  78. package/dist/templates/src/components/layout/AppLayout.tsx.ejs +64 -0
  79. package/dist/templates/src/components/ui/Toast.tsx.ejs +61 -0
  80. package/dist/templates/src/components/ui/UiButton.tsx.ejs +168 -0
  81. package/dist/templates/src/config/env.ts.ejs +18 -0
  82. package/dist/templates/src/features/counter/CounterPanel.tsx.ejs +66 -0
  83. package/dist/templates/src/features/feedback/FeedbackForm.tsx.ejs +373 -0
  84. package/dist/templates/src/features/posts/PostsPanel.tsx.ejs +91 -0
  85. package/dist/templates/src/hooks/useMounted.ts.ejs +15 -0
  86. package/dist/templates/src/lib/cn.ts.ejs +12 -0
  87. package/dist/templates/src/lib/monitoring.ts.ejs +66 -0
  88. package/dist/templates/src/lib/validation.ts.ejs +81 -0
  89. package/dist/templates/src/main.tsx.ejs +22 -0
  90. package/dist/templates/src/routes/AboutPage.tsx.ejs +30 -0
  91. package/dist/templates/src/routes/HomePage.tsx.ejs +47 -0
  92. package/dist/templates/src/services/api.ts.ejs +84 -0
  93. package/dist/templates/src/store/index.ts.ejs +80 -0
  94. package/dist/templates/src/styles/global.css.ejs +457 -0
  95. package/dist/templates/src/types/index.ts.ejs +7 -0
  96. package/dist/templates/src/utils/format.ts.ejs +3 -0
  97. package/dist/types.d.ts +46 -0
  98. package/dist/types.d.ts.map +1 -0
  99. package/dist/types.js +2 -0
  100. package/dist/types.js.map +1 -0
  101. package/dist/utils/logger.d.ts +12 -0
  102. package/dist/utils/logger.d.ts.map +1 -0
  103. package/dist/utils/logger.js +31 -0
  104. package/dist/utils/logger.js.map +1 -0
  105. package/dist/utils/validate.d.ts +3 -0
  106. package/dist/utils/validate.d.ts.map +1 -0
  107. package/dist/utils/validate.js +24 -0
  108. package/dist/utils/validate.js.map +1 -0
  109. package/package.json +62 -0
  110. package/templates/.env.example.ejs +21 -0
  111. package/templates/.husky/commit-msg +2 -0
  112. package/templates/.husky/pre-commit +2 -0
  113. package/templates/README.md.ejs +169 -0
  114. package/templates/__js__/jsconfig.json +9 -0
  115. package/templates/__ts__/src/vite-env.d.ts +16 -0
  116. package/templates/__ts__/tsconfig.json +24 -0
  117. package/templates/__when_buildTool_esbuild__/scripts/esbuild.build.mjs.ejs +23 -0
  118. package/templates/__when_buildTool_esbuild__/scripts/esbuild.dev.mjs.ejs +48 -0
  119. package/templates/__when_buildTool_parcel__/.parcelrc +9 -0
  120. package/templates/__when_buildTool_rollup__/rollup.config.js.ejs +33 -0
  121. package/templates/__when_buildTool_rspack__/rspack.config.js.ejs +36 -0
  122. package/templates/__when_buildTool_vite__/vite.config.ts.ejs +37 -0
  123. package/templates/__when_buildTool_webpack__/webpack.config.js.ejs +68 -0
  124. package/templates/__when_e2eTesting_cypress__/cypress/e2e/home.cy.ts.ejs +6 -0
  125. package/templates/__when_e2eTesting_cypress__/cypress.config.ts.ejs +8 -0
  126. package/templates/__when_e2eTesting_playwright__/playwright.config.ts.ejs +16 -0
  127. package/templates/__when_e2eTesting_playwright__/tests/e2e/home.spec.ts.ejs +6 -0
  128. package/templates/__when_formatting_prettier__/.prettierrc +7 -0
  129. package/templates/__when_formatting_stylelint__/.stylelintrc.json +3 -0
  130. package/templates/__when_linting_biome__/biome.json +19 -0
  131. package/templates/__when_linting_eslint__/eslint.config.js.ejs +42 -0
  132. package/templates/__when_serverState_rtk-query__/src/store/postsApi.ts.ejs +19 -0
  133. package/templates/__when_stateManagement_context__/src/store/context.tsx.ejs +57 -0
  134. package/templates/__when_styling_tailwind__/postcss.config.js +6 -0
  135. package/templates/__when_styling_tailwind__/tailwind.config.js.ejs +23 -0
  136. package/templates/__when_unitTesting_jest__/jest.config.json.ejs +11 -0
  137. package/templates/__when_unitTesting_jest__/tests/App.test.tsx.ejs +13 -0
  138. package/templates/__when_unitTesting_jest__/tests/setup.ts.ejs +1 -0
  139. package/templates/__when_unitTesting_jest__/tests/styleMock.ts.ejs +1 -0
  140. package/templates/__when_unitTesting_rtl__/tests/App.test.tsx.ejs +13 -0
  141. package/templates/__when_unitTesting_vitest__/tests/App.test.tsx.ejs +16 -0
  142. package/templates/__when_unitTesting_vitest__/tests/setup.ts.ejs +1 -0
  143. package/templates/__when_visualTesting_storybook__/.storybook/main.js.ejs +11 -0
  144. package/templates/__when_visualTesting_storybook__/.storybook/preview.js +8 -0
  145. package/templates/__when_visualTesting_storybook__/src/components/ui/UiButton.stories.tsx.ejs +15 -0
  146. package/templates/commitlint.config.js +3 -0
  147. package/templates/docs/architecture.md.ejs +74 -0
  148. package/templates/docs/best-practices.md.ejs +56 -0
  149. package/templates/docs/examples/README.md.ejs +14 -0
  150. package/templates/docs/examples/api.md.ejs +17 -0
  151. package/templates/docs/examples/data-fetching.md.ejs +18 -0
  152. package/templates/docs/examples/forms.md.ejs +18 -0
  153. package/templates/docs/examples/state.md.ejs +17 -0
  154. package/templates/docs/examples/styling.md.ejs +23 -0
  155. package/templates/docs/examples/testing.md.ejs +27 -0
  156. package/templates/docs/getting-started.md.ejs +55 -0
  157. package/templates/docs/selected-stack.md.ejs +55 -0
  158. package/templates/index.html.ejs +19 -0
  159. package/templates/public/vite.svg +4 -0
  160. package/templates/src/app/App.tsx.ejs +71 -0
  161. package/templates/src/app/providers.tsx.ejs +93 -0
  162. package/templates/src/assets/.gitkeep +0 -0
  163. package/templates/src/components/StackBadge.tsx.ejs +15 -0
  164. package/templates/src/components/layout/AppLayout.tsx.ejs +64 -0
  165. package/templates/src/components/ui/Toast.tsx.ejs +61 -0
  166. package/templates/src/components/ui/UiButton.tsx.ejs +168 -0
  167. package/templates/src/config/env.ts.ejs +18 -0
  168. package/templates/src/features/counter/CounterPanel.tsx.ejs +66 -0
  169. package/templates/src/features/feedback/FeedbackForm.tsx.ejs +373 -0
  170. package/templates/src/features/posts/PostsPanel.tsx.ejs +91 -0
  171. package/templates/src/hooks/useMounted.ts.ejs +15 -0
  172. package/templates/src/lib/cn.ts.ejs +12 -0
  173. package/templates/src/lib/monitoring.ts.ejs +66 -0
  174. package/templates/src/lib/validation.ts.ejs +81 -0
  175. package/templates/src/main.tsx.ejs +22 -0
  176. package/templates/src/routes/AboutPage.tsx.ejs +30 -0
  177. package/templates/src/routes/HomePage.tsx.ejs +47 -0
  178. package/templates/src/services/api.ts.ejs +84 -0
  179. package/templates/src/store/index.ts.ejs +80 -0
  180. package/templates/src/styles/global.css.ejs +457 -0
  181. package/templates/src/types/index.ts.ejs +7 -0
  182. package/templates/src/utils/format.ts.ejs +3 -0
@@ -0,0 +1,30 @@
1
+ export function AboutPage() {
2
+ return (
3
+ <div className="page about-page">
4
+ <h1>About this starter</h1>
5
+ <p>
6
+ Generated with <strong>create-react-starter-kit</strong> using a scalable{' '}
7
+ <strong>feature-based</strong> layout (domain modules under <code>src/features</code>) —
8
+ the same organizational approach used across large production React codebases.
9
+ </p>
10
+ <ul className="about-list">
11
+ <li>
12
+ <strong>Extend features</strong> under <code>src/features/&lt;name&gt;/</code> — keep
13
+ domain logic close to the UI that owns it.
14
+ </li>
15
+ <li>
16
+ <strong>Shared primitives</strong> live in <code>src/components/</code> and{' '}
17
+ <code>src/lib/</code>. Prefer imports via the <code>@/</code> path alias.
18
+ </li>
19
+ <li>
20
+ <strong>Docs</strong> in <code>docs/</code> explain architecture, testing, and production
21
+ habits for this stack.
22
+ </li>
23
+ </ul>
24
+ <p>
25
+ Prefer reading <code>docs/getting-started.md</code> next, then{' '}
26
+ <code>docs/selected-stack.md</code> for library-specific guidance.
27
+ </p>
28
+ </div>
29
+ );
30
+ }
@@ -0,0 +1,47 @@
1
+ import { CounterPanel } from '@/features/counter/CounterPanel';
2
+ import { PostsPanel } from '@/features/posts/PostsPanel';
3
+ import { FeedbackForm } from '@/features/feedback/FeedbackForm';
4
+ import { StackBadge } from '@/components/StackBadge';
5
+ import { useToast } from '@/components/ui/Toast';
6
+ import { UiButton } from '@/components/ui/UiButton';
7
+
8
+ export function HomePage() {
9
+ const { push } = useToast();
10
+
11
+ return (
12
+ <div className="page home-page">
13
+ <section className="hero">
14
+ <p className="eyebrow">Starter workspace</p>
15
+ <h1><%= projectName %></h1>
16
+ <p className="lede">
17
+ A minimal, production-shaped React app wired for your selected stack. Explore the panels
18
+ below — each one is a real usage example, not a placeholder.
19
+ </p>
20
+ <div className="hero-actions">
21
+ <UiButton onClick={() => push('Toast system is ready', 'success')}>
22
+ Show toast
23
+ </UiButton>
24
+ <a className="text-link" href="/about">
25
+ Read about the stack →
26
+ </a>
27
+ </div>
28
+ <div className="stack-row">
29
+ <StackBadge label="Build" value="<%= stackLabels.buildTool %>" />
30
+ <StackBadge label="Language" value="<%= stackLabels.language %>" />
31
+ <StackBadge label="Router" value="<%= stackLabels.router %>" />
32
+ <StackBadge label="State" value="<%= stackLabels.stateManagement %>" />
33
+ <StackBadge label="Data" value="<%= stackLabels.serverState %>" />
34
+ <StackBadge label="UI" value="<%= stackLabels.uiLibrary %>" />
35
+ </div>
36
+ </section>
37
+
38
+ <section className="panels">
39
+ <% if (stateManagement !== 'none') { -%>
40
+ <CounterPanel />
41
+ <% } -%>
42
+ <PostsPanel />
43
+ <FeedbackForm />
44
+ </section>
45
+ </div>
46
+ );
47
+ }
@@ -0,0 +1,84 @@
1
+ <% if (apiLayer === 'axios') { -%>
2
+ import axios from 'axios';
3
+ import { env } from '@/config/env';
4
+
5
+ const baseURL = env.apiBaseUrl;
6
+
7
+ export const apiClient = axios.create({
8
+ baseURL,
9
+ headers: { 'Content-Type': 'application/json' },
10
+ timeout: 10_000,
11
+ });
12
+
13
+ apiClient.interceptors.response.use(
14
+ (response) => response,
15
+ (error) => {
16
+ console.error('[api]', error);
17
+ return Promise.reject(error);
18
+ },
19
+ );
20
+
21
+ export async function apiGet<% if (isTypeScript) { %><T = unknown><% } %>(path<% if (isTypeScript) { %>: string<% } %>)<% if (isTypeScript) { %>: Promise<T><% } %> {
22
+ const { data } = await apiClient.get<% if (isTypeScript) { %><T><% } %>(path);
23
+ return data;
24
+ }
25
+
26
+ export async function apiPost<% if (isTypeScript) { %><T = unknown, B = unknown><% } %>(
27
+ path<% if (isTypeScript) { %>: string<% } %>,
28
+ body<% if (isTypeScript) { %>: B<% } %>,
29
+ )<% if (isTypeScript) { %>: Promise<T><% } %> {
30
+ const { data } = await apiClient.post<% if (isTypeScript) { %><T><% } %>(path, body);
31
+ return data;
32
+ }
33
+ <% } else { -%>
34
+ import { env } from '@/config/env';
35
+
36
+ const baseURL = env.apiBaseUrl;
37
+
38
+ async function request<% if (isTypeScript) { %><T = unknown><% } %>(
39
+ path<% if (isTypeScript) { %>: string<% } %>,
40
+ init<% if (isTypeScript) { %>?: RequestInit<% } %>,
41
+ )<% if (isTypeScript) { %>: Promise<T><% } %> {
42
+ const response = await fetch(`${baseURL}${path}`, {
43
+ headers: { 'Content-Type': 'application/json', ...(init?.headers ?? {}) },
44
+ ...init,
45
+ });
46
+
47
+ if (!response.ok) {
48
+ throw new Error(`Request failed: ${response.status}`);
49
+ }
50
+
51
+ return response.json();
52
+ }
53
+
54
+ export async function apiGet<% if (isTypeScript) { %><T = unknown><% } %>(path<% if (isTypeScript) { %>: string<% } %>)<% if (isTypeScript) { %>: Promise<T><% } %> {
55
+ return request<% if (isTypeScript) { %><T><% } %>(path);
56
+ }
57
+
58
+ export async function apiPost<% if (isTypeScript) { %><T = unknown, B = unknown><% } %>(
59
+ path<% if (isTypeScript) { %>: string<% } %>,
60
+ body<% if (isTypeScript) { %>: B<% } %>,
61
+ )<% if (isTypeScript) { %>: Promise<T><% } %> {
62
+ return request<% if (isTypeScript) { %><T><% } %>(path, {
63
+ method: 'POST',
64
+ body: JSON.stringify(body),
65
+ });
66
+ }
67
+ <% } -%>
68
+
69
+ <% if (isTypeScript) { -%>
70
+ export interface Post {
71
+ userId: number;
72
+ id: number;
73
+ title: string;
74
+ body: string;
75
+ }
76
+ <% } -%>
77
+
78
+ export async function fetchPosts() {
79
+ return apiGet<% if (isTypeScript) { %><Post[]><% } %>('/posts?_limit=5');
80
+ }
81
+
82
+ export async function createFeedback(payload<% if (isTypeScript) { %>: { name: string; email: string; message: string }<% } %>) {
83
+ return apiPost('/posts', payload);
84
+ }
@@ -0,0 +1,80 @@
1
+ <% if (stateManagement === 'redux') { -%>
2
+ import { configureStore, createSlice } from '@reduxjs/toolkit';
3
+ <% if (isTypeScript) { -%>
4
+ import type { PayloadAction } from '@reduxjs/toolkit';
5
+ <% } -%>
6
+ <% if (serverState === 'rtk-query') { -%>
7
+ import { postsApi } from './postsApi';
8
+ <% } -%>
9
+
10
+ <% if (isTypeScript) { -%>
11
+ interface CounterState {
12
+ value: number;
13
+ }
14
+ <% } -%>
15
+
16
+ const initialState<% if (isTypeScript) { %>: CounterState<% } %> = { value: 0 };
17
+
18
+ const counterSlice = createSlice({
19
+ name: 'counter',
20
+ initialState,
21
+ reducers: {
22
+ increment(state) {
23
+ state.value += 1;
24
+ },
25
+ decrement(state) {
26
+ state.value -= 1;
27
+ },
28
+ setValue(state, action<% if (isTypeScript) { %>: PayloadAction<number><% } %>) {
29
+ state.value = action.payload;
30
+ },
31
+ },
32
+ });
33
+
34
+ export const { increment, decrement, setValue } = counterSlice.actions;
35
+
36
+ export const store = configureStore({
37
+ reducer: {
38
+ counter: counterSlice.reducer,
39
+ <% if (serverState === 'rtk-query') { -%>
40
+ [postsApi.reducerPath]: postsApi.reducer,
41
+ <% } -%>
42
+ },
43
+ <% if (serverState === 'rtk-query') { -%>
44
+ middleware: (getDefaultMiddleware) =>
45
+ getDefaultMiddleware().concat(postsApi.middleware),
46
+ <% } -%>
47
+ });
48
+
49
+ <% if (isTypeScript) { -%>
50
+ export type RootState = ReturnType<typeof store.getState>;
51
+ export type AppDispatch = typeof store.dispatch;
52
+ <% } -%>
53
+ <% } else if (stateManagement === 'zustand') { -%>
54
+ import { create } from 'zustand';
55
+
56
+ <% if (isTypeScript) { -%>
57
+ interface CounterStore {
58
+ value: number;
59
+ increment: () => void;
60
+ decrement: () => void;
61
+ setValue: (value: number) => void;
62
+ }
63
+ <% } -%>
64
+
65
+ export const useCounterStore = create<% if (isTypeScript) { %><CounterStore><% } %>((set) => ({
66
+ value: 0,
67
+ increment: () => set((state) => ({ value: state.value + 1 })),
68
+ decrement: () => set((state) => ({ value: state.value - 1 })),
69
+ setValue: (value) => set({ value }),
70
+ }));
71
+ <% } else if (stateManagement === 'jotai') { -%>
72
+ import { atom } from 'jotai';
73
+
74
+ export const counterAtom = atom(0);
75
+ <% } else if (stateManagement === 'context') { -%>
76
+ export { AppStateProvider, useAppState } from './context';
77
+ <% } else { -%>
78
+ // Client state management was set to "None".
79
+ export {};
80
+ <% } -%>