create-nexu 1.0.0

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 (73) hide show
  1. package/README.md +149 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.js +603 -0
  4. package/package.json +41 -0
  5. package/templates/default/.changeset/config.json +11 -0
  6. package/templates/default/.eslintignore +13 -0
  7. package/templates/default/.eslintrc.js +66 -0
  8. package/templates/default/.github/actions/quality/action.yml +53 -0
  9. package/templates/default/.github/dependabot.yml +51 -0
  10. package/templates/default/.github/workflows/deploy-dev.yml +83 -0
  11. package/templates/default/.github/workflows/deploy-prod.yml +83 -0
  12. package/templates/default/.github/workflows/deploy-rec.yml +83 -0
  13. package/templates/default/.husky/commit-msg +1 -0
  14. package/templates/default/.husky/pre-commit +1 -0
  15. package/templates/default/.prettierignore +7 -0
  16. package/templates/default/.prettierrc +19 -0
  17. package/templates/default/.vscode/extensions.json +14 -0
  18. package/templates/default/.vscode/settings.json +36 -0
  19. package/templates/default/apps/.gitkeep +0 -0
  20. package/templates/default/commitlint.config.js +26 -0
  21. package/templates/default/docker/docker-compose.dev.yml +49 -0
  22. package/templates/default/docker/docker-compose.prod.yml +64 -0
  23. package/templates/default/docker/docker-compose.yml +5 -0
  24. package/templates/default/package.json +56 -0
  25. package/templates/default/packages/cache/package.json +26 -0
  26. package/templates/default/packages/cache/src/index.ts +137 -0
  27. package/templates/default/packages/cache/tsconfig.json +9 -0
  28. package/templates/default/packages/cache/tsup.config.ts +9 -0
  29. package/templates/default/packages/config/eslint/index.js +20 -0
  30. package/templates/default/packages/config/package.json +9 -0
  31. package/templates/default/packages/config/typescript/base.json +26 -0
  32. package/templates/default/packages/constants/package.json +26 -0
  33. package/templates/default/packages/constants/src/index.ts +121 -0
  34. package/templates/default/packages/constants/tsconfig.json +9 -0
  35. package/templates/default/packages/constants/tsup.config.ts +9 -0
  36. package/templates/default/packages/logger/package.json +27 -0
  37. package/templates/default/packages/logger/src/index.ts +197 -0
  38. package/templates/default/packages/logger/tsconfig.json +11 -0
  39. package/templates/default/packages/logger/tsup.config.ts +9 -0
  40. package/templates/default/packages/result/package.json +26 -0
  41. package/templates/default/packages/result/src/index.ts +142 -0
  42. package/templates/default/packages/result/tsconfig.json +9 -0
  43. package/templates/default/packages/result/tsup.config.ts +9 -0
  44. package/templates/default/packages/types/package.json +26 -0
  45. package/templates/default/packages/types/src/index.ts +78 -0
  46. package/templates/default/packages/types/tsconfig.json +9 -0
  47. package/templates/default/packages/types/tsup.config.ts +10 -0
  48. package/templates/default/packages/ui/package.json +38 -0
  49. package/templates/default/packages/ui/src/components/Button.tsx +65 -0
  50. package/templates/default/packages/ui/src/components/Card.tsx +90 -0
  51. package/templates/default/packages/ui/src/components/Input.tsx +51 -0
  52. package/templates/default/packages/ui/src/index.ts +15 -0
  53. package/templates/default/packages/ui/tsconfig.json +11 -0
  54. package/templates/default/packages/ui/tsup.config.ts +11 -0
  55. package/templates/default/packages/utils/package.json +30 -0
  56. package/templates/default/packages/utils/src/index.test.ts +130 -0
  57. package/templates/default/packages/utils/src/index.ts +154 -0
  58. package/templates/default/packages/utils/tsconfig.json +10 -0
  59. package/templates/default/packages/utils/tsup.config.ts +10 -0
  60. package/templates/default/pnpm-workspace.yaml +3 -0
  61. package/templates/default/scripts/deploy.sh +25 -0
  62. package/templates/default/scripts/generate-app.sh +166 -0
  63. package/templates/default/scripts/publish-cli.sh +54 -0
  64. package/templates/default/scripts/setup.sh +70 -0
  65. package/templates/default/services/.env.example +16 -0
  66. package/templates/default/services/docker-compose.yml +207 -0
  67. package/templates/default/services/grafana/provisioning/dashboards/dashboards.yml +11 -0
  68. package/templates/default/services/grafana/provisioning/datasources/datasources.yml +9 -0
  69. package/templates/default/services/postgres/init/.gitkeep +2 -0
  70. package/templates/default/services/prometheus/prometheus.yml +13 -0
  71. package/templates/default/tsconfig.json +27 -0
  72. package/templates/default/turbo.json +40 -0
  73. package/templates/default/vitest.config.ts +15 -0
