@idealyst/cli 1.0.88 → 1.0.90

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 (208) hide show
  1. package/dist/generators/index.js +3 -40
  2. package/dist/generators/index.js.map +1 -1
  3. package/dist/generators/init.js +273 -0
  4. package/dist/generators/init.js.map +1 -0
  5. package/dist/generators/utils.js +5 -0
  6. package/dist/generators/utils.js.map +1 -1
  7. package/dist/index.js +20 -202
  8. package/dist/index.js.map +1 -1
  9. package/dist/scripts/configure-react-native-monorepo.js +144 -0
  10. package/dist/scripts/configure-react-native-monorepo.js.map +1 -0
  11. package/dist/{templates/workspace → template}/README.md +66 -12
  12. package/dist/template/package.json +45 -0
  13. package/{templates → dist/template/packages}/api/package.json +3 -1
  14. package/{templates → dist/template/packages}/database/package.json +1 -1
  15. package/dist/{templates/native → template/packages/mobile}/babel.config.js +1 -0
  16. package/{templates/native → dist/template/packages/mobile}/metro.config.js +4 -4
  17. package/{templates/native → dist/template/packages/mobile}/package.json +5 -2
  18. package/{templates → dist/template/packages}/shared/package.json +2 -2
  19. package/{templates → dist/template/packages}/web/package.json +4 -1
  20. package/dist/types/generators/index.d.ts +1 -7
  21. package/dist/types/generators/init.d.ts +5 -0
  22. package/dist/types/scripts/configure-react-native-monorepo.d.ts +23 -0
  23. package/dist/types/types.d.ts +0 -4
  24. package/package.json +1 -1
  25. package/dist/generators/api.js +0 -31
  26. package/dist/generators/api.js.map +0 -1
  27. package/dist/generators/database.js +0 -31
  28. package/dist/generators/database.js.map +0 -1
  29. package/dist/generators/fullstack.js +0 -418
  30. package/dist/generators/fullstack.js.map +0 -1
  31. package/dist/generators/native.js +0 -112
  32. package/dist/generators/native.js.map +0 -1
  33. package/dist/generators/shared.js +0 -29
  34. package/dist/generators/shared.js.map +0 -1
  35. package/dist/generators/web.js +0 -45
  36. package/dist/generators/web.js.map +0 -1
  37. package/dist/generators/workspace.js +0 -83
  38. package/dist/generators/workspace.js.map +0 -1
  39. package/dist/templates/api/package.json +0 -54
  40. package/dist/templates/database/package.json +0 -49
  41. package/dist/templates/native/metro.config.js +0 -27
  42. package/dist/templates/native/package.json +0 -49
  43. package/dist/templates/native/src/App.tsx +0 -8
  44. package/dist/templates/shared/package.json +0 -62
  45. package/dist/templates/shared/src/components/App.tsx +0 -47
  46. package/dist/templates/shared/src/components/HelloWorld.tsx +0 -307
  47. package/dist/templates/shared/src/navigation/AppRouter.tsx +0 -98
  48. package/dist/templates/web/package.json +0 -66
  49. package/dist/templates/web/src/App.tsx +0 -14
  50. package/dist/templates/workspace/package.json +0 -35
  51. package/dist/types/generators/api.d.ts +0 -2
  52. package/dist/types/generators/database.d.ts +0 -2
  53. package/dist/types/generators/fullstack.d.ts +0 -2
  54. package/dist/types/generators/native.d.ts +0 -2
  55. package/dist/types/generators/shared.d.ts +0 -2
  56. package/dist/types/generators/web.d.ts +0 -2
  57. package/dist/types/generators/workspace.d.ts +0 -2
  58. package/templates/api/.env.example +0 -6
  59. package/templates/api/README.md +0 -274
  60. package/templates/api/__tests__/api.test.ts +0 -26
  61. package/templates/api/jest.config.js +0 -23
  62. package/templates/api/jest.setup.js +0 -9
  63. package/templates/api/src/context.ts +0 -19
  64. package/templates/api/src/controllers/TestController.ts +0 -0
  65. package/templates/api/src/index.ts +0 -9
  66. package/templates/api/src/lib/crud.ts +0 -150
  67. package/templates/api/src/lib/database.ts +0 -23
  68. package/templates/api/src/router/index.ts +0 -163
  69. package/templates/api/src/routers/test.ts +0 -59
  70. package/templates/api/src/routers/user.example.ts +0 -83
  71. package/templates/api/src/server.ts +0 -50
  72. package/templates/api/src/trpc.ts +0 -28
  73. package/templates/api/tsconfig.json +0 -43
  74. package/templates/database/README.md +0 -162
  75. package/templates/database/prisma/seed.ts +0 -64
  76. package/templates/database/schema.prisma +0 -107
  77. package/templates/database/src/index.ts +0 -15
  78. package/templates/database/src/validators.ts +0 -10
  79. package/templates/database/tsconfig.json +0 -18
  80. package/templates/native/README.md +0 -86
  81. package/templates/native/__tests__/App.test.tsx +0 -156
  82. package/templates/native/__tests__/components.test.tsx +0 -300
  83. package/templates/native/app.json +0 -5
  84. package/templates/native/babel.config.js +0 -10
  85. package/templates/native/index.js +0 -6
  86. package/templates/native/jest.config.js +0 -21
  87. package/templates/native/jest.setup.js +0 -12
  88. package/templates/native/src/App-with-trpc.tsx +0 -30
  89. package/templates/native/src/App.tsx +0 -8
  90. package/templates/native/src/utils/trpc.ts +0 -7
  91. package/templates/native/tsconfig.json +0 -28
  92. package/templates/shared/README.md +0 -135
  93. package/templates/shared/__tests__/shared.test.ts +0 -51
  94. package/templates/shared/jest.config.js +0 -22
  95. package/templates/shared/src/components/index.ts +0 -1
  96. package/templates/shared/src/index.ts +0 -14
  97. package/templates/shared/src/trpc/client.ts +0 -44
  98. package/templates/shared/tsconfig.json +0 -22
  99. package/templates/web/README.md +0 -131
  100. package/templates/web/__tests__/App.test.tsx +0 -342
  101. package/templates/web/__tests__/components.test.tsx +0 -564
  102. package/templates/web/index.html +0 -13
  103. package/templates/web/jest.config.js +0 -27
  104. package/templates/web/jest.setup.js +0 -24
  105. package/templates/web/src/App-with-trpc.tsx +0 -32
  106. package/templates/web/src/App.tsx +0 -14
  107. package/templates/web/src/components/TestDemo.tsx +0 -164
  108. package/templates/web/src/main.tsx +0 -25
  109. package/templates/web/src/utils/trpc.ts +0 -7
  110. package/templates/web/tsconfig.json +0 -26
  111. package/templates/web/vite.config.ts +0 -98
  112. package/templates/workspace/.devcontainer/Dockerfile +0 -26
  113. package/templates/workspace/.devcontainer/devcontainer.json +0 -113
  114. package/templates/workspace/.devcontainer/docker-compose.yml +0 -59
  115. package/templates/workspace/.devcontainer/figma-mcp.sh +0 -32
  116. package/templates/workspace/.devcontainer/setup.sh +0 -45
  117. package/templates/workspace/.dockerignore +0 -151
  118. package/templates/workspace/.env.example +0 -36
  119. package/templates/workspace/.env.production +0 -56
  120. package/templates/workspace/DOCKER.md +0 -0
  121. package/templates/workspace/Dockerfile +0 -111
  122. package/templates/workspace/README.md +0 -179
  123. package/templates/workspace/docker/nginx/prod.conf +0 -238
  124. package/templates/workspace/docker/nginx.conf +0 -131
  125. package/templates/workspace/docker/postgres/init.sql +0 -41
  126. package/templates/workspace/docker/prometheus/prometheus.yml +0 -52
  127. package/templates/workspace/docker-compose.prod.yml +0 -146
  128. package/templates/workspace/docker-compose.yml +0 -143
  129. package/templates/workspace/jest.config.js +0 -20
  130. package/templates/workspace/package.json +0 -38
  131. package/templates/workspace/setup.sh +0 -30
  132. package/templates/workspace/tsconfig.json +0 -31
  133. /package/dist/{templates/workspace → template}/.devcontainer/Dockerfile +0 -0
  134. /package/dist/{templates/workspace → template}/.devcontainer/devcontainer.json +0 -0
  135. /package/dist/{templates/workspace → template}/.devcontainer/docker-compose.yml +0 -0
  136. /package/dist/{templates/workspace → template}/.devcontainer/figma-mcp.sh +0 -0
  137. /package/dist/{templates/workspace → template}/.devcontainer/setup.sh +0 -0
  138. /package/dist/{templates/workspace → template}/.dockerignore +0 -0
  139. /package/dist/{templates/workspace → template}/.env.example +0 -0
  140. /package/dist/{templates/workspace → template}/DOCKER.md +0 -0
  141. /package/dist/{templates/workspace → template}/Dockerfile +0 -0
  142. /package/dist/{templates/workspace → template}/docker/nginx/prod.conf +0 -0
  143. /package/dist/{templates/workspace → template}/docker/nginx.conf +0 -0
  144. /package/dist/{templates/workspace → template}/docker/postgres/init.sql +0 -0
  145. /package/dist/{templates/workspace → template}/docker/prometheus/prometheus.yml +0 -0
  146. /package/dist/{templates/workspace → template}/docker-compose.prod.yml +0 -0
  147. /package/dist/{templates/workspace → template}/docker-compose.yml +0 -0
  148. /package/dist/{templates/workspace → template}/jest.config.js +0 -0
  149. /package/dist/{templates → template/packages}/api/.env.example +0 -0
  150. /package/dist/{templates → template/packages}/api/README.md +0 -0
  151. /package/dist/{templates → template/packages}/api/__tests__/api.test.ts +0 -0
  152. /package/dist/{templates → template/packages}/api/jest.config.js +0 -0
  153. /package/dist/{templates → template/packages}/api/jest.setup.js +0 -0
  154. /package/dist/{templates → template/packages}/api/src/context.ts +0 -0
  155. /package/dist/{templates → template/packages}/api/src/controllers/TestController.ts +0 -0
  156. /package/dist/{templates → template/packages}/api/src/index.ts +0 -0
  157. /package/dist/{templates → template/packages}/api/src/lib/crud.ts +0 -0
  158. /package/dist/{templates → template/packages}/api/src/lib/database.ts +0 -0
  159. /package/dist/{templates → template/packages}/api/src/router/index.ts +0 -0
  160. /package/dist/{templates → template/packages}/api/src/routers/test.ts +0 -0
  161. /package/dist/{templates → template/packages}/api/src/routers/user.example.ts +0 -0
  162. /package/dist/{templates → template/packages}/api/src/server.ts +0 -0
  163. /package/dist/{templates → template/packages}/api/src/trpc.ts +0 -0
  164. /package/dist/{templates → template/packages}/api/tsconfig.json +0 -0
  165. /package/dist/{templates → template/packages}/database/README.md +0 -0
  166. /package/dist/{templates → template/packages}/database/prisma/seed.ts +0 -0
  167. /package/dist/{templates → template/packages}/database/schema.prisma +0 -0
  168. /package/dist/{templates → template/packages}/database/src/index.ts +0 -0
  169. /package/dist/{templates → template/packages}/database/src/validators.ts +0 -0
  170. /package/dist/{templates → template/packages}/database/tsconfig.json +0 -0
  171. /package/dist/{templates/native → template/packages/mobile}/README.md +0 -0
  172. /package/dist/{templates/native → template/packages/mobile}/__tests__/App.test.tsx +0 -0
  173. /package/dist/{templates/native → template/packages/mobile}/__tests__/components.test.tsx +0 -0
  174. /package/dist/{templates/native → template/packages/mobile}/app.json +0 -0
  175. /package/dist/{templates/native → template/packages/mobile}/index.js +0 -0
  176. /package/dist/{templates/native → template/packages/mobile}/jest.config.js +0 -0
  177. /package/dist/{templates/native → template/packages/mobile}/jest.setup.js +0 -0
  178. /package/dist/{templates/native → template/packages/mobile}/src/App-with-trpc-and-shared.tsx +0 -0
  179. /package/dist/{templates/native → template/packages/mobile}/src/App-with-trpc.tsx +0 -0
  180. /package/{templates/native/src/App-with-trpc-and-shared.tsx → dist/template/packages/mobile/src/App.tsx} +0 -0
  181. /package/dist/{templates/native → template/packages/mobile}/src/utils/trpc.ts +0 -0
  182. /package/dist/{templates/native → template/packages/mobile}/tsconfig.json +0 -0
  183. /package/dist/{templates → template/packages}/shared/README.md +0 -0
  184. /package/dist/{templates → template/packages}/shared/__tests__/shared.test.ts +0 -0
  185. /package/dist/{templates → template/packages}/shared/jest.config.js +0 -0
  186. /package/{templates → dist/template/packages}/shared/src/components/App.tsx +0 -0
  187. /package/{templates → dist/template/packages}/shared/src/components/HelloWorld.tsx +0 -0
  188. /package/dist/{templates → template/packages}/shared/src/components/index.ts +0 -0
  189. /package/dist/{templates → template/packages}/shared/src/index.ts +0 -0
  190. /package/{templates → dist/template/packages}/shared/src/navigation/AppRouter.tsx +0 -0
  191. /package/dist/{templates → template/packages}/shared/src/trpc/client.ts +0 -0
  192. /package/dist/{templates → template/packages}/shared/tsconfig.json +0 -0
  193. /package/dist/{templates → template/packages}/web/README.md +0 -0
  194. /package/dist/{templates → template/packages}/web/__tests__/App.test.tsx +0 -0
  195. /package/dist/{templates → template/packages}/web/__tests__/components.test.tsx +0 -0
  196. /package/dist/{templates → template/packages}/web/index.html +0 -0
  197. /package/dist/{templates → template/packages}/web/jest.config.js +0 -0
  198. /package/dist/{templates → template/packages}/web/jest.setup.js +0 -0
  199. /package/dist/{templates → template/packages}/web/src/App-with-trpc-and-shared.tsx +0 -0
  200. /package/dist/{templates → template/packages}/web/src/App-with-trpc.tsx +0 -0
  201. /package/{templates/web/src/App-with-trpc-and-shared.tsx → dist/template/packages/web/src/App.tsx} +0 -0
  202. /package/dist/{templates → template/packages}/web/src/components/TestDemo.tsx +0 -0
  203. /package/dist/{templates → template/packages}/web/src/main.tsx +0 -0
  204. /package/dist/{templates → template/packages}/web/src/utils/trpc.ts +0 -0
  205. /package/dist/{templates → template/packages}/web/tsconfig.json +0 -0
  206. /package/dist/{templates → template/packages}/web/vite.config.ts +0 -0
  207. /package/dist/{templates/workspace → template}/setup.sh +0 -0
  208. /package/dist/{templates/workspace → template}/tsconfig.json +0 -0
