create-aws-project 1.2.1

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 (181) hide show
  1. package/README.md +118 -0
  2. package/dist/__tests__/generator/replace-tokens.spec.d.ts +1 -0
  3. package/dist/__tests__/generator/replace-tokens.spec.js +281 -0
  4. package/dist/__tests__/generator.spec.d.ts +1 -0
  5. package/dist/__tests__/generator.spec.js +162 -0
  6. package/dist/__tests__/validation/project-name.spec.d.ts +1 -0
  7. package/dist/__tests__/validation/project-name.spec.js +57 -0
  8. package/dist/__tests__/wizard.spec.d.ts +1 -0
  9. package/dist/__tests__/wizard.spec.js +232 -0
  10. package/dist/aws/iam.d.ts +75 -0
  11. package/dist/aws/iam.js +264 -0
  12. package/dist/aws/organizations.d.ts +79 -0
  13. package/dist/aws/organizations.js +168 -0
  14. package/dist/cli.d.ts +4 -0
  15. package/dist/cli.js +206 -0
  16. package/dist/commands/setup-github.d.ts +4 -0
  17. package/dist/commands/setup-github.js +185 -0
  18. package/dist/generator/copy-file.d.ts +15 -0
  19. package/dist/generator/copy-file.js +56 -0
  20. package/dist/generator/generate-project.d.ts +14 -0
  21. package/dist/generator/generate-project.js +81 -0
  22. package/dist/generator/index.d.ts +4 -0
  23. package/dist/generator/index.js +3 -0
  24. package/dist/generator/replace-tokens.d.ts +29 -0
  25. package/dist/generator/replace-tokens.js +68 -0
  26. package/dist/github/secrets.d.ts +109 -0
  27. package/dist/github/secrets.js +275 -0
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.js +6 -0
  30. package/dist/prompts/auth.d.ts +3 -0
  31. package/dist/prompts/auth.js +23 -0
  32. package/dist/prompts/aws-config.d.ts +2 -0
  33. package/dist/prompts/aws-config.js +14 -0
  34. package/dist/prompts/features.d.ts +2 -0
  35. package/dist/prompts/features.js +10 -0
  36. package/dist/prompts/github-setup.d.ts +53 -0
  37. package/dist/prompts/github-setup.js +208 -0
  38. package/dist/prompts/org-structure.d.ts +9 -0
  39. package/dist/prompts/org-structure.js +93 -0
  40. package/dist/prompts/platforms.d.ts +2 -0
  41. package/dist/prompts/platforms.js +12 -0
  42. package/dist/prompts/project-name.d.ts +2 -0
  43. package/dist/prompts/project-name.js +8 -0
  44. package/dist/prompts/theme.d.ts +2 -0
  45. package/dist/prompts/theme.js +14 -0
  46. package/dist/templates/index.d.ts +4 -0
  47. package/dist/templates/index.js +2 -0
  48. package/dist/templates/manifest.d.ts +11 -0
  49. package/dist/templates/manifest.js +99 -0
  50. package/dist/templates/tokens.d.ts +39 -0
  51. package/dist/templates/tokens.js +37 -0
  52. package/dist/templates/types.d.ts +52 -0
  53. package/dist/templates/types.js +1 -0
  54. package/dist/types.d.ts +27 -0
  55. package/dist/types.js +1 -0
  56. package/dist/validation/project-name.d.ts +1 -0
  57. package/dist/validation/project-name.js +12 -0
  58. package/dist/wizard.d.ts +2 -0
  59. package/dist/wizard.js +81 -0
  60. package/package.json +68 -0
  61. package/templates/.github/actions/build-and-test/action.yml +24 -0
  62. package/templates/.github/actions/deploy-cdk/action.yml +46 -0
  63. package/templates/.github/actions/deploy-web/action.yml +72 -0
  64. package/templates/.github/actions/setup/action.yml +29 -0
  65. package/templates/.github/pull_request_template.md +15 -0
  66. package/templates/.github/workflows/deploy-dev.yml +80 -0
  67. package/templates/.github/workflows/deploy-prod.yml +67 -0
  68. package/templates/.github/workflows/deploy-stage.yml +77 -0
  69. package/templates/.github/workflows/pull-request.yml +72 -0
  70. package/templates/.vscode/extensions.json +7 -0
  71. package/templates/.vscode/settings.json +67 -0
  72. package/templates/apps/api/.eslintrc.json +18 -0
  73. package/templates/apps/api/cdk/app.ts +93 -0
  74. package/templates/apps/api/cdk/auth/cognito-stack.ts +164 -0
  75. package/templates/apps/api/cdk/cdk.json +73 -0
  76. package/templates/apps/api/cdk/deployment-user-stack.ts +187 -0
  77. package/templates/apps/api/cdk/org-stack.ts +67 -0
  78. package/templates/apps/api/cdk/static-stack.ts +361 -0
  79. package/templates/apps/api/cdk/tsconfig.json +39 -0
  80. package/templates/apps/api/cdk/user-stack.ts +255 -0
  81. package/templates/apps/api/jest.config.ts +38 -0
  82. package/templates/apps/api/lambdas.yml +84 -0
  83. package/templates/apps/api/project.json.template +58 -0
  84. package/templates/apps/api/src/__tests__/setup.ts +10 -0
  85. package/templates/apps/api/src/handlers/users/create-user.ts +52 -0
  86. package/templates/apps/api/src/handlers/users/delete-user.ts +45 -0
  87. package/templates/apps/api/src/handlers/users/get-me.ts +72 -0
  88. package/templates/apps/api/src/handlers/users/get-user.ts +45 -0
  89. package/templates/apps/api/src/handlers/users/get-users.ts +23 -0
  90. package/templates/apps/api/src/handlers/users/index.ts +17 -0
  91. package/templates/apps/api/src/handlers/users/update-user.ts +72 -0
  92. package/templates/apps/api/src/lib/dynamo/dynamo-model.ts +504 -0
  93. package/templates/apps/api/src/lib/dynamo/index.ts +12 -0
  94. package/templates/apps/api/src/lib/dynamo/utils.ts +39 -0
  95. package/templates/apps/api/src/middleware/auth0-auth.ts +97 -0
  96. package/templates/apps/api/src/middleware/cognito-auth.ts +90 -0
  97. package/templates/apps/api/src/models/UserModel.ts +109 -0
  98. package/templates/apps/api/src/schemas/user.schema.ts +44 -0
  99. package/templates/apps/api/src/services/user-service.ts +108 -0
  100. package/templates/apps/api/src/utils/auth-context.ts +60 -0
  101. package/templates/apps/api/src/utils/common/helpers.ts +26 -0
  102. package/templates/apps/api/src/utils/lambda-handler.ts +148 -0
  103. package/templates/apps/api/src/utils/response.ts +52 -0
  104. package/templates/apps/api/src/utils/validator.ts +75 -0
  105. package/templates/apps/api/tsconfig.app.json +15 -0
  106. package/templates/apps/api/tsconfig.json +19 -0
  107. package/templates/apps/api/tsconfig.spec.json +17 -0
  108. package/templates/apps/mobile/.env.example +5 -0
  109. package/templates/apps/mobile/.eslintrc.json +33 -0
  110. package/templates/apps/mobile/app.json +33 -0
  111. package/templates/apps/mobile/assets/.gitkeep +0 -0
  112. package/templates/apps/mobile/babel.config.js +19 -0
  113. package/templates/apps/mobile/index.js +7 -0
  114. package/templates/apps/mobile/jest.config.ts +22 -0
  115. package/templates/apps/mobile/metro.config.js +35 -0
  116. package/templates/apps/mobile/package.json +22 -0
  117. package/templates/apps/mobile/project.json.template +64 -0
  118. package/templates/apps/mobile/src/App.tsx +367 -0
  119. package/templates/apps/mobile/src/__tests__/App.spec.tsx +46 -0
  120. package/templates/apps/mobile/src/__tests__/store/user-store.spec.ts +156 -0
  121. package/templates/apps/mobile/src/config/api.ts +16 -0
  122. package/templates/apps/mobile/src/store/user-store.ts +56 -0
  123. package/templates/apps/mobile/src/test-setup.ts +10 -0
  124. package/templates/apps/mobile/tsconfig.json +22 -0
  125. package/templates/apps/web/.env.example +13 -0
  126. package/templates/apps/web/.eslintrc.json +26 -0
  127. package/templates/apps/web/index.html +13 -0
  128. package/templates/apps/web/jest.config.ts +24 -0
  129. package/templates/apps/web/package.json +15 -0
  130. package/templates/apps/web/project.json.template +66 -0
  131. package/templates/apps/web/src/App.tsx +352 -0
  132. package/templates/apps/web/src/__mocks__/config/api.ts +41 -0
  133. package/templates/apps/web/src/__tests__/App.spec.tsx +240 -0
  134. package/templates/apps/web/src/__tests__/store/user-store.spec.ts +185 -0
  135. package/templates/apps/web/src/auth/auth0-provider.tsx +103 -0
  136. package/templates/apps/web/src/auth/cognito-provider.tsx +143 -0
  137. package/templates/apps/web/src/auth/index.ts +7 -0
  138. package/templates/apps/web/src/auth/use-auth.ts +16 -0
  139. package/templates/apps/web/src/config/amplify-config.ts +31 -0
  140. package/templates/apps/web/src/config/api.ts +38 -0
  141. package/templates/apps/web/src/config/auth0-config.ts +17 -0
  142. package/templates/apps/web/src/main.tsx +41 -0
  143. package/templates/apps/web/src/store/user-store.ts +56 -0
  144. package/templates/apps/web/src/styles.css +165 -0
  145. package/templates/apps/web/src/test-setup.ts +1 -0
  146. package/templates/apps/web/src/theme/index.ts +30 -0
  147. package/templates/apps/web/src/vite-env.d.ts +19 -0
  148. package/templates/apps/web/tsconfig.app.json +24 -0
  149. package/templates/apps/web/tsconfig.json +22 -0
  150. package/templates/apps/web/tsconfig.spec.json +28 -0
  151. package/templates/apps/web/vite.config.ts +87 -0
  152. package/templates/manifest.json +28 -0
  153. package/templates/packages/api-client/.eslintrc.json +18 -0
  154. package/templates/packages/api-client/jest.config.ts +13 -0
  155. package/templates/packages/api-client/package.json +8 -0
  156. package/templates/packages/api-client/project.json.template +34 -0
  157. package/templates/packages/api-client/src/__tests__/api-client.spec.ts +408 -0
  158. package/templates/packages/api-client/src/api-client.ts +201 -0
  159. package/templates/packages/api-client/src/config.ts +193 -0
  160. package/templates/packages/api-client/src/index.ts +9 -0
  161. package/templates/packages/api-client/tsconfig.json +22 -0
  162. package/templates/packages/api-client/tsconfig.lib.json +11 -0
  163. package/templates/packages/api-client/tsconfig.spec.json +14 -0
  164. package/templates/packages/common-types/.eslintrc.json +18 -0
  165. package/templates/packages/common-types/package.json +6 -0
  166. package/templates/packages/common-types/project.json.template +26 -0
  167. package/templates/packages/common-types/src/api.types.ts +24 -0
  168. package/templates/packages/common-types/src/auth.types.ts +36 -0
  169. package/templates/packages/common-types/src/common.types.ts +46 -0
  170. package/templates/packages/common-types/src/index.ts +19 -0
  171. package/templates/packages/common-types/src/lambda.types.ts +39 -0
  172. package/templates/packages/common-types/src/user.types.ts +31 -0
  173. package/templates/packages/common-types/tsconfig.json +19 -0
  174. package/templates/packages/common-types/tsconfig.lib.json +11 -0
  175. package/templates/root/.editorconfig +23 -0
  176. package/templates/root/.nvmrc +1 -0
  177. package/templates/root/eslint.config.js +61 -0
  178. package/templates/root/jest.preset.js +16 -0
  179. package/templates/root/nx.json +29 -0
  180. package/templates/root/package.json +131 -0
  181. package/templates/root/tsconfig.base.json +29 -0
