@idealyst/cli 1.0.33 → 1.0.35
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/templates/api/README.md +207 -0
- package/dist/templates/api/__tests__/api.test.ts +26 -0
- package/dist/templates/api/env.example +12 -0
- package/dist/templates/api/jest.config.js +23 -0
- package/dist/templates/api/jest.setup.js +9 -0
- package/dist/templates/api/package.json +62 -0
- package/dist/templates/api/prisma/schema.prisma +21 -0
- package/dist/templates/api/src/context.ts +23 -0
- package/dist/templates/api/src/controllers/UserController.ts +102 -0
- package/dist/templates/api/src/index.ts +14 -0
- package/dist/templates/api/src/lib/controller.ts +90 -0
- package/dist/templates/api/src/lib/middleware.ts +170 -0
- package/dist/templates/api/src/middleware/auth.ts +75 -0
- package/dist/templates/api/src/middleware/common.ts +103 -0
- package/dist/templates/api/src/router/index.ts +130 -0
- package/dist/templates/api/src/server.ts +50 -0
- package/dist/templates/api/src/trpc.ts +28 -0
- package/dist/templates/api/tsconfig.json +44 -0
- package/dist/templates/native/.yarnrc.yml +19 -0
- package/dist/templates/native/App.tsx +23 -0
- package/dist/templates/native/README.md +86 -0
- package/dist/templates/native/__tests__/App.test.tsx +156 -0
- package/dist/templates/native/__tests__/components.test.tsx +300 -0
- package/dist/templates/native/app.json +5 -0
- package/dist/templates/native/babel.config.js +10 -0
- package/dist/templates/native/index.js +6 -0
- package/dist/templates/native/jest.config.js +21 -0
- package/dist/templates/native/jest.setup.js +12 -0
- package/dist/templates/native/metro.config.js +27 -0
- package/dist/templates/native/package.json +44 -0
- package/dist/templates/native/src/App-with-trpc.tsx +59 -0
- package/dist/templates/native/src/utils/trpc.ts +127 -0
- package/dist/templates/native/tsconfig.json +30 -0
- package/dist/templates/shared/README.md +109 -0
- package/dist/templates/shared/__tests__/shared.test.ts +39 -0
- package/dist/templates/shared/jest.config.js +22 -0
- package/dist/templates/shared/package.json +50 -0
- package/dist/templates/shared/rollup.config.js +43 -0
- package/dist/templates/shared/src/index.ts +1 -0
- package/dist/templates/shared/tsconfig.json +25 -0
- package/dist/templates/web/README.md +90 -0
- package/dist/templates/web/__tests__/App.test.tsx +342 -0
- package/dist/templates/web/__tests__/components.test.tsx +564 -0
- package/dist/templates/web/index.html +13 -0
- package/dist/templates/web/jest.config.js +27 -0
- package/dist/templates/web/jest.setup.js +24 -0
- package/dist/templates/web/package.json +66 -0
- package/dist/templates/web/src/App-with-trpc.tsx +67 -0
- package/dist/templates/web/src/App.tsx +15 -0
- package/dist/templates/web/src/main.tsx +25 -0
- package/dist/templates/web/src/utils/trpc.ts +93 -0
- package/dist/templates/web/tsconfig.json +27 -0
- package/dist/templates/web/vite.config.ts +69 -0
- package/dist/templates/workspace/.devcontainer/devcontainer.json +140 -0
- package/dist/templates/workspace/.devcontainer/docker-compose.yml +74 -0
- package/dist/templates/workspace/.dockerignore +151 -0
- package/dist/templates/workspace/.env.example +36 -0
- package/dist/templates/workspace/.env.production +56 -0
- package/dist/templates/workspace/.yarnrc.yml +26 -0
- package/dist/templates/workspace/DOCKER.md +0 -0
- package/dist/templates/workspace/Dockerfile +93 -0
- package/dist/templates/workspace/README.md +179 -0
- package/dist/templates/workspace/docker/nginx/prod.conf +238 -0
- package/dist/templates/workspace/docker/nginx.conf +131 -0
- package/dist/templates/workspace/docker/postgres/init.sql +41 -0
- package/dist/templates/workspace/docker/prometheus/prometheus.yml +52 -0
- package/dist/templates/workspace/docker-compose.prod.yml +146 -0
- package/dist/templates/workspace/docker-compose.yml +144 -0
- package/dist/templates/workspace/jest.config.js +20 -0
- package/dist/templates/workspace/package.json +35 -0
- package/dist/templates/workspace/scripts/docker/db-backup.sh +230 -0
- package/dist/templates/workspace/scripts/docker/deploy.sh +212 -0
- package/dist/templates/workspace/scripts/docker-build.sh +151 -0
- package/dist/templates/workspace/scripts/test-runner.js +120 -0
- package/dist/templates/workspace/setup.sh +205 -0
- package/package.json +3 -2
- package/templates/workspace/.devcontainer/Dockerfile +22 -0
- package/templates/workspace/.devcontainer/devcontainer.json +0 -140
- package/templates/workspace/.devcontainer/docker-compose.yml +13 -26
- package/templates/workspace/.devcontainer/setup.sh +64 -0
- package/templates/workspace/Dockerfile +24 -6
- /package/{templates → dist/templates}/workspace/.devcontainer/post-create.sh +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
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:3001 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
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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!'
|
|
@@ -0,0 +1,52 @@
|
|
|
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:3001']
|
|
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
|
|
@@ -0,0 +1,146 @@
|
|
|
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
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
version: '3.8'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
# PostgreSQL Database
|
|
5
|
+
postgres:
|
|
6
|
+
image: postgres:15-alpine
|
|
7
|
+
container_name: ${PROJECT_NAME:-idealyst}-postgres
|
|
8
|
+
environment:
|
|
9
|
+
POSTGRES_DB: ${POSTGRES_DB:-idealyst_db}
|
|
10
|
+
POSTGRES_USER: ${POSTGRES_USER:-postgres}
|
|
11
|
+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
|
|
12
|
+
ports:
|
|
13
|
+
- "${POSTGRES_PORT:-5432}:5432"
|
|
14
|
+
volumes:
|
|
15
|
+
- postgres_data:/var/lib/postgresql/data
|
|
16
|
+
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
17
|
+
healthcheck:
|
|
18
|
+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
|
|
19
|
+
interval: 30s
|
|
20
|
+
timeout: 10s
|
|
21
|
+
retries: 5
|
|
22
|
+
networks:
|
|
23
|
+
- idealyst-network
|
|
24
|
+
|
|
25
|
+
# Redis Cache
|
|
26
|
+
redis:
|
|
27
|
+
image: redis:7-alpine
|
|
28
|
+
container_name: ${PROJECT_NAME:-idealyst}-redis
|
|
29
|
+
ports:
|
|
30
|
+
- "${REDIS_PORT:-6379}:6379"
|
|
31
|
+
volumes:
|
|
32
|
+
- redis_data:/data
|
|
33
|
+
healthcheck:
|
|
34
|
+
test: ["CMD", "redis-cli", "ping"]
|
|
35
|
+
interval: 30s
|
|
36
|
+
timeout: 10s
|
|
37
|
+
retries: 5
|
|
38
|
+
networks:
|
|
39
|
+
- idealyst-network
|
|
40
|
+
|
|
41
|
+
# API Service
|
|
42
|
+
api:
|
|
43
|
+
build:
|
|
44
|
+
context: .
|
|
45
|
+
dockerfile: Dockerfile
|
|
46
|
+
target: api-runner
|
|
47
|
+
container_name: ${PROJECT_NAME:-idealyst}-api
|
|
48
|
+
environment:
|
|
49
|
+
NODE_ENV: ${NODE_ENV:-production}
|
|
50
|
+
PORT: 3001
|
|
51
|
+
DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-idealyst_db}
|
|
52
|
+
REDIS_URL: redis://redis:6379
|
|
53
|
+
ports:
|
|
54
|
+
- "${API_PORT:-3001}:3001"
|
|
55
|
+
depends_on:
|
|
56
|
+
postgres:
|
|
57
|
+
condition: service_healthy
|
|
58
|
+
redis:
|
|
59
|
+
condition: service_healthy
|
|
60
|
+
volumes:
|
|
61
|
+
- ./uploads:/app/uploads
|
|
62
|
+
restart: unless-stopped
|
|
63
|
+
healthcheck:
|
|
64
|
+
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
|
|
65
|
+
interval: 30s
|
|
66
|
+
timeout: 10s
|
|
67
|
+
retries: 5
|
|
68
|
+
networks:
|
|
69
|
+
- idealyst-network
|
|
70
|
+
|
|
71
|
+
# Web Application
|
|
72
|
+
web:
|
|
73
|
+
build:
|
|
74
|
+
context: .
|
|
75
|
+
dockerfile: Dockerfile
|
|
76
|
+
target: web-runner
|
|
77
|
+
container_name: ${PROJECT_NAME:-idealyst}-web
|
|
78
|
+
ports:
|
|
79
|
+
- "${WEB_PORT:-80}:80"
|
|
80
|
+
depends_on:
|
|
81
|
+
- api
|
|
82
|
+
restart: unless-stopped
|
|
83
|
+
healthcheck:
|
|
84
|
+
test: ["CMD", "curl", "-f", "http://localhost"]
|
|
85
|
+
interval: 30s
|
|
86
|
+
timeout: 10s
|
|
87
|
+
retries: 5
|
|
88
|
+
networks:
|
|
89
|
+
- idealyst-network
|
|
90
|
+
|
|
91
|
+
# Development Service (for local development)
|
|
92
|
+
dev:
|
|
93
|
+
build:
|
|
94
|
+
context: .
|
|
95
|
+
dockerfile: Dockerfile
|
|
96
|
+
target: dev
|
|
97
|
+
container_name: ${PROJECT_NAME:-idealyst}-dev
|
|
98
|
+
environment:
|
|
99
|
+
NODE_ENV: development
|
|
100
|
+
ports:
|
|
101
|
+
- "3000:3000" # Web dev server
|
|
102
|
+
- "3001:3001" # API dev server
|
|
103
|
+
- "5173:5173" # Vite dev server
|
|
104
|
+
- "8080:8080" # Additional dev server
|
|
105
|
+
- "19006:19006" # Expo dev tools
|
|
106
|
+
volumes:
|
|
107
|
+
- .:/app
|
|
108
|
+
- /app/node_modules
|
|
109
|
+
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
110
|
+
depends_on:
|
|
111
|
+
postgres:
|
|
112
|
+
condition: service_healthy
|
|
113
|
+
redis:
|
|
114
|
+
condition: service_healthy
|
|
115
|
+
networks:
|
|
116
|
+
- idealyst-network
|
|
117
|
+
tty: true
|
|
118
|
+
stdin_open: true
|
|
119
|
+
|
|
120
|
+
# Test Runner
|
|
121
|
+
test:
|
|
122
|
+
build:
|
|
123
|
+
context: .
|
|
124
|
+
dockerfile: Dockerfile
|
|
125
|
+
target: test-runner
|
|
126
|
+
container_name: ${PROJECT_NAME:-idealyst}-test
|
|
127
|
+
environment:
|
|
128
|
+
NODE_ENV: test
|
|
129
|
+
CI: true
|
|
130
|
+
volumes:
|
|
131
|
+
- .:/app
|
|
132
|
+
- /app/node_modules
|
|
133
|
+
networks:
|
|
134
|
+
- idealyst-network
|
|
135
|
+
profiles:
|
|
136
|
+
- testing
|
|
137
|
+
|
|
138
|
+
volumes:
|
|
139
|
+
postgres_data:
|
|
140
|
+
redis_data:
|
|
141
|
+
|
|
142
|
+
networks:
|
|
143
|
+
idealyst-network:
|
|
144
|
+
driver: bridge
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
projects: [
|
|
4
|
+
'<rootDir>/packages/*/jest.config.js',
|
|
5
|
+
],
|
|
6
|
+
collectCoverage: true,
|
|
7
|
+
collectCoverageFrom: [
|
|
8
|
+
'packages/*/src/**/*.{ts,tsx}',
|
|
9
|
+
'!packages/*/src/**/*.d.ts',
|
|
10
|
+
'!packages/*/src/**/index.ts',
|
|
11
|
+
],
|
|
12
|
+
coverageDirectory: '<rootDir>/coverage',
|
|
13
|
+
coverageReporters: ['text', 'lcov', 'html'],
|
|
14
|
+
testTimeout: 30000,
|
|
15
|
+
// Ignore template files in node_modules
|
|
16
|
+
testPathIgnorePatterns: [
|
|
17
|
+
'/node_modules/',
|
|
18
|
+
'/templates/',
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{packageName}}",
|
|
3
|
+
"version": "{{version}}",
|
|
4
|
+
"description": "{{description}}",
|
|
5
|
+
"private": true,
|
|
6
|
+
"workspaces": [
|
|
7
|
+
"packages/*"
|
|
8
|
+
],
|
|
9
|
+
"packageManager": "yarn@4.1.0",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "yarn workspaces foreach --include '@/*' run test",
|
|
12
|
+
"test:watch": "yarn workspaces foreach --include '@/*' run test:watch",
|
|
13
|
+
"test:coverage": "yarn workspaces foreach --include '@/*' run test:coverage",
|
|
14
|
+
"test:ci": "yarn workspaces foreach --include '@/*' --parallel run test --passWithNoTests",
|
|
15
|
+
"test:runner": "node scripts/test-runner.js",
|
|
16
|
+
"test:help": "node scripts/test-runner.js help",
|
|
17
|
+
"publish:all": "yarn workspaces foreach --include '@/*' npm publish",
|
|
18
|
+
"version:patch": "yarn workspaces foreach --include '@/*' version patch",
|
|
19
|
+
"version:minor": "yarn workspaces foreach --include '@/*' version minor",
|
|
20
|
+
"version:major": "yarn workspaces foreach --include '@/*' version major",
|
|
21
|
+
"build:all": "yarn workspaces foreach --include '@/*' run build",
|
|
22
|
+
"lint:all": "yarn workspaces foreach --include '@/*' run lint",
|
|
23
|
+
"type-check:all": "yarn workspaces foreach --include '@/*' run type-check"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@babel/core": "^7.28.0",
|
|
27
|
+
"@babel/preset-env": "^7.28.0",
|
|
28
|
+
"@babel/preset-react": "^7.27.1",
|
|
29
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
30
|
+
"@types/jest": "^29.5.12",
|
|
31
|
+
"jest": "^29.7.0",
|
|
32
|
+
"ts-jest": "^29.1.2",
|
|
33
|
+
"typescript": "^5.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|