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.
- package/README.md +118 -0
- package/dist/__tests__/generator/replace-tokens.spec.d.ts +1 -0
- package/dist/__tests__/generator/replace-tokens.spec.js +281 -0
- package/dist/__tests__/generator.spec.d.ts +1 -0
- package/dist/__tests__/generator.spec.js +162 -0
- package/dist/__tests__/validation/project-name.spec.d.ts +1 -0
- package/dist/__tests__/validation/project-name.spec.js +57 -0
- package/dist/__tests__/wizard.spec.d.ts +1 -0
- package/dist/__tests__/wizard.spec.js +232 -0
- package/dist/aws/iam.d.ts +75 -0
- package/dist/aws/iam.js +264 -0
- package/dist/aws/organizations.d.ts +79 -0
- package/dist/aws/organizations.js +168 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +206 -0
- package/dist/commands/setup-github.d.ts +4 -0
- package/dist/commands/setup-github.js +185 -0
- package/dist/generator/copy-file.d.ts +15 -0
- package/dist/generator/copy-file.js +56 -0
- package/dist/generator/generate-project.d.ts +14 -0
- package/dist/generator/generate-project.js +81 -0
- package/dist/generator/index.d.ts +4 -0
- package/dist/generator/index.js +3 -0
- package/dist/generator/replace-tokens.d.ts +29 -0
- package/dist/generator/replace-tokens.js +68 -0
- package/dist/github/secrets.d.ts +109 -0
- package/dist/github/secrets.js +275 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/dist/prompts/auth.d.ts +3 -0
- package/dist/prompts/auth.js +23 -0
- package/dist/prompts/aws-config.d.ts +2 -0
- package/dist/prompts/aws-config.js +14 -0
- package/dist/prompts/features.d.ts +2 -0
- package/dist/prompts/features.js +10 -0
- package/dist/prompts/github-setup.d.ts +53 -0
- package/dist/prompts/github-setup.js +208 -0
- package/dist/prompts/org-structure.d.ts +9 -0
- package/dist/prompts/org-structure.js +93 -0
- package/dist/prompts/platforms.d.ts +2 -0
- package/dist/prompts/platforms.js +12 -0
- package/dist/prompts/project-name.d.ts +2 -0
- package/dist/prompts/project-name.js +8 -0
- package/dist/prompts/theme.d.ts +2 -0
- package/dist/prompts/theme.js +14 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/index.js +2 -0
- package/dist/templates/manifest.d.ts +11 -0
- package/dist/templates/manifest.js +99 -0
- package/dist/templates/tokens.d.ts +39 -0
- package/dist/templates/tokens.js +37 -0
- package/dist/templates/types.d.ts +52 -0
- package/dist/templates/types.js +1 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +1 -0
- package/dist/validation/project-name.d.ts +1 -0
- package/dist/validation/project-name.js +12 -0
- package/dist/wizard.d.ts +2 -0
- package/dist/wizard.js +81 -0
- package/package.json +68 -0
- package/templates/.github/actions/build-and-test/action.yml +24 -0
- package/templates/.github/actions/deploy-cdk/action.yml +46 -0
- package/templates/.github/actions/deploy-web/action.yml +72 -0
- package/templates/.github/actions/setup/action.yml +29 -0
- package/templates/.github/pull_request_template.md +15 -0
- package/templates/.github/workflows/deploy-dev.yml +80 -0
- package/templates/.github/workflows/deploy-prod.yml +67 -0
- package/templates/.github/workflows/deploy-stage.yml +77 -0
- package/templates/.github/workflows/pull-request.yml +72 -0
- package/templates/.vscode/extensions.json +7 -0
- package/templates/.vscode/settings.json +67 -0
- package/templates/apps/api/.eslintrc.json +18 -0
- package/templates/apps/api/cdk/app.ts +93 -0
- package/templates/apps/api/cdk/auth/cognito-stack.ts +164 -0
- package/templates/apps/api/cdk/cdk.json +73 -0
- package/templates/apps/api/cdk/deployment-user-stack.ts +187 -0
- package/templates/apps/api/cdk/org-stack.ts +67 -0
- package/templates/apps/api/cdk/static-stack.ts +361 -0
- package/templates/apps/api/cdk/tsconfig.json +39 -0
- package/templates/apps/api/cdk/user-stack.ts +255 -0
- package/templates/apps/api/jest.config.ts +38 -0
- package/templates/apps/api/lambdas.yml +84 -0
- package/templates/apps/api/project.json.template +58 -0
- package/templates/apps/api/src/__tests__/setup.ts +10 -0
- package/templates/apps/api/src/handlers/users/create-user.ts +52 -0
- package/templates/apps/api/src/handlers/users/delete-user.ts +45 -0
- package/templates/apps/api/src/handlers/users/get-me.ts +72 -0
- package/templates/apps/api/src/handlers/users/get-user.ts +45 -0
- package/templates/apps/api/src/handlers/users/get-users.ts +23 -0
- package/templates/apps/api/src/handlers/users/index.ts +17 -0
- package/templates/apps/api/src/handlers/users/update-user.ts +72 -0
- package/templates/apps/api/src/lib/dynamo/dynamo-model.ts +504 -0
- package/templates/apps/api/src/lib/dynamo/index.ts +12 -0
- package/templates/apps/api/src/lib/dynamo/utils.ts +39 -0
- package/templates/apps/api/src/middleware/auth0-auth.ts +97 -0
- package/templates/apps/api/src/middleware/cognito-auth.ts +90 -0
- package/templates/apps/api/src/models/UserModel.ts +109 -0
- package/templates/apps/api/src/schemas/user.schema.ts +44 -0
- package/templates/apps/api/src/services/user-service.ts +108 -0
- package/templates/apps/api/src/utils/auth-context.ts +60 -0
- package/templates/apps/api/src/utils/common/helpers.ts +26 -0
- package/templates/apps/api/src/utils/lambda-handler.ts +148 -0
- package/templates/apps/api/src/utils/response.ts +52 -0
- package/templates/apps/api/src/utils/validator.ts +75 -0
- package/templates/apps/api/tsconfig.app.json +15 -0
- package/templates/apps/api/tsconfig.json +19 -0
- package/templates/apps/api/tsconfig.spec.json +17 -0
- package/templates/apps/mobile/.env.example +5 -0
- package/templates/apps/mobile/.eslintrc.json +33 -0
- package/templates/apps/mobile/app.json +33 -0
- package/templates/apps/mobile/assets/.gitkeep +0 -0
- package/templates/apps/mobile/babel.config.js +19 -0
- package/templates/apps/mobile/index.js +7 -0
- package/templates/apps/mobile/jest.config.ts +22 -0
- package/templates/apps/mobile/metro.config.js +35 -0
- package/templates/apps/mobile/package.json +22 -0
- package/templates/apps/mobile/project.json.template +64 -0
- package/templates/apps/mobile/src/App.tsx +367 -0
- package/templates/apps/mobile/src/__tests__/App.spec.tsx +46 -0
- package/templates/apps/mobile/src/__tests__/store/user-store.spec.ts +156 -0
- package/templates/apps/mobile/src/config/api.ts +16 -0
- package/templates/apps/mobile/src/store/user-store.ts +56 -0
- package/templates/apps/mobile/src/test-setup.ts +10 -0
- package/templates/apps/mobile/tsconfig.json +22 -0
- package/templates/apps/web/.env.example +13 -0
- package/templates/apps/web/.eslintrc.json +26 -0
- package/templates/apps/web/index.html +13 -0
- package/templates/apps/web/jest.config.ts +24 -0
- package/templates/apps/web/package.json +15 -0
- package/templates/apps/web/project.json.template +66 -0
- package/templates/apps/web/src/App.tsx +352 -0
- package/templates/apps/web/src/__mocks__/config/api.ts +41 -0
- package/templates/apps/web/src/__tests__/App.spec.tsx +240 -0
- package/templates/apps/web/src/__tests__/store/user-store.spec.ts +185 -0
- package/templates/apps/web/src/auth/auth0-provider.tsx +103 -0
- package/templates/apps/web/src/auth/cognito-provider.tsx +143 -0
- package/templates/apps/web/src/auth/index.ts +7 -0
- package/templates/apps/web/src/auth/use-auth.ts +16 -0
- package/templates/apps/web/src/config/amplify-config.ts +31 -0
- package/templates/apps/web/src/config/api.ts +38 -0
- package/templates/apps/web/src/config/auth0-config.ts +17 -0
- package/templates/apps/web/src/main.tsx +41 -0
- package/templates/apps/web/src/store/user-store.ts +56 -0
- package/templates/apps/web/src/styles.css +165 -0
- package/templates/apps/web/src/test-setup.ts +1 -0
- package/templates/apps/web/src/theme/index.ts +30 -0
- package/templates/apps/web/src/vite-env.d.ts +19 -0
- package/templates/apps/web/tsconfig.app.json +24 -0
- package/templates/apps/web/tsconfig.json +22 -0
- package/templates/apps/web/tsconfig.spec.json +28 -0
- package/templates/apps/web/vite.config.ts +87 -0
- package/templates/manifest.json +28 -0
- package/templates/packages/api-client/.eslintrc.json +18 -0
- package/templates/packages/api-client/jest.config.ts +13 -0
- package/templates/packages/api-client/package.json +8 -0
- package/templates/packages/api-client/project.json.template +34 -0
- package/templates/packages/api-client/src/__tests__/api-client.spec.ts +408 -0
- package/templates/packages/api-client/src/api-client.ts +201 -0
- package/templates/packages/api-client/src/config.ts +193 -0
- package/templates/packages/api-client/src/index.ts +9 -0
- package/templates/packages/api-client/tsconfig.json +22 -0
- package/templates/packages/api-client/tsconfig.lib.json +11 -0
- package/templates/packages/api-client/tsconfig.spec.json +14 -0
- package/templates/packages/common-types/.eslintrc.json +18 -0
- package/templates/packages/common-types/package.json +6 -0
- package/templates/packages/common-types/project.json.template +26 -0
- package/templates/packages/common-types/src/api.types.ts +24 -0
- package/templates/packages/common-types/src/auth.types.ts +36 -0
- package/templates/packages/common-types/src/common.types.ts +46 -0
- package/templates/packages/common-types/src/index.ts +19 -0
- package/templates/packages/common-types/src/lambda.types.ts +39 -0
- package/templates/packages/common-types/src/user.types.ts +31 -0
- package/templates/packages/common-types/tsconfig.json +19 -0
- package/templates/packages/common-types/tsconfig.lib.json +11 -0
- package/templates/root/.editorconfig +23 -0
- package/templates/root/.nvmrc +1 -0
- package/templates/root/eslint.config.js +61 -0
- package/templates/root/jest.preset.js +16 -0
- package/templates/root/nx.json +29 -0
- package/templates/root/package.json +131 -0
- 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,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
|
+
}
|