@@ -0,0 +1,31 @@
1
+ import { Amplify } from 'aws-amplify';
2
+
3
+ /**
4
+ * Configure Amplify with Cognito settings
5
+ * Values should be set via environment variables
6
+ */
7
+ export function configureAmplify(): void {
8
+ Amplify.configure({
9
+ Auth: {
10
+ Cognito: {
11
+ userPoolId: import.meta.env.VITE_COGNITO_USER_POOL_ID,
12
+ userPoolClientId: import.meta.env.VITE_COGNITO_CLIENT_ID,
13
+ // Optional: Identity Pool for AWS credentials
14
+ // identityPoolId: import.meta.env.VITE_COGNITO_IDENTITY_POOL_ID,
15
+ loginWith: {
16
+ email: true,
17
+ },
18
+ signUpVerificationMethod: 'code',
19
+ userAttributes: {
20
+ email: { required: true },
21
+ },
22
+ passwordFormat: {
23
+ minLength: 8,
24
+ requireLowercase: true,
25
+ requireUppercase: true,
26
+ requireNumbers: true,
27
+ },
28
+ },
29
+ },
30
+ });
31
+ }
@@ -0,0 +1,38 @@
1
+ import { createApiClient, createConfig } from '{{PACKAGE_SCOPE}}/api-client';
2
+
3
+ /**
4
+ * API Client instance for the web application
5
+ *
6
+ * Configuration is loaded from environment variables (if available):
7
+ * - VITE_API_BASE_URL: API base URL (optional, auto-detects if not set)
8
+ * - VITE_API_TIMEOUT: Request timeout in milliseconds
9
+ * - VITE_API_KEY: API key for authentication
10
+ * - VITE_API_WITH_CREDENTIALS: Whether to send credentials
11
+ * - VITE_API_DEBUG: Enable debug logging
12
+ *
13
+ * Create a .env.local file in the web app directory with these variables.
14
+ * See .env.example for more details.
15
+ *
16
+ * API URL is automatically derived from current web URL if not set:
17
+ * - Local dev (localhost): http://localhost:3000
18
+ * - Production: https://your-domain.com
19
+ *
20
+ * The API client methods include the /api prefix, so:
21
+ * - Calling getUsers() → https://your-domain.com/api/users
22
+ * - CloudFront routes /api/* to API Gateway
23
+ */
24
+ export const apiClient = createApiClient(createConfig());
25
+
26
+ /**
27
+ * Set authentication token (call this after user login)
28
+ */
29
+ export function setAuthToken(token: string): void {
30
+ apiClient.setAuthToken(token);
31
+ }
32
+
33
+ /**
34
+ * Clear authentication token (call this on logout)
35
+ */
36
+ export function clearAuthToken(): void {
37
+ apiClient.clearAuthToken();
38
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Auth0 configuration
3
+ * Values should be set via environment variables
4
+ */
5
+ export interface Auth0Config {
6
+ domain: string;
7
+ clientId: string;
8
+ audience?: string;
9
+ redirectUri: string;
10
+ }
11
+
12
+ export const auth0Config: Auth0Config = {
13
+ domain: import.meta.env.VITE_AUTH0_DOMAIN || '',
14
+ clientId: import.meta.env.VITE_AUTH0_CLIENT_ID || '',
15
+ audience: import.meta.env.VITE_AUTH0_AUDIENCE || undefined,
16
+ redirectUri: typeof window !== 'undefined' ? window.location.origin : '',
17
+ };
@@ -0,0 +1,41 @@
1
+ import { StrictMode } from 'react';
2
+ import * as ReactDOM from 'react-dom/client';
3
+ import { ChakraProvider } from '@chakra-ui/react';
4
+ // {{#if AUTH_COGNITO}}
5
+ import { Amplify } from 'aws-amplify';
6
+ import { amplifyConfig } from './config/amplify-config';
7
+ import { AuthProvider } from './auth';
8
+ // {{/if AUTH_COGNITO}}
9
+ // {{#if AUTH_AUTH0}}
10
+ import { AuthProvider } from './auth';
11
+ // {{/if AUTH_AUTH0}}
12
+ import App from './App';
13
+ import theme from './theme';
14
+
15
+ // {{#if AUTH_COGNITO}}
16
+ Amplify.configure(amplifyConfig);
17
+ // {{/if AUTH_COGNITO}}
18
+
19
+ const root = ReactDOM.createRoot(
20
+ document.getElementById('root') as HTMLElement
21
+ );
22
+
23
+ root.render(
24
+ <StrictMode>
25
+ <ChakraProvider theme={theme}>
26
+ {/* {{#if AUTH_COGNITO}} */}
27
+ <AuthProvider>
28
+ {/* {{/if AUTH_COGNITO}} */}
29
+ {/* {{#if AUTH_AUTH0}} */}
30
+ <AuthProvider>
31
+ {/* {{/if AUTH_AUTH0}} */}
32
+ <App />
33
+ {/* {{#if AUTH_COGNITO}} */}
34
+ </AuthProvider>
35
+ {/* {{/if AUTH_COGNITO}} */}
36
+ {/* {{#if AUTH_AUTH0}} */}
37
+ </AuthProvider>
38
+ {/* {{/if AUTH_AUTH0}} */}
39
+ </ChakraProvider>
40
+ </StrictMode>
41
+ );
@@ -0,0 +1,56 @@
1
+ import { create } from 'zustand';
2
+ import type { User } from '{{PACKAGE_SCOPE}}/common-types';
3
+
4
+ interface UserState {
5
+ user: User | null;
6
+ users: User[];
7
+ isLoading: boolean;
8
+ error: string | null;
9
+ setUser: (user: User | null) => void;
10
+ setUsers: (users: User[]) => void;
11
+ addUser: (user: User) => void;
12
+ updateUser: (id: string, updates: Partial<User>) => void;
13
+ removeUser: (id: string) => void;
14
+ setLoading: (loading: boolean) => void;
15
+ setError: (error: string | null) => void;
16
+ clearError: () => void;
17
+ }
18
+
19
+ export const useUserStore = create<UserState>((set) => ({
20
+ user: null,
21
+ users: [],
22
+ isLoading: false,
23
+ error: null,
24
+
25
+ setUser: (user) => set({ user }),
26
+
27
+ setUsers: (users) => set({ users }),
28
+
29
+ addUser: (user) =>
30
+ set((state) => ({
31
+ users: [...state.users, user],
32
+ })),
33
+
34
+ updateUser: (id, updates) =>
35
+ set((state) => ({
36
+ users: state.users.map((u) =>
37
+ u.id === id ? { ...u, ...updates } : u
38
+ ),
39
+ user:
40
+ state.user?.id === id
41
+ ? { ...state.user, ...updates }
42
+ : state.user,
43
+ })),
44
+
45
+ removeUser: (id) =>
46
+ set((state) => ({
47
+ users: state.users.filter((u) => u.id !== id),
48
+ user: state.user?.id === id ? null : state.user,
49
+ })),
50
+
51
+ setLoading: (loading) => set({ isLoading: loading }),
52
+
53
+ setError: (error) => set({ error }),
54
+
55
+ clearError: () => set({ error: null }),
56
+ }));
@@ -0,0 +1,165 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ :root {
8
+ --primary-color: #3b82f6;
9
+ --secondary-color: #8b5cf6;
10
+ --background: #0f172a;
11
+ --surface: #1e293b;
12
+ --text: #f1f5f9;
13
+ --text-secondary: #94a3b8;
14
+ --border: #334155;
15
+ --success: #10b981;
16
+ }
17
+
18
+ body {
19
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
20
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
21
+ sans-serif;
22
+ -webkit-font-smoothing: antialiased;
23
+ -moz-osx-font-smoothing: grayscale;
24
+ background: var(--background);
25
+ color: var(--text);
26
+ line-height: 1.6;
27
+ }
28
+
29
+ .app {
30
+ min-height: 100vh;
31
+ display: flex;
32
+ flex-direction: column;
33
+ }
34
+
35
+ .app-header {
36
+ padding: 2rem;
37
+ text-align: center;
38
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
39
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
40
+ }
41
+
42
+ .app-header h1 {
43
+ font-size: 2.5rem;
44
+ margin-bottom: 0.5rem;
45
+ font-weight: 700;
46
+ }
47
+
48
+ .app-header p {
49
+ font-size: 1.1rem;
50
+ opacity: 0.9;
51
+ }
52
+
53
+ .app-main {
54
+ flex: 1;
55
+ padding: 3rem 2rem;
56
+ max-width: 1200px;
57
+ width: 100%;
58
+ margin: 0 auto;
59
+ }
60
+
61
+ .card {
62
+ background: var(--surface);
63
+ border-radius: 12px;
64
+ padding: 2rem;
65
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
66
+ border: 1px solid var(--border);
67
+ }
68
+
69
+ .card h2 {
70
+ font-size: 1.8rem;
71
+ margin-bottom: 1rem;
72
+ color: var(--primary-color);
73
+ }
74
+
75
+ .card p {
76
+ color: var(--text-secondary);
77
+ margin-bottom: 1.5rem;
78
+ }
79
+
80
+ .features {
81
+ margin: 2rem 0;
82
+ padding: 1.5rem;
83
+ background: rgba(59, 130, 246, 0.1);
84
+ border-radius: 8px;
85
+ border: 1px solid rgba(59, 130, 246, 0.2);
86
+ }
87
+
88
+ .features h3 {
89
+ margin-bottom: 1rem;
90
+ color: var(--primary-color);
91
+ }
92
+
93
+ .features ul {
94
+ list-style: none;
95
+ padding: 0;
96
+ }
97
+
98
+ .features li {
99
+ padding: 0.5rem 0;
100
+ font-size: 1.05rem;
101
+ }
102
+
103
+ .user-info {
104
+ margin-top: 2rem;
105
+ padding: 1.5rem;
106
+ background: rgba(16, 185, 129, 0.1);
107
+ border-radius: 8px;
108
+ border: 1px solid rgba(16, 185, 129, 0.2);
109
+ }
110
+
111
+ .user-info h3 {
112
+ color: var(--success);
113
+ margin-bottom: 1rem;
114
+ }
115
+
116
+ .user-info p {
117
+ margin: 0.5rem 0;
118
+ color: var(--text);
119
+ }
120
+
121
+ button {
122
+ margin-top: 1rem;
123
+ padding: 0.75rem 1.5rem;
124
+ font-size: 1rem;
125
+ font-weight: 600;
126
+ color: white;
127
+ background: var(--primary-color);
128
+ border: none;
129
+ border-radius: 8px;
130
+ cursor: pointer;
131
+ transition: all 0.2s;
132
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
133
+ }
134
+
135
+ button:hover {
136
+ background: #2563eb;
137
+ transform: translateY(-2px);
138
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
139
+ }
140
+
141
+ button:active {
142
+ transform: translateY(0);
143
+ }
144
+
145
+ .app-footer {
146
+ padding: 2rem;
147
+ text-align: center;
148
+ background: var(--surface);
149
+ border-top: 1px solid var(--border);
150
+ color: var(--text-secondary);
151
+ }
152
+
153
+ @media (max-width: 768px) {
154
+ .app-header h1 {
155
+ font-size: 2rem;
156
+ }
157
+
158
+ .app-main {
159
+ padding: 2rem 1rem;
160
+ }
161
+
162
+ .card {
163
+ padding: 1.5rem;
164
+ }
165
+ }
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,30 @@
1
+ import { extendTheme, type ThemeConfig, theme as baseTheme } from '@chakra-ui/react';
2
+
3
+ const config: ThemeConfig = {
4
+ initialColorMode: 'dark',
5
+ useSystemColorMode: false,
6
+ };
7
+
8
+ const theme = extendTheme({
9
+ config,
10
+ colors: {
11
+ brand: baseTheme.colors['{{BRAND_COLOR}}'],
12
+ },
13
+ styles: {
14
+ global: {
15
+ body: {
16
+ bg: 'gray.900',
17
+ color: 'white',
18
+ },
19
+ },
20
+ },
21
+ components: {
22
+ Button: {
23
+ defaultProps: {
24
+ colorScheme: 'brand',
25
+ },
26
+ },
27
+ },
28
+ });
29
+
30
+ export default theme;
@@ -0,0 +1,19 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ // Global constants defined in vite.config.ts
4
+ declare const __DEV__: boolean;
5
+ declare const __PROD__: boolean;
6
+
7
+ // Extend ImportMetaEnv with custom environment variables
8
+ interface ImportMetaEnv {
9
+ readonly VITE_API_BASE_URL?: string;
10
+ readonly VITE_API_TIMEOUT?: string;
11
+ readonly VITE_API_KEY?: string;
12
+ readonly VITE_API_WITH_CREDENTIALS?: string;
13
+ readonly VITE_API_DEBUG?: string;
14
+ readonly VITE_DEV_MODE?: string;
15
+ }
16
+
17
+ interface ImportMeta {
18
+ readonly env: ImportMetaEnv;
19
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "types": ["node", "vite/client"]
6
+ },
7
+ "exclude": [
8
+ "**/*.spec.ts",
9
+ "**/*.test.ts",
10
+ "**/*.spec.tsx",
11
+ "**/*.test.tsx",
12
+ "**/*.spec.js",
13
+ "**/*.test.js",
14
+ "**/*.spec.jsx",
15
+ "**/*.test.jsx",
16
+ "src/__mocks__/**/*"
17
+ ],
18
+ "include": [
19
+ "src/**/*.js",
20
+ "src/**/*.jsx",
21
+ "src/**/*.ts",
22
+ "src/**/*.tsx"
23
+ ]
24
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "jsx": "react-jsx",
5
+ "allowJs": false,
6
+ "esModuleInterop": false,
7
+ "allowSyntheticDefaultImports": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "strict": true,
10
+ "noImplicitOverride": true,
11
+ "noPropertyAccessFromIndexSignature": true,
12
+ "noImplicitReturns": true,
13
+ "noFallthroughCasesInSwitch": true
14
+ },
15
+ "files": [],
16
+ "include": [],
17
+ "references": [
18
+ {
19
+ "path": "./tsconfig.app.json"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["jest", "node", "@testing-library/jest-dom"],
7
+ "baseUrl": "../../",
8
+ "paths": {
9
+ "@/config/*": ["apps/web/src/config/*"],
10
+ "@/config/api": ["apps/web/src/__mocks__/config/api.ts"],
11
+ "{{PACKAGE_SCOPE}}/common-types": ["packages/common-types/src/index.ts"],
12
+ "{{PACKAGE_SCOPE}}/api-client": ["packages/api-client/src/index.ts"]
13
+ }
14
+ },
15
+ "include": [
16
+ "**/*.test.ts",
17
+ "**/*.spec.ts",
18
+ "**/*.test.tsx",
19
+ "**/*.spec.tsx",
20
+ "**/*.test.js",
21
+ "**/*.spec.js",
22
+ "**/*.test.jsx",
23
+ "**/*.spec.jsx",
24
+ "**/*.d.ts",
25
+ "src/test-setup.ts",
26
+ "src/__mocks__/**/*.ts"
27
+ ]
28
+ }
@@ -0,0 +1,87 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
4
+ import * as path from 'path';
5
+
6
+ export default defineConfig(({ mode }) => {
7
+ return {
8
+ root: __dirname,
9
+ cacheDir: '../../node_modules/.vite/apps/web',
10
+
11
+ // Development server configuration
12
+ server: {
13
+ port: 3000,
14
+ host: true, // Listen on all addresses (0.0.0.0)
15
+ strictPort: false, // Try next port if 3000 is taken
16
+ open: false, // Don't auto-open browser
17
+ cors: true,
18
+ // Proxy API requests to backend during development
19
+ // Note: Vite automatically loads VITE_ prefixed env vars
20
+ proxy: mode === 'development' ? {
21
+ '/api': {
22
+ target: process.env.VITE_API_BASE_URL || 'http://localhost:3000',
23
+ changeOrigin: true,
24
+ secure: false,
25
+ },
26
+ } : undefined,
27
+ },
28
+
29
+ preview: {
30
+ port: 3001,
31
+ host: 'localhost',
32
+ },
33
+
34
+ plugins: [
35
+ react({
36
+ // Fast Refresh is enabled by default
37
+ babel: {
38
+ plugins: [
39
+ // Add any Babel plugins for dev mode here
40
+ ],
41
+ },
42
+ }),
43
+ nxViteTsPaths(),
44
+ ],
45
+
46
+ resolve: {
47
+ alias: {
48
+ '@': path.resolve(__dirname, './src'),
49
+ },
50
+ },
51
+
52
+ // Optimize dependencies
53
+ optimizeDeps: {
54
+ include: ['react', 'react-dom', '@chakra-ui/react', 'zustand', 'axios'],
55
+ },
56
+
57
+ build: {
58
+ outDir: '../../dist/apps/web',
59
+ emptyOutDir: true,
60
+ reportCompressedSize: true,
61
+ sourcemap: mode === 'development',
62
+ minify: mode === 'production' ? 'esbuild' : false,
63
+ commonjsOptions: {
64
+ transformMixedEsModules: true,
65
+ },
66
+ // Chunk splitting for better caching
67
+ rollupOptions: {
68
+ output: {
69
+ manualChunks: {
70
+ 'react-vendor': ['react', 'react-dom'],
71
+ 'chakra-vendor': ['@chakra-ui/react', '@emotion/react', '@emotion/styled'],
72
+ 'utils': ['zustand', 'axios'],
73
+ },
74
+ },
75
+ },
76
+ },
77
+
78
+ // Environment variable handling
79
+ envPrefix: 'VITE_',
80
+
81
+ // Define global constants
82
+ define: {
83
+ __DEV__: mode === 'development',
84
+ __PROD__: mode === 'production',
85
+ },
86
+ };
87
+ });
@@ -0,0 +1,28 @@
1
+ {
2
+ "shared": [
3
+ { "src": "root/package.json", "dest": "package.json" },
4
+ { "src": "root/tsconfig.base.json", "dest": "tsconfig.base.json" },
5
+ { "src": "root/nx.json", "dest": "nx.json" },
6
+ { "src": "root/jest.preset.js", "dest": "jest.preset.js" },
7
+ { "src": "root/eslint.config.js", "dest": "eslint.config.js" },
8
+ { "src": "root/.npmrc", "dest": ".npmrc" },
9
+ { "src": "root/.nvmrc", "dest": ".nvmrc" },
10
+ { "src": "root/.editorconfig", "dest": ".editorconfig" },
11
+ { "src": "root/.gitignore", "dest": ".gitignore" },
12
+ { "src": "packages/common-types", "dest": "packages/common-types" },
13
+ { "src": "packages/api-client", "dest": "packages/api-client" },
14
+ { "src": ".vscode", "dest": ".vscode" },
15
+ { "src": ".github", "dest": ".github" }
16
+ ],
17
+ "byPlatform": {
18
+ "web": [
19
+ { "src": "apps/web", "dest": "apps/web" }
20
+ ],
21
+ "mobile": [
22
+ { "src": "apps/mobile", "dest": "apps/mobile" }
23
+ ],
24
+ "api": [
25
+ { "src": "apps/api", "dest": "apps/api" }
26
+ ]
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": ["../../.eslintrc.js"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "rules": {}
8
+ },
9
+ {
10
+ "files": ["*.ts", "*.tsx"],
11
+ "rules": {}
12
+ },
13
+ {
14
+ "files": ["*.js", "*.jsx"],
15
+ "rules": {}
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,13 @@
1
+ export default {
2
+ displayName: 'api-client',
3
+ preset: '../../jest.preset.js',
4
+ testEnvironment: 'node',
5
+ transform: {
6
+ '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7
+ },
8
+ moduleFileExtensions: ['ts', 'js', 'html'],
9
+ coverageDirectory: '../../coverage/packages/api-client',
10
+ moduleNameMapper: {
11
+ '^{{PACKAGE_SCOPE}}/common-types$': '<rootDir>/../../packages/common-types/src/index.ts',
12
+ },
13
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "{{PACKAGE_SCOPE}}/api-client",
3
+ "version": "1.0.0",
4
+ "description": "API client for the monorepo",
5
+ "main": "./src/index.ts",
6
+ "types": "./src/index.ts",
7
+ "type": "module"
8
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "api-client",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/api-client/src",
5
+ "projectType": "library",
6
+ "tags": ["type:library"],
7
+ "targets": {
8
+ "lint": {
9
+ "executor": "@nx/eslint:lint",
10
+ "outputs": ["{options.outputFile}"],
11
+ "options": {
12
+ "lintFilePatterns": ["packages/api-client/**/*.ts"]
13
+ }
14
+ },
15
+ "build": {
16
+ "executor": "@nx/js:tsc",
17
+ "outputs": ["{options.outputPath}"],
18
+ "options": {
19
+ "outputPath": "dist/packages/api-client",
20
+ "main": "packages/api-client/src/index.ts",
21
+ "tsConfig": "packages/api-client/tsconfig.lib.json",
22
+ "assets": ["packages/api-client/*.md"]
23
+ }
24
+ },
25
+ "test": {
26
+ "executor": "@nx/jest:jest",
27
+ "outputs": ["{workspaceRoot}/coverage/packages/api-client"],
28
+ "options": {
29
+ "jestConfig": "packages/api-client/jest.config.ts",
30
+ "passWithNoTests": true
31
+ }
32
+ }
33
+ }
34
+ }