@@ -0,0 +1,207 @@
1
+ version: '3.8'
2
+
3
+ # Base docker-compose for external services
4
+ # Usage: docker compose -f services/docker-compose.yml --profile <profile> up -d
5
+ #
6
+ # Available profiles:
7
+ # - database: PostgreSQL, Redis
8
+ # - messaging: RabbitMQ, Kafka
9
+ # - monitoring: Prometheus, Grafana
10
+ # - storage: MinIO (S3-compatible)
11
+ # - search: Elasticsearch
12
+ # - all: All services
13
+
14
+ networks:
15
+ nexu-network:
16
+ driver: bridge
17
+
18
+ volumes:
19
+ postgres_data:
20
+ redis_data:
21
+ rabbitmq_data:
22
+ kafka_data:
23
+ zookeeper_data:
24
+ prometheus_data:
25
+ grafana_data:
26
+ minio_data:
27
+ elasticsearch_data:
28
+
29
+ services:
30
+ # ============================================
31
+ # DATABASE SERVICES
32
+ # ============================================
33
+ postgres:
34
+ image: postgres:16-alpine
35
+ container_name: nexu-postgres
36
+ profiles: ['database', 'all']
37
+ environment:
38
+ POSTGRES_USER: ${POSTGRES_USER:-nexu}
39
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-nexu}
40
+ POSTGRES_DB: ${POSTGRES_DB:-nexu}
41
+ ports:
42
+ - '5432:5432'
43
+ volumes:
44
+ - postgres_data:/var/lib/postgresql/data
45
+ - ./postgres/init:/docker-entrypoint-initdb.d
46
+ networks:
47
+ - nexu-network
48
+ healthcheck:
49
+ test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-nexu}']
50
+ interval: 10s
51
+ timeout: 5s
52
+ retries: 5
53
+
54
+ redis:
55
+ image: redis:7-alpine
56
+ container_name: nexu-redis
57
+ profiles: ['database', 'all']
58
+ command: redis-server --appendonly yes
59
+ ports:
60
+ - '6379:6379'
61
+ volumes:
62
+ - redis_data:/data
63
+ networks:
64
+ - nexu-network
65
+ healthcheck:
66
+ test: ['CMD', 'redis-cli', 'ping']
67
+ interval: 10s
68
+ timeout: 5s
69
+ retries: 5
70
+
71
+ # ============================================
72
+ # MESSAGING SERVICES
73
+ # ============================================
74
+ rabbitmq:
75
+ image: rabbitmq:3-management-alpine
76
+ container_name: nexu-rabbitmq
77
+ profiles: ['messaging', 'all']
78
+ environment:
79
+ RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:-nexu}
80
+ RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:-nexu}
81
+ ports:
82
+ - '5672:5672'
83
+ - '15672:15672'
84
+ volumes:
85
+ - rabbitmq_data:/var/lib/rabbitmq
86
+ networks:
87
+ - nexu-network
88
+ healthcheck:
89
+ test: ['CMD', 'rabbitmq-diagnostics', '-q', 'ping']
90
+ interval: 30s
91
+ timeout: 10s
92
+ retries: 5
93
+
94
+ zookeeper:
95
+ image: confluentinc/cp-zookeeper:7.5.0
96
+ container_name: nexu-zookeeper
97
+ profiles: ['messaging', 'all']
98
+ environment:
99
+ ZOOKEEPER_CLIENT_PORT: 2181
100
+ ZOOKEEPER_TICK_TIME: 2000
101
+ ports:
102
+ - '2181:2181'
103
+ volumes:
104
+ - zookeeper_data:/var/lib/zookeeper/data
105
+ networks:
106
+ - nexu-network
107
+
108
+ kafka:
109
+ image: confluentinc/cp-kafka:7.5.0
110
+ container_name: nexu-kafka
111
+ profiles: ['messaging', 'all']
112
+ depends_on:
113
+ - zookeeper
114
+ environment:
115
+ KAFKA_BROKER_ID: 1
116
+ KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
117
+ KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
118
+ KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
119
+ ports:
120
+ - '9092:9092'
121
+ volumes:
122
+ - kafka_data:/var/lib/kafka/data
123
+ networks:
124
+ - nexu-network
125
+
126
+ # ============================================
127
+ # MONITORING SERVICES
128
+ # ============================================
129
+ prometheus:
130
+ image: prom/prometheus:latest
131
+ container_name: nexu-prometheus
132
+ profiles: ['monitoring', 'all']
133
+ command:
134
+ - '--config.file=/etc/prometheus/prometheus.yml'
135
+ - '--storage.tsdb.path=/prometheus'
136
+ ports:
137
+ - '9090:9090'
138
+ volumes:
139
+ - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
140
+ - prometheus_data:/prometheus
141
+ networks:
142
+ - nexu-network
143
+
144
+ grafana:
145
+ image: grafana/grafana:latest
146
+ container_name: nexu-grafana
147
+ profiles: ['monitoring', 'all']
148
+ environment:
149
+ GF_SECURITY_ADMIN_USER: ${GRAFANA_USER:-admin}
150
+ GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD:-admin}
151
+ ports:
152
+ - '3001:3000'
153
+ volumes:
154
+ - grafana_data:/var/lib/grafana
155
+ - ./grafana/provisioning:/etc/grafana/provisioning
156
+ networks:
157
+ - nexu-network
158
+ depends_on:
159
+ - prometheus
160
+
161
+ # ============================================
162
+ # STORAGE SERVICES
163
+ # ============================================
164
+ minio:
165
+ image: minio/minio:latest
166
+ container_name: nexu-minio
167
+ profiles: ['storage', 'all']
168
+ command: server /data --console-address ":9001"
169
+ environment:
170
+ MINIO_ROOT_USER: ${MINIO_USER:-nexu}
171
+ MINIO_ROOT_PASSWORD: ${MINIO_PASSWORD:-nexu1234}
172
+ ports:
173
+ - '9000:9000'
174
+ - '9001:9001'
175
+ volumes:
176
+ - minio_data:/data
177
+ networks:
178
+ - nexu-network
179
+ healthcheck:
180
+ test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/live']
181
+ interval: 30s
182
+ timeout: 20s
183
+ retries: 3
184
+
185
+ # ============================================
186
+ # SEARCH SERVICES
187
+ # ============================================
188
+ elasticsearch:
189
+ image: elasticsearch:8.11.0
190
+ container_name: nexu-elasticsearch
191
+ profiles: ['search', 'all']
192
+ environment:
193
+ - discovery.type=single-node
194
+ - xpack.security.enabled=false
195
+ - 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
196
+ ports:
197
+ - '9200:9200'
198
+ - '9300:9300'
199
+ volumes:
200
+ - elasticsearch_data:/usr/share/elasticsearch/data
201
+ networks:
202
+ - nexu-network
203
+ healthcheck:
204
+ test: ['CMD-SHELL', 'curl -s http://localhost:9200 | grep -q "cluster_name"']
205
+ interval: 30s
206
+ timeout: 10s
207
+ retries: 5
@@ -0,0 +1,11 @@
1
+ apiVersion: 1
2
+
3
+ providers:
4
+ - name: 'default'
5
+ orgId: 1
6
+ folder: ''
7
+ type: file
8
+ disableDeletion: false
9
+ editable: true
10
+ options:
11
+ path: /etc/grafana/provisioning/dashboards
@@ -0,0 +1,9 @@
1
+ apiVersion: 1
2
+
3
+ datasources:
4
+ - name: Prometheus
5
+ type: prometheus
6
+ access: proxy
7
+ url: http://prometheus:9090
8
+ isDefault: true
9
+ editable: false
@@ -0,0 +1,2 @@
1
+ # Place your SQL initialization scripts here
2
+ # They will be executed in alphabetical order when the container starts
@@ -0,0 +1,13 @@
1
+ global:
2
+ scrape_interval: 15s
3
+ evaluation_interval: 15s
4
+
5
+ scrape_configs:
6
+ - job_name: 'prometheus'
7
+ static_configs:
8
+ - targets: ['localhost:9090']
9
+
10
+ # Add your app targets here
11
+ # - job_name: 'nexu-api'
12
+ # static_configs:
13
+ # - targets: ['host.docker.internal:3000']
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "jsx": "react-jsx",
6
+ "module": "ESNext",
7
+ "moduleResolution": "bundler",
8
+ "resolveJsonModule": true,
9
+ "allowJs": false,
10
+ "declaration": true,
11
+ "declarationMap": true,
12
+ "sourceMap": true,
13
+ "noEmit": true,
14
+ "strict": true,
15
+ "noImplicitAny": true,
16
+ "strictNullChecks": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "noFallthroughCasesInSwitch": true,
20
+ "esModuleInterop": true,
21
+ "allowSyntheticDefaultImports": true,
22
+ "forceConsistentCasingInFileNames": true,
23
+ "skipLibCheck": true,
24
+ "isolatedModules": true
25
+ },
26
+ "exclude": ["node_modules", "dist", ".next", "coverage", "packages/config", "scripts"]
27
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "$schema": "https://turbo.build/schema.json",
3
+ "globalDependencies": ["**/.env.*local"],
4
+ "globalEnv": ["NODE_ENV"],
5
+ "remoteCache": {
6
+ "signature": true
7
+ },
8
+ "tasks": {
9
+ "build": {
10
+ "dependsOn": ["^build"],
11
+ "outputs": ["dist/**", ".next/**", "!.next/cache/**"]
12
+ },
13
+ "dev": {
14
+ "cache": false,
15
+ "persistent": true
16
+ },
17
+ "lint": {
18
+ "dependsOn": ["^build"],
19
+ "outputs": []
20
+ },
21
+ "lint:fix": {
22
+ "outputs": []
23
+ },
24
+ "test": {
25
+ "dependsOn": ["build"],
26
+ "outputs": ["coverage/**"]
27
+ },
28
+ "test:coverage": {
29
+ "dependsOn": ["build"],
30
+ "outputs": ["coverage/**"]
31
+ },
32
+ "typecheck": {
33
+ "dependsOn": ["^build"],
34
+ "outputs": []
35
+ },
36
+ "clean": {
37
+ "cache": false
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,15 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true,
6
+ environment: 'node',
7
+ include: ['**/*.{test,spec}.{ts,tsx}'],
8
+ exclude: ['**/node_modules/**', '**/dist/**'],
9
+ coverage: {
10
+ provider: 'v8',
11
+ reporter: ['text', 'json', 'html'],
12
+ exclude: ['node_modules/', 'dist/', '**/*.config.*', '**/*.d.ts', '**/types/'],
13
+ },
14
+ },
15
+ });