@idealyst/cli 1.2.0 → 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/dist/commands/add.js +233 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/index.js +13 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/info.js +193 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.js +155 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/constants.js +119 -0
- package/dist/constants.js.map +1 -0
- package/dist/generators/core/index.js +23 -0
- package/dist/generators/core/index.js.map +1 -0
- package/dist/generators/core/mobile.js +286 -0
- package/dist/generators/core/mobile.js.map +1 -0
- package/dist/generators/core/shared.js +207 -0
- package/dist/generators/core/shared.js.map +1 -0
- package/dist/generators/core/web.js +377 -0
- package/dist/generators/core/web.js.map +1 -0
- package/dist/generators/extensions/api.js +223 -0
- package/dist/generators/extensions/api.js.map +1 -0
- package/dist/generators/extensions/devcontainer.js +510 -0
- package/dist/generators/extensions/devcontainer.js.map +1 -0
- package/dist/generators/extensions/graphql.js +202 -0
- package/dist/generators/extensions/graphql.js.map +1 -0
- package/dist/generators/extensions/index.js +17 -0
- package/dist/generators/extensions/index.js.map +1 -0
- package/dist/generators/extensions/prisma.js +249 -0
- package/dist/generators/extensions/prisma.js.map +1 -0
- package/dist/generators/extensions/trpc.js +258 -0
- package/dist/generators/extensions/trpc.js.map +1 -0
- package/dist/generators/index.js +106 -4
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/reactNative.js +177 -0
- package/dist/generators/reactNative.js.map +1 -0
- package/dist/generators/workspace.js +272 -0
- package/dist/generators/workspace.js.map +1 -0
- package/dist/identifiers/android.js +75 -0
- package/dist/identifiers/android.js.map +1 -0
- package/dist/identifiers/index.js +35 -0
- package/dist/identifiers/index.js.map +1 -0
- package/dist/identifiers/ios.js +65 -0
- package/dist/identifiers/ios.js.map +1 -0
- package/dist/index.js +41 -319
- package/dist/index.js.map +1 -1
- package/dist/templates/copier.js +135 -0
- package/dist/templates/copier.js.map +1 -0
- package/dist/templates/index.js +23 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/merger.js +113 -0
- package/dist/templates/merger.js.map +1 -0
- package/dist/templates/processor.js +142 -0
- package/dist/templates/processor.js.map +1 -0
- package/dist/types/commands/add.d.ts +14 -0
- package/dist/types/commands/index.d.ts +6 -0
- package/dist/types/commands/info.d.ts +10 -0
- package/dist/types/commands/init.d.ts +19 -0
- package/dist/types/constants.d.ts +76 -0
- package/dist/types/generators/core/index.d.ts +6 -0
- package/dist/types/generators/core/mobile.d.ts +13 -0
- package/dist/types/generators/core/shared.d.ts +8 -0
- package/dist/types/generators/core/web.d.ts +8 -0
- package/dist/types/generators/extensions/api.d.ts +8 -0
- package/dist/types/generators/extensions/devcontainer.d.ts +15 -0
- package/dist/types/generators/extensions/graphql.d.ts +8 -0
- package/dist/types/generators/extensions/index.d.ts +8 -0
- package/dist/types/generators/extensions/prisma.d.ts +8 -0
- package/dist/types/generators/extensions/trpc.d.ts +9 -0
- package/dist/types/generators/index.d.ts +11 -3
- package/dist/types/generators/reactNative.d.ts +19 -0
- package/dist/types/generators/workspace.d.ts +8 -0
- package/dist/types/identifiers/android.d.ts +26 -0
- package/dist/types/identifiers/index.d.ts +26 -0
- package/dist/types/identifiers/ios.d.ts +21 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/templates/copier.d.ts +24 -0
- package/dist/types/templates/index.d.ts +6 -0
- package/dist/types/templates/merger.d.ts +43 -0
- package/dist/types/templates/processor.d.ts +39 -0
- package/dist/types/types.d.ts +153 -5
- package/dist/types/utils/filesystem.d.ts +56 -0
- package/dist/types/utils/index.d.ts +7 -0
- package/dist/types/utils/logger.d.ts +58 -0
- package/dist/types/utils/shell.d.ts +35 -0
- package/dist/types/utils/validation.d.ts +32 -0
- package/dist/types/wizard/index.d.ts +20 -0
- package/dist/types/wizard/steps/apiExtension.d.ts +5 -0
- package/dist/types/wizard/steps/appDisplayName.d.ts +5 -0
- package/dist/types/wizard/steps/devcontainerExtension.d.ts +5 -0
- package/dist/types/wizard/steps/graphqlExtension.d.ts +5 -0
- package/dist/types/wizard/steps/index.d.ts +12 -0
- package/dist/types/wizard/steps/orgDomain.d.ts +5 -0
- package/dist/types/wizard/steps/prismaExtension.d.ts +5 -0
- package/dist/types/wizard/steps/projectName.d.ts +5 -0
- package/dist/types/wizard/steps/summary.d.ts +5 -0
- package/dist/types/wizard/steps/trpcExtension.d.ts +5 -0
- package/dist/types/wizard/validators.d.ts +17 -0
- package/dist/types.js +41 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/filesystem.js +173 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/index.js +24 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.js +95 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/shell.js +113 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/validation.js +196 -0
- package/dist/utils/validation.js.map +1 -0
- package/dist/wizard/index.js +177 -0
- package/dist/wizard/index.js.map +1 -0
- package/dist/wizard/steps/apiExtension.js +33 -0
- package/dist/wizard/steps/apiExtension.js.map +1 -0
- package/dist/wizard/steps/appDisplayName.js +53 -0
- package/dist/wizard/steps/appDisplayName.js.map +1 -0
- package/dist/wizard/steps/devcontainerExtension.js +78 -0
- package/dist/wizard/steps/devcontainerExtension.js.map +1 -0
- package/dist/wizard/steps/graphqlExtension.js +37 -0
- package/dist/wizard/steps/graphqlExtension.js.map +1 -0
- package/dist/wizard/steps/index.js +25 -0
- package/dist/wizard/steps/index.js.map +1 -0
- package/dist/wizard/steps/orgDomain.js +40 -0
- package/dist/wizard/steps/orgDomain.js.map +1 -0
- package/dist/wizard/steps/prismaExtension.js +33 -0
- package/dist/wizard/steps/prismaExtension.js.map +1 -0
- package/dist/wizard/steps/projectName.js +40 -0
- package/dist/wizard/steps/projectName.js.map +1 -0
- package/dist/wizard/steps/summary.js +107 -0
- package/dist/wizard/steps/summary.js.map +1 -0
- package/dist/wizard/steps/trpcExtension.js +37 -0
- package/dist/wizard/steps/trpcExtension.js.map +1 -0
- package/dist/wizard/validators.js +35 -0
- package/dist/wizard/validators.js.map +1 -0
- package/package.json +6 -19
- package/README.md +0 -110
- package/dist/generators/init.js +0 -268
- package/dist/generators/init.js.map +0 -1
- package/dist/generators/utils.js +0 -682
- package/dist/generators/utils.js.map +0 -1
- package/dist/scripts/configure-react-native-monorepo.js +0 -144
- package/dist/scripts/configure-react-native-monorepo.js.map +0 -1
- package/dist/template/.devcontainer/Dockerfile +0 -26
- package/dist/template/.devcontainer/devcontainer.json +0 -113
- package/dist/template/.devcontainer/docker-compose.yml +0 -59
- package/dist/template/.devcontainer/figma-mcp.sh +0 -32
- package/dist/template/.devcontainer/gitignore.template +0 -2
- package/dist/template/.devcontainer/setup.sh +0 -45
- package/dist/template/DOCKER.md +0 -0
- package/dist/template/Dockerfile +0 -111
- package/dist/template/README.md +0 -233
- package/dist/template/docker/nginx/prod.conf +0 -238
- package/dist/template/docker/nginx.conf +0 -131
- package/dist/template/docker/postgres/init.sql +0 -41
- package/dist/template/docker/prometheus/prometheus.yml +0 -52
- package/dist/template/docker-compose.prod.yml +0 -146
- package/dist/template/docker-compose.yml +0 -143
- package/dist/template/dockerignore.template +0 -151
- package/dist/template/env.example.template +0 -36
- package/dist/template/gitignore.template +0 -56
- package/dist/template/jest.config.js +0 -20
- package/dist/template/mcp.json.template +0 -8
- package/dist/template/package.json +0 -45
- package/dist/template/packages/api/README.md +0 -510
- package/dist/template/packages/api/__tests__/api.test.ts +0 -26
- package/dist/template/packages/api/env.example.template +0 -6
- package/dist/template/packages/api/gitignore.template +0 -35
- package/dist/template/packages/api/jest.config.js +0 -23
- package/dist/template/packages/api/jest.setup.js +0 -9
- package/dist/template/packages/api/package.json +0 -66
- package/dist/template/packages/api/src/context.ts +0 -52
- package/dist/template/packages/api/src/controllers/TestController.ts +0 -0
- package/dist/template/packages/api/src/graphql/builder.ts +0 -75
- package/dist/template/packages/api/src/graphql/generated.ts +0 -64
- package/dist/template/packages/api/src/graphql/index.ts +0 -75
- package/dist/template/packages/api/src/graphql/types/index.ts +0 -44
- package/dist/template/packages/api/src/graphql/types/test.ts +0 -245
- package/dist/template/packages/api/src/index.ts +0 -26
- package/dist/template/packages/api/src/lib/database.ts +0 -23
- package/dist/template/packages/api/src/router/index.ts +0 -163
- package/dist/template/packages/api/src/routers/test.ts +0 -161
- package/dist/template/packages/api/src/server.ts +0 -68
- package/dist/template/packages/api/src/trpc.ts +0 -28
- package/dist/template/packages/api/tsconfig.json +0 -44
- package/dist/template/packages/database/README.md +0 -162
- package/dist/template/packages/database/gitignore.template +0 -41
- package/dist/template/packages/database/package.json +0 -49
- package/dist/template/packages/database/prisma/seed.ts +0 -64
- package/dist/template/packages/database/schema.prisma +0 -107
- package/dist/template/packages/database/src/index.ts +0 -15
- package/dist/template/packages/database/src/validators.ts +0 -10
- package/dist/template/packages/database/tsconfig.json +0 -18
- package/dist/template/packages/mobile/README.md +0 -86
- package/dist/template/packages/mobile/__tests__/App.test.tsx +0 -156
- package/dist/template/packages/mobile/__tests__/components.test.tsx +0 -300
- package/dist/template/packages/mobile/app.json +0 -5
- package/dist/template/packages/mobile/babel.config.js +0 -10
- package/dist/template/packages/mobile/gitignore.template +0 -73
- package/dist/template/packages/mobile/index.js +0 -6
- package/dist/template/packages/mobile/jest.config.js +0 -21
- package/dist/template/packages/mobile/jest.setup.js +0 -12
- package/dist/template/packages/mobile/metro.config.js +0 -36
- package/dist/template/packages/mobile/package.json +0 -60
- package/dist/template/packages/mobile/src/App.tsx +0 -8
- package/dist/template/packages/mobile/src/utils/trpc.ts +0 -7
- package/dist/template/packages/mobile/tsconfig.json +0 -28
- package/dist/template/packages/shared/README.md +0 -135
- package/dist/template/packages/shared/__tests__/shared.test.ts +0 -51
- package/dist/template/packages/shared/gitignore.template +0 -35
- package/dist/template/packages/shared/jest.config.js +0 -22
- package/dist/template/packages/shared/package.json +0 -68
- package/dist/template/packages/shared/src/components/App.tsx +0 -57
- package/dist/template/packages/shared/src/components/HelloWorld.tsx +0 -531
- package/dist/template/packages/shared/src/components/index.ts +0 -1
- package/dist/template/packages/shared/src/graphql/client.ts +0 -34
- package/dist/template/packages/shared/src/index.ts +0 -22
- package/dist/template/packages/shared/src/navigation/AppRouter.tsx +0 -565
- package/dist/template/packages/shared/src/trpc/client.ts +0 -44
- package/dist/template/packages/shared/tsconfig.json +0 -22
- package/dist/template/packages/web/README.md +0 -131
- package/dist/template/packages/web/__tests__/App.test.tsx +0 -342
- package/dist/template/packages/web/__tests__/components.test.tsx +0 -564
- package/dist/template/packages/web/gitignore.template +0 -35
- package/dist/template/packages/web/index.html +0 -13
- package/dist/template/packages/web/jest.config.js +0 -27
- package/dist/template/packages/web/jest.setup.js +0 -24
- package/dist/template/packages/web/package.json +0 -69
- package/dist/template/packages/web/src/App.tsx +0 -14
- package/dist/template/packages/web/src/components/TestDemo.tsx +0 -164
- package/dist/template/packages/web/src/main.tsx +0 -25
- package/dist/template/packages/web/src/utils/trpc.ts +0 -7
- package/dist/template/packages/web/tsconfig.json +0 -26
- package/dist/template/packages/web/vite.config.ts +0 -98
- package/dist/template/setup.sh +0 -30
- package/dist/template/tsconfig.json +0 -22
- package/dist/template/yarnrc.yml.template +0 -4
- package/dist/types/generators/init.d.ts +0 -5
- package/dist/types/generators/utils.d.ts +0 -45
- package/dist/types/scripts/configure-react-native-monorepo.d.ts +0 -23
- package/template/.devcontainer/Dockerfile +0 -26
- package/template/.devcontainer/devcontainer.json +0 -113
- package/template/.devcontainer/docker-compose.yml +0 -59
- package/template/.devcontainer/figma-mcp.sh +0 -32
- package/template/.devcontainer/setup.sh +0 -45
- package/template/.dockerignore +0 -151
- package/template/.env.example +0 -36
- package/template/.env.production +0 -56
- package/template/DOCKER.md +0 -0
- package/template/Dockerfile +0 -111
- package/template/README.md +0 -233
- package/template/docker/nginx/prod.conf +0 -238
- package/template/docker/nginx.conf +0 -131
- package/template/docker/postgres/init.sql +0 -41
- package/template/docker/prometheus/prometheus.yml +0 -52
- package/template/docker-compose.prod.yml +0 -146
- package/template/docker-compose.yml +0 -143
- package/template/jest.config.js +0 -20
- package/template/package.json +0 -45
- package/template/packages/api/.env.example +0 -6
- package/template/packages/api/README.md +0 -510
- package/template/packages/api/__tests__/api.test.ts +0 -26
- package/template/packages/api/jest.config.js +0 -23
- package/template/packages/api/jest.setup.js +0 -9
- package/template/packages/api/package.json +0 -66
- package/template/packages/api/src/context.ts +0 -52
- package/template/packages/api/src/controllers/TestController.ts +0 -0
- package/template/packages/api/src/graphql/builder.ts +0 -75
- package/template/packages/api/src/graphql/generated.ts +0 -64
- package/template/packages/api/src/graphql/index.ts +0 -75
- package/template/packages/api/src/graphql/types/index.ts +0 -44
- package/template/packages/api/src/graphql/types/test.ts +0 -245
- package/template/packages/api/src/index.ts +0 -26
- package/template/packages/api/src/lib/database.ts +0 -23
- package/template/packages/api/src/router/index.ts +0 -163
- package/template/packages/api/src/routers/test.ts +0 -161
- package/template/packages/api/src/server.ts +0 -68
- package/template/packages/api/src/trpc.ts +0 -28
- package/template/packages/api/tsconfig.json +0 -44
- package/template/packages/database/README.md +0 -162
- package/template/packages/database/package.json +0 -49
- package/template/packages/database/prisma/seed.ts +0 -64
- package/template/packages/database/schema.prisma +0 -107
- package/template/packages/database/src/index.ts +0 -15
- package/template/packages/database/src/validators.ts +0 -10
- package/template/packages/database/tsconfig.json +0 -18
- package/template/packages/mobile/README.md +0 -86
- package/template/packages/mobile/__tests__/App.test.tsx +0 -156
- package/template/packages/mobile/__tests__/components.test.tsx +0 -300
- package/template/packages/mobile/app.json +0 -5
- package/template/packages/mobile/babel.config.js +0 -26
- package/template/packages/mobile/index.js +0 -8
- package/template/packages/mobile/jest.config.js +0 -21
- package/template/packages/mobile/jest.setup.js +0 -12
- package/template/packages/mobile/metro.config.js +0 -36
- package/template/packages/mobile/package.json +0 -60
- package/template/packages/mobile/src/App.tsx +0 -8
- package/template/packages/mobile/src/utils/trpc.ts +0 -7
- package/template/packages/mobile/tsconfig.json +0 -28
- package/template/packages/shared/README.md +0 -135
- package/template/packages/shared/__tests__/shared.test.ts +0 -51
- package/template/packages/shared/jest.config.js +0 -22
- package/template/packages/shared/package.json +0 -68
- package/template/packages/shared/src/components/App.tsx +0 -57
- package/template/packages/shared/src/components/HelloWorld.tsx +0 -531
- package/template/packages/shared/src/components/index.ts +0 -1
- package/template/packages/shared/src/graphql/client.ts +0 -34
- package/template/packages/shared/src/index.ts +0 -25
- package/template/packages/shared/src/navigation/AppRouter.tsx +0 -565
- package/template/packages/shared/src/trpc/client.ts +0 -44
- package/template/packages/shared/src/unistyles.ts +0 -50
- package/template/packages/shared/tsconfig.json +0 -22
- package/template/packages/web/README.md +0 -131
- package/template/packages/web/__tests__/App.test.tsx +0 -342
- package/template/packages/web/__tests__/components.test.tsx +0 -564
- package/template/packages/web/index.html +0 -13
- package/template/packages/web/jest.config.js +0 -27
- package/template/packages/web/jest.setup.js +0 -24
- package/template/packages/web/package.json +0 -69
- package/template/packages/web/src/App.tsx +0 -14
- package/template/packages/web/src/components/TestDemo.tsx +0 -164
- package/template/packages/web/src/main.tsx +0 -27
- package/template/packages/web/src/utils/trpc.ts +0 -7
- package/template/packages/web/tsconfig.json +0 -26
- package/template/packages/web/vite.config.ts +0 -114
- package/template/setup.sh +0 -30
- package/template/tsconfig.json +0 -22
package/dist/template/README.md
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
# {{projectName}}
|
|
2
|
-
|
|
3
|
-
A full-stack application built with the Idealyst Framework.
|
|
4
|
-
|
|
5
|
-
## 🏗️ Architecture
|
|
6
|
-
|
|
7
|
-
This workspace contains a complete full-stack application with:
|
|
8
|
-
|
|
9
|
-
- **📱 Mobile App** (`packages/mobile`) - React Native app with Idealyst components
|
|
10
|
-
- **🌐 Web App** (`packages/web`) - React web app with Idealyst components
|
|
11
|
-
- **🚀 API Server** (`packages/api`) - tRPC API server with Express
|
|
12
|
-
- **🗄️ Database** (`packages/database`) - Prisma database layer with PostgreSQL
|
|
13
|
-
- **📦 Shared** (`packages/shared`) - Cross-platform shared components and utilities
|
|
14
|
-
|
|
15
|
-
All packages are pre-integrated and work together seamlessly.
|
|
16
|
-
|
|
17
|
-
## 🚀 Quick Start
|
|
18
|
-
|
|
19
|
-
### Prerequisites
|
|
20
|
-
- Node.js 18+
|
|
21
|
-
- Yarn 3+
|
|
22
|
-
- PostgreSQL (or use Docker)
|
|
23
|
-
|
|
24
|
-
### Setup
|
|
25
|
-
```bash
|
|
26
|
-
# Install dependencies
|
|
27
|
-
yarn install
|
|
28
|
-
|
|
29
|
-
# Set up environment variables
|
|
30
|
-
cp packages/api/.env.example packages/api/.env
|
|
31
|
-
cp packages/database/.env.example packages/database/.env
|
|
32
|
-
# Edit .env files with your database URL
|
|
33
|
-
|
|
34
|
-
# Generate database client
|
|
35
|
-
yarn db:generate
|
|
36
|
-
|
|
37
|
-
# Push database schema
|
|
38
|
-
yarn db:push
|
|
39
|
-
|
|
40
|
-
# Start all development servers
|
|
41
|
-
yarn dev
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
This will start:
|
|
45
|
-
- 🌐 Web app at http://localhost:5173
|
|
46
|
-
- 🚀 API server at http://localhost:3000
|
|
47
|
-
- 📱 Mobile app (Metro bundler)
|
|
48
|
-
|
|
49
|
-
### Individual Commands
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
# Web development
|
|
53
|
-
yarn web:dev # Start web app
|
|
54
|
-
yarn web:build # Build web app
|
|
55
|
-
|
|
56
|
-
# Mobile development
|
|
57
|
-
yarn mobile:start # Start Metro bundler
|
|
58
|
-
yarn mobile:android # Run on Android
|
|
59
|
-
yarn mobile:ios # Run on iOS
|
|
60
|
-
|
|
61
|
-
# API development
|
|
62
|
-
yarn api:dev # Start API server
|
|
63
|
-
yarn api:build # Build API server
|
|
64
|
-
|
|
65
|
-
# Database management
|
|
66
|
-
yarn db:generate # Generate Prisma client
|
|
67
|
-
yarn db:push # Push schema to database
|
|
68
|
-
yarn db:migrate # Create migrations
|
|
69
|
-
yarn db:studio # Open Prisma Studio
|
|
70
|
-
|
|
71
|
-
# Build all packages
|
|
72
|
-
yarn build # Build everything
|
|
73
|
-
yarn build:packages # Build shared packages only
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Testing
|
|
77
|
-
|
|
78
|
-
This workspace is pre-configured with Jest testing framework across all packages. Each package includes sample tests and Jest configuration.
|
|
79
|
-
|
|
80
|
-
### Quick Start
|
|
81
|
-
|
|
82
|
-
```bash
|
|
83
|
-
# Run all tests across all packages
|
|
84
|
-
yarn test
|
|
85
|
-
|
|
86
|
-
# Run tests in watch mode
|
|
87
|
-
yarn test:watch
|
|
88
|
-
|
|
89
|
-
# Run tests with coverage reports
|
|
90
|
-
yarn test:coverage
|
|
91
|
-
|
|
92
|
-
# Run tests in CI mode (for automated builds)
|
|
93
|
-
yarn test:ci
|
|
94
|
-
|
|
95
|
-
# Run tests for a specific package
|
|
96
|
-
node scripts/test-runner.js test:package <package-name>
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Test Structure
|
|
100
|
-
|
|
101
|
-
Each package contains:
|
|
102
|
-
- `jest.config.js` - Jest configuration tailored to the project type
|
|
103
|
-
- `__tests__/` - Directory for test files with comprehensive examples
|
|
104
|
-
- Sample tests demonstrating testing patterns specific to each template
|
|
105
|
-
|
|
106
|
-
### Package-Specific Testing
|
|
107
|
-
|
|
108
|
-
- **API packages**: Node.js environment, async/database testing patterns
|
|
109
|
-
- **Web packages**: React Testing Library, DOM testing, user interactions
|
|
110
|
-
- **Native packages**: React Native Testing Library, component rendering
|
|
111
|
-
- **Shared packages**: TypeScript utility testing patterns
|
|
112
|
-
|
|
113
|
-
### Adding Tests
|
|
114
|
-
|
|
115
|
-
1. Create test files in the `__tests__` directory or alongside your source files with `.test.ts` or `.spec.ts` extension
|
|
116
|
-
2. Tests are automatically discovered and run by Jest
|
|
117
|
-
3. Each template includes comprehensive sample tests as starting points
|
|
118
|
-
4. See the Component Testing Guide for detailed patterns and best practices
|
|
119
|
-
|
|
120
|
-
### Development
|
|
121
|
-
|
|
122
|
-
Install dependencies:
|
|
123
|
-
```bash
|
|
124
|
-
yarn install
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Build all packages:
|
|
128
|
-
```bash
|
|
129
|
-
yarn build:all
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Test all packages:
|
|
133
|
-
```bash
|
|
134
|
-
yarn test:all
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Adding Applications
|
|
138
|
-
|
|
139
|
-
Generate a new React Native app:
|
|
140
|
-
```bash
|
|
141
|
-
idealyst create mobile-app --type native
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Generate a new React web app:
|
|
145
|
-
```bash
|
|
146
|
-
idealyst create web-app --type web
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Generate a new shared library:
|
|
150
|
-
```bash
|
|
151
|
-
idealyst create shared-lib --type shared
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Note:** The CLI will automatically add new projects to the workspace configuration when run from the workspace root.
|
|
155
|
-
|
|
156
|
-
### Publishing
|
|
157
|
-
|
|
158
|
-
Publish all packages:
|
|
159
|
-
```bash
|
|
160
|
-
yarn publish:all
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Version Management
|
|
164
|
-
|
|
165
|
-
Update patch version for all packages:
|
|
166
|
-
```bash
|
|
167
|
-
yarn version:patch
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Update minor version for all packages:
|
|
171
|
-
```bash
|
|
172
|
-
yarn version:minor
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
Update major version for all packages:
|
|
176
|
-
```bash
|
|
177
|
-
yarn version:major
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Docker & Containerization
|
|
181
|
-
|
|
182
|
-
This workspace includes comprehensive Docker support for development, staging, and production environments.
|
|
183
|
-
|
|
184
|
-
### Quick Start with Docker
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
# Use the Docker build helper (recommended)
|
|
188
|
-
./scripts/docker-build.sh dev
|
|
189
|
-
|
|
190
|
-
# Or manually:
|
|
191
|
-
# Development environment
|
|
192
|
-
cp .env.example .env
|
|
193
|
-
./scripts/docker/deploy.sh development
|
|
194
|
-
|
|
195
|
-
# Production deployment
|
|
196
|
-
cp .env.production .env
|
|
197
|
-
# Edit .env with your settings
|
|
198
|
-
./scripts/docker/deploy.sh production
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
**Docker Build Helper**: The `./scripts/docker-build.sh` script automatically handles common issues like missing yarn.lock files and environment configuration.
|
|
202
|
-
|
|
203
|
-
### VS Code Dev Container
|
|
204
|
-
|
|
205
|
-
Open this workspace in VS Code and select "Reopen in Container" for a fully configured development environment with:
|
|
206
|
-
- Node.js, TypeScript, and all development tools pre-installed
|
|
207
|
-
- PostgreSQL and Redis databases ready to use
|
|
208
|
-
- Automatic port forwarding and extension installation
|
|
209
|
-
- Hot reload and debugging support
|
|
210
|
-
|
|
211
|
-
### Services Available
|
|
212
|
-
|
|
213
|
-
- **Web App**: React application with hot reload
|
|
214
|
-
- **API Server**: Backend with database connections
|
|
215
|
-
- **PostgreSQL**: Database with initialization scripts
|
|
216
|
-
- **Redis**: Caching and session storage
|
|
217
|
-
- **Nginx**: Reverse proxy and load balancer (production)
|
|
218
|
-
|
|
219
|
-
### Management Scripts
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
# Deployment
|
|
223
|
-
./scripts/docker/deploy.sh [development|production|staging]
|
|
224
|
-
|
|
225
|
-
# Database management
|
|
226
|
-
./scripts/docker/db-backup.sh [backup|restore|list|clean]
|
|
227
|
-
|
|
228
|
-
# View status
|
|
229
|
-
./scripts/docker/deploy.sh status
|
|
230
|
-
|
|
231
|
-
# View logs
|
|
232
|
-
./scripts/docker/deploy.sh logs
|
|
233
|
-
```
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
events {
|
|
2
|
-
worker_connections 2048;
|
|
3
|
-
use epoll;
|
|
4
|
-
multi_accept on;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
http {
|
|
8
|
-
include /etc/nginx/mime.types;
|
|
9
|
-
default_type application/octet-stream;
|
|
10
|
-
|
|
11
|
-
# Logging
|
|
12
|
-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
13
|
-
'$status $body_bytes_sent "$http_referer" '
|
|
14
|
-
'"$http_user_agent" "$http_x_forwarded_for" '
|
|
15
|
-
'$request_time $upstream_response_time';
|
|
16
|
-
|
|
17
|
-
access_log /var/log/nginx/access.log main;
|
|
18
|
-
error_log /var/log/nginx/error.log warn;
|
|
19
|
-
|
|
20
|
-
# Performance settings
|
|
21
|
-
sendfile on;
|
|
22
|
-
tcp_nopush on;
|
|
23
|
-
tcp_nodelay on;
|
|
24
|
-
keepalive_timeout 65;
|
|
25
|
-
keepalive_requests 100;
|
|
26
|
-
types_hash_max_size 2048;
|
|
27
|
-
server_tokens off;
|
|
28
|
-
client_max_body_size 50M;
|
|
29
|
-
client_body_buffer_size 128k;
|
|
30
|
-
client_header_buffer_size 3m;
|
|
31
|
-
large_client_header_buffers 4 256k;
|
|
32
|
-
|
|
33
|
-
# SSL Configuration
|
|
34
|
-
ssl_protocols TLSv1.2 TLSv1.3;
|
|
35
|
-
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384;
|
|
36
|
-
ssl_prefer_server_ciphers off;
|
|
37
|
-
ssl_session_cache shared:SSL:10m;
|
|
38
|
-
ssl_session_timeout 10m;
|
|
39
|
-
|
|
40
|
-
# Gzip compression
|
|
41
|
-
gzip on;
|
|
42
|
-
gzip_vary on;
|
|
43
|
-
gzip_min_length 1024;
|
|
44
|
-
gzip_comp_level 6;
|
|
45
|
-
gzip_proxied any;
|
|
46
|
-
gzip_types
|
|
47
|
-
application/atom+xml
|
|
48
|
-
application/geo+json
|
|
49
|
-
application/javascript
|
|
50
|
-
application/x-javascript
|
|
51
|
-
application/json
|
|
52
|
-
application/ld+json
|
|
53
|
-
application/manifest+json
|
|
54
|
-
application/rdf+xml
|
|
55
|
-
application/rss+xml
|
|
56
|
-
application/xhtml+xml
|
|
57
|
-
application/xml
|
|
58
|
-
font/eot
|
|
59
|
-
font/otf
|
|
60
|
-
font/ttf
|
|
61
|
-
image/svg+xml
|
|
62
|
-
text/css
|
|
63
|
-
text/javascript
|
|
64
|
-
text/plain
|
|
65
|
-
text/xml;
|
|
66
|
-
|
|
67
|
-
# Rate limiting zones
|
|
68
|
-
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
|
69
|
-
limit_req_zone $binary_remote_addr zone=web:10m rate=50r/s;
|
|
70
|
-
limit_req_zone $binary_remote_addr zone=login:10m rate=5r/m;
|
|
71
|
-
|
|
72
|
-
# Connection limiting
|
|
73
|
-
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
|
|
74
|
-
limit_conn conn_limit_per_ip 20;
|
|
75
|
-
|
|
76
|
-
# Upstream servers with load balancing
|
|
77
|
-
upstream api_backend {
|
|
78
|
-
least_conn;
|
|
79
|
-
server {{PROJECT_NAME}}-api-1:3000 max_fails=3 fail_timeout=30s weight=1;
|
|
80
|
-
server {{PROJECT_NAME}}-api-2:3000 max_fails=3 fail_timeout=30s weight=1;
|
|
81
|
-
keepalive 32;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
upstream web_backend {
|
|
85
|
-
least_conn;
|
|
86
|
-
server {{PROJECT_NAME}}-web-1:80 max_fails=3 fail_timeout=30s weight=1;
|
|
87
|
-
server {{PROJECT_NAME}}-web-2:80 max_fails=3 fail_timeout=30s weight=1;
|
|
88
|
-
keepalive 32;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
# Cache zones
|
|
92
|
-
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=api_cache:10m max_size=1g inactive=60m use_temp_path=off;
|
|
93
|
-
proxy_cache_path /var/cache/nginx/static levels=1:2 keys_zone=static_cache:10m max_size=1g inactive=24h use_temp_path=off;
|
|
94
|
-
|
|
95
|
-
# Redirect HTTP to HTTPS
|
|
96
|
-
server {
|
|
97
|
-
listen 80;
|
|
98
|
-
server_name {{DOMAIN_NAME}};
|
|
99
|
-
return 301 https://$server_name$request_uri;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
# Main HTTPS server
|
|
103
|
-
server {
|
|
104
|
-
listen 443 ssl http2;
|
|
105
|
-
server_name {{DOMAIN_NAME}};
|
|
106
|
-
|
|
107
|
-
# SSL certificates
|
|
108
|
-
ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
109
|
-
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
110
|
-
|
|
111
|
-
# Security headers
|
|
112
|
-
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
|
113
|
-
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
114
|
-
add_header X-Content-Type-Options "nosniff" always;
|
|
115
|
-
add_header X-XSS-Protection "1; mode=block" always;
|
|
116
|
-
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
117
|
-
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' wss:; frame-ancestors 'self';" always;
|
|
118
|
-
|
|
119
|
-
# API routes
|
|
120
|
-
location /api/ {
|
|
121
|
-
limit_req zone=api burst=20 nodelay;
|
|
122
|
-
|
|
123
|
-
# Caching for GET requests
|
|
124
|
-
proxy_cache api_cache;
|
|
125
|
-
proxy_cache_valid 200 302 10m;
|
|
126
|
-
proxy_cache_valid 404 1m;
|
|
127
|
-
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
128
|
-
proxy_cache_lock on;
|
|
129
|
-
proxy_cache_bypass $http_cache_control;
|
|
130
|
-
|
|
131
|
-
proxy_pass http://api_backend/;
|
|
132
|
-
proxy_http_version 1.1;
|
|
133
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
134
|
-
proxy_set_header Connection 'upgrade';
|
|
135
|
-
proxy_set_header Host $host;
|
|
136
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
137
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
138
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
139
|
-
proxy_cache_bypass $http_upgrade;
|
|
140
|
-
proxy_connect_timeout 30s;
|
|
141
|
-
proxy_send_timeout 30s;
|
|
142
|
-
proxy_read_timeout 30s;
|
|
143
|
-
proxy_buffering on;
|
|
144
|
-
proxy_buffer_size 4k;
|
|
145
|
-
proxy_buffers 8 4k;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
# Health checks
|
|
149
|
-
location /api/health {
|
|
150
|
-
proxy_pass http://api_backend/health;
|
|
151
|
-
access_log off;
|
|
152
|
-
proxy_cache off;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
# Authentication endpoints (stricter rate limiting)
|
|
156
|
-
location ~ ^/api/(auth|login|register|password) {
|
|
157
|
-
limit_req zone=login burst=5 nodelay;
|
|
158
|
-
|
|
159
|
-
proxy_pass http://api_backend;
|
|
160
|
-
proxy_set_header Host $host;
|
|
161
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
162
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
163
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
164
|
-
proxy_cache off;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
# Static assets with aggressive caching
|
|
168
|
-
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|webp|woff|woff2|ttf|eot|pdf)$ {
|
|
169
|
-
limit_req zone=web burst=100 nodelay;
|
|
170
|
-
|
|
171
|
-
proxy_cache static_cache;
|
|
172
|
-
proxy_cache_valid 200 1y;
|
|
173
|
-
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
174
|
-
|
|
175
|
-
proxy_pass http://web_backend;
|
|
176
|
-
expires 1y;
|
|
177
|
-
add_header Cache-Control "public, immutable";
|
|
178
|
-
add_header X-Content-Type-Options "nosniff";
|
|
179
|
-
|
|
180
|
-
# CORS headers for fonts and assets
|
|
181
|
-
add_header Access-Control-Allow-Origin "*";
|
|
182
|
-
add_header Access-Control-Allow-Methods "GET, OPTIONS";
|
|
183
|
-
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range";
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
# Web application with caching
|
|
187
|
-
location / {
|
|
188
|
-
limit_req zone=web burst=50 nodelay;
|
|
189
|
-
|
|
190
|
-
# Short cache for HTML files
|
|
191
|
-
proxy_cache static_cache;
|
|
192
|
-
proxy_cache_valid 200 10m;
|
|
193
|
-
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
194
|
-
proxy_cache_bypass $http_cache_control;
|
|
195
|
-
|
|
196
|
-
proxy_pass http://web_backend;
|
|
197
|
-
proxy_http_version 1.1;
|
|
198
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
199
|
-
proxy_set_header Connection 'upgrade';
|
|
200
|
-
proxy_set_header Host $host;
|
|
201
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
202
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
203
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
204
|
-
proxy_cache_bypass $http_upgrade;
|
|
205
|
-
|
|
206
|
-
# Handle client-side routing
|
|
207
|
-
try_files $uri $uri/ @fallback;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
# Fallback for client-side routing
|
|
211
|
-
location @fallback {
|
|
212
|
-
proxy_pass http://web_backend;
|
|
213
|
-
proxy_set_header Host $host;
|
|
214
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
215
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
216
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
217
|
-
proxy_cache off;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
# Monitoring endpoint
|
|
221
|
-
location /nginx_status {
|
|
222
|
-
stub_status on;
|
|
223
|
-
access_log off;
|
|
224
|
-
allow 127.0.0.1;
|
|
225
|
-
allow 10.0.0.0/8;
|
|
226
|
-
allow 172.16.0.0/12;
|
|
227
|
-
allow 192.168.0.0/16;
|
|
228
|
-
deny all;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
# Health check endpoint
|
|
232
|
-
location /health {
|
|
233
|
-
access_log off;
|
|
234
|
-
return 200 "healthy\n";
|
|
235
|
-
add_header Content-Type text/plain;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
events {
|
|
2
|
-
worker_connections 1024;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
http {
|
|
6
|
-
include /etc/nginx/mime.types;
|
|
7
|
-
default_type application/octet-stream;
|
|
8
|
-
|
|
9
|
-
# Logging
|
|
10
|
-
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
11
|
-
'$status $body_bytes_sent "$http_referer" '
|
|
12
|
-
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
13
|
-
|
|
14
|
-
access_log /var/log/nginx/access.log main;
|
|
15
|
-
error_log /var/log/nginx/error.log warn;
|
|
16
|
-
|
|
17
|
-
# Basic settings
|
|
18
|
-
sendfile on;
|
|
19
|
-
tcp_nopush on;
|
|
20
|
-
tcp_nodelay on;
|
|
21
|
-
keepalive_timeout 65;
|
|
22
|
-
types_hash_max_size 2048;
|
|
23
|
-
client_max_body_size 50M;
|
|
24
|
-
|
|
25
|
-
# Gzip compression
|
|
26
|
-
gzip on;
|
|
27
|
-
gzip_vary on;
|
|
28
|
-
gzip_min_length 10240;
|
|
29
|
-
gzip_proxied expired no-cache no-store private must-revalidate auth;
|
|
30
|
-
gzip_types
|
|
31
|
-
text/plain
|
|
32
|
-
text/css
|
|
33
|
-
text/xml
|
|
34
|
-
text/javascript
|
|
35
|
-
application/javascript
|
|
36
|
-
application/xml+rss
|
|
37
|
-
application/json;
|
|
38
|
-
|
|
39
|
-
# Rate limiting
|
|
40
|
-
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
|
41
|
-
limit_req_zone $binary_remote_addr zone=web:10m rate=30r/s;
|
|
42
|
-
|
|
43
|
-
# Upstream servers
|
|
44
|
-
upstream api_backend {
|
|
45
|
-
server api:3000 max_fails=3 fail_timeout=30s;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
upstream web_backend {
|
|
49
|
-
server web:80 max_fails=3 fail_timeout=30s;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
# Default server (development)
|
|
53
|
-
server {
|
|
54
|
-
listen 80 default_server;
|
|
55
|
-
server_name _;
|
|
56
|
-
|
|
57
|
-
# Security headers
|
|
58
|
-
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
59
|
-
add_header X-Content-Type-Options "nosniff" always;
|
|
60
|
-
add_header X-XSS-Protection "1; mode=block" always;
|
|
61
|
-
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
62
|
-
|
|
63
|
-
# API routes
|
|
64
|
-
location /api/ {
|
|
65
|
-
limit_req zone=api burst=20 nodelay;
|
|
66
|
-
|
|
67
|
-
proxy_pass http://api_backend/;
|
|
68
|
-
proxy_http_version 1.1;
|
|
69
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
70
|
-
proxy_set_header Connection 'upgrade';
|
|
71
|
-
proxy_set_header Host $host;
|
|
72
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
73
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
74
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
75
|
-
proxy_cache_bypass $http_upgrade;
|
|
76
|
-
proxy_connect_timeout 30s;
|
|
77
|
-
proxy_send_timeout 30s;
|
|
78
|
-
proxy_read_timeout 30s;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# Health check for API
|
|
82
|
-
location /api/health {
|
|
83
|
-
proxy_pass http://api_backend/health;
|
|
84
|
-
access_log off;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
# Static assets with long cache
|
|
88
|
-
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
89
|
-
limit_req zone=web burst=50 nodelay;
|
|
90
|
-
|
|
91
|
-
proxy_pass http://web_backend;
|
|
92
|
-
expires 1y;
|
|
93
|
-
add_header Cache-Control "public, immutable";
|
|
94
|
-
add_header X-Content-Type-Options "nosniff";
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
# Web application
|
|
98
|
-
location / {
|
|
99
|
-
limit_req zone=web burst=30 nodelay;
|
|
100
|
-
|
|
101
|
-
proxy_pass http://web_backend;
|
|
102
|
-
proxy_http_version 1.1;
|
|
103
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
104
|
-
proxy_set_header Connection 'upgrade';
|
|
105
|
-
proxy_set_header Host $host;
|
|
106
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
107
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
108
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
109
|
-
proxy_cache_bypass $http_upgrade;
|
|
110
|
-
|
|
111
|
-
# Handle client-side routing
|
|
112
|
-
try_files $uri $uri/ @fallback;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
# Fallback for client-side routing
|
|
116
|
-
location @fallback {
|
|
117
|
-
proxy_pass http://web_backend;
|
|
118
|
-
proxy_set_header Host $host;
|
|
119
|
-
proxy_set_header X-Real-IP $remote_addr;
|
|
120
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
121
|
-
proxy_set_header X-Forwarded-Proto $scheme;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
# Health check endpoint
|
|
125
|
-
location /health {
|
|
126
|
-
access_log off;
|
|
127
|
-
return 200 "healthy\n";
|
|
128
|
-
add_header Content-Type text/plain;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
-- PostgreSQL initialization script for Idealyst
|
|
2
|
-
-- This script sets up the database with proper extensions and initial configurations
|
|
3
|
-
|
|
4
|
-
\echo 'Creating database extensions...'
|
|
5
|
-
|
|
6
|
-
-- Enable UUID extension for generating UUIDs
|
|
7
|
-
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
|
8
|
-
|
|
9
|
-
-- Enable pgcrypto for password hashing
|
|
10
|
-
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
|
11
|
-
|
|
12
|
-
-- Enable ltree for hierarchical data
|
|
13
|
-
CREATE EXTENSION IF NOT EXISTS "ltree";
|
|
14
|
-
|
|
15
|
-
-- Enable pg_trgm for text search
|
|
16
|
-
CREATE EXTENSION IF NOT EXISTS "pg_trgm";
|
|
17
|
-
|
|
18
|
-
-- Enable unaccent for text normalization
|
|
19
|
-
CREATE EXTENSION IF NOT EXISTS "unaccent";
|
|
20
|
-
|
|
21
|
-
\echo 'Database extensions created successfully!'
|
|
22
|
-
|
|
23
|
-
-- Create development and test databases if they don't exist
|
|
24
|
-
SELECT 'CREATE DATABASE idealyst_dev'
|
|
25
|
-
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'idealyst_dev')\gexec
|
|
26
|
-
|
|
27
|
-
SELECT 'CREATE DATABASE idealyst_test'
|
|
28
|
-
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'idealyst_test')\gexec
|
|
29
|
-
|
|
30
|
-
\echo 'Development and test databases created!'
|
|
31
|
-
|
|
32
|
-
-- Set up basic configuration
|
|
33
|
-
ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements';
|
|
34
|
-
ALTER SYSTEM SET log_statement = 'all';
|
|
35
|
-
ALTER SYSTEM SET log_min_duration_statement = 1000;
|
|
36
|
-
ALTER SYSTEM SET max_connections = 200;
|
|
37
|
-
|
|
38
|
-
-- Reload configuration
|
|
39
|
-
SELECT pg_reload_conf();
|
|
40
|
-
|
|
41
|
-
\echo 'PostgreSQL initialization complete!'
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
global:
|
|
2
|
-
scrape_interval: 15s
|
|
3
|
-
evaluation_interval: 15s
|
|
4
|
-
|
|
5
|
-
rule_files:
|
|
6
|
-
# - "first_rules.yml"
|
|
7
|
-
# - "second_rules.yml"
|
|
8
|
-
|
|
9
|
-
scrape_configs:
|
|
10
|
-
# Prometheus itself
|
|
11
|
-
- job_name: 'prometheus'
|
|
12
|
-
static_configs:
|
|
13
|
-
- targets: ['localhost:9090']
|
|
14
|
-
|
|
15
|
-
# API service
|
|
16
|
-
- job_name: 'api'
|
|
17
|
-
static_configs:
|
|
18
|
-
- targets: ['api:3000']
|
|
19
|
-
metrics_path: '/metrics'
|
|
20
|
-
scrape_interval: 30s
|
|
21
|
-
|
|
22
|
-
# Web service (if it has metrics endpoint)
|
|
23
|
-
- job_name: 'web'
|
|
24
|
-
static_configs:
|
|
25
|
-
- targets: ['web:80']
|
|
26
|
-
metrics_path: '/metrics'
|
|
27
|
-
scrape_interval: 30s
|
|
28
|
-
|
|
29
|
-
# PostgreSQL exporter (optional)
|
|
30
|
-
- job_name: 'postgres'
|
|
31
|
-
static_configs:
|
|
32
|
-
- targets: ['postgres_exporter:9187']
|
|
33
|
-
scrape_interval: 30s
|
|
34
|
-
|
|
35
|
-
# Redis exporter (optional)
|
|
36
|
-
- job_name: 'redis'
|
|
37
|
-
static_configs:
|
|
38
|
-
- targets: ['redis_exporter:9121']
|
|
39
|
-
scrape_interval: 30s
|
|
40
|
-
|
|
41
|
-
# Node exporter for system metrics (optional)
|
|
42
|
-
- job_name: 'node'
|
|
43
|
-
static_configs:
|
|
44
|
-
- targets: ['node_exporter:9100']
|
|
45
|
-
scrape_interval: 30s
|
|
46
|
-
|
|
47
|
-
# Nginx metrics
|
|
48
|
-
- job_name: 'nginx'
|
|
49
|
-
static_configs:
|
|
50
|
-
- targets: ['nginx:80']
|
|
51
|
-
metrics_path: '/nginx_status'
|
|
52
|
-
scrape_interval: 30s
|