@@ -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
@@ -1,146 +0,0 @@
1
- version: '3.8'
2
-
3
- # Production overrides for docker-compose.yml
4
- # Usage: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
5
-
6
- services:
7
- postgres:
8
- environment:
9
- POSTGRES_DB: ${POSTGRES_DB}
10
- POSTGRES_USER: ${POSTGRES_USER}
11
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
12
- volumes:
13
- - postgres_prod_data:/var/lib/postgresql/data
14
- deploy:
15
- resources:
16
- limits:
17
- memory: 1G
18
- cpus: '0.5'
19
- reservations:
20
- memory: 512M
21
- cpus: '0.25'
22
-
23
- redis:
24
- volumes:
25
- - redis_prod_data:/data
26
- deploy:
27
- resources:
28
- limits:
29
- memory: 256M
30
- cpus: '0.25'
31
- reservations:
32
- memory: 128M
33
- cpus: '0.1'
34
-
35
- api:
36
- environment:
37
- NODE_ENV: production
38
- LOG_LEVEL: info
39
- RATE_LIMIT_WINDOW_MS: 900000
40
- RATE_LIMIT_MAX_REQUESTS: 100
41
- deploy:
42
- replicas: 2
43
- resources:
44
- limits:
45
- memory: 512M
46
- cpus: '0.5'
47
- reservations:
48
- memory: 256M
49
- cpus: '0.25'
50
- restart_policy:
51
- condition: on-failure
52
- delay: 5s
53
- max_attempts: 3
54
- window: 120s
55
-
56
- web:
57
- deploy:
58
- replicas: 2
59
- resources:
60
- limits:
61
- memory: 128M
62
- cpus: '0.25'
63
- reservations:
64
- memory: 64M
65
- cpus: '0.1'
66
- restart_policy:
67
- condition: on-failure
68
- delay: 5s
69
- max_attempts: 3
70
- window: 120s
71
-
72
- # Load balancer for production
73
- nginx:
74
- image: nginx:alpine
75
- container_name: ${PROJECT_NAME:-idealyst}-nginx
76
- ports:
77
- - "80:80"
78
- - "443:443"
79
- volumes:
80
- - ./docker/nginx/prod.conf:/etc/nginx/nginx.conf:ro
81
- - ./docker/nginx/ssl:/etc/nginx/ssl:ro
82
- - ./logs/nginx:/var/log/nginx
83
- depends_on:
84
- - api
85
- - web
86
- restart: unless-stopped
87
- deploy:
88
- resources:
89
- limits:
90
- memory: 128M
91
- cpus: '0.25'
92
- reservations:
93
- memory: 64M
94
- cpus: '0.1'
95
- networks:
96
- - idealyst-network
97
-
98
- # Monitoring with Prometheus (optional)
99
- prometheus:
100
- image: prom/prometheus:latest
101
- container_name: ${PROJECT_NAME:-idealyst}-prometheus
102
- ports:
103
- - "9090:9090"
104
- volumes:
105
- - ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
106
- - prometheus_data:/prometheus
107
- command:
108
- - '--config.file=/etc/prometheus/prometheus.yml'
109
- - '--storage.tsdb.path=/prometheus'
110
- - '--web.console.libraries=/etc/prometheus/console_libraries'
111
- - '--web.console.templates=/etc/prometheus/consoles'
112
- - '--storage.tsdb.retention.time=200h'
113
- - '--web.enable-lifecycle'
114
- restart: unless-stopped
115
- networks:
116
- - idealyst-network
117
- profiles:
118
- - monitoring
119
-
120
- # Log aggregation with Grafana (optional)
121
- grafana:
122
- image: grafana/grafana:latest
123
- container_name: ${PROJECT_NAME:-idealyst}-grafana
124
- ports:
125
- - "3002:3000"
126
- volumes:
127
- - grafana_data:/var/lib/grafana
128
- - ./docker/grafana/provisioning:/etc/grafana/provisioning
129
- environment:
130
- GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
131
- GF_USERS_ALLOW_SIGN_UP: false
132
- restart: unless-stopped
133
- networks:
134
- - idealyst-network
135
- profiles:
136
- - monitoring
137
-
138
- volumes:
139
- postgres_prod_data:
140
- redis_prod_data:
141
- prometheus_data:
142
- grafana_data:
143
-
144
- networks:
145
- idealyst-network:
146
- driver: bridge