create-projx 1.6.4 → 1.7.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 (79) hide show
  1. package/README.md +92 -19
  2. package/dist/{baseline-PZM4KJJW.js → baseline-FHOZNS4D.js} +2 -2
  3. package/dist/{chunk-6YRBHJ2V.js → chunk-HAT7D4G2.js} +25 -8
  4. package/dist/{chunk-XQ7FE4U3.js → chunk-IMZKHDIL.js} +161 -19
  5. package/dist/index.js +1499 -276
  6. package/dist/{utils-AVKSTHIF.js → utils-BZGSJ7XZ.js} +5 -1
  7. package/package.json +13 -7
  8. package/src/addons/orms/drizzle/express/src/app.ts +81 -0
  9. package/src/addons/orms/drizzle/express/src/modules/_base/auto-routes.ts +278 -0
  10. package/src/addons/orms/drizzle/express/src/modules/_base/index.ts +20 -0
  11. package/src/addons/orms/drizzle/express/src/server.ts +32 -0
  12. package/src/addons/orms/drizzle/express/tests/app.test.ts +24 -0
  13. package/src/addons/orms/drizzle/express/vitest.config.ts +20 -0
  14. package/src/addons/orms/drizzle/fastify/src/app.ts +90 -0
  15. package/src/addons/orms/drizzle/fastify/src/modules/_base/auto-routes.ts +268 -0
  16. package/src/addons/orms/drizzle/fastify/src/modules/_base/index.ts +20 -0
  17. package/src/addons/orms/drizzle/fastify/tests/modules/app.test.ts +20 -0
  18. package/src/addons/orms/drizzle/fastify/vitest.config.ts +31 -0
  19. package/src/addons/orms/drizzle/gen-entity/express-router.ts +21 -0
  20. package/src/addons/orms/drizzle/gen-entity/express-test.ts +61 -0
  21. package/src/addons/orms/drizzle/gen-entity/fastify-router.ts +19 -0
  22. package/src/addons/orms/drizzle/gen-entity/fastify-test.ts +87 -0
  23. package/src/addons/orms/drizzle/manifest.json +52 -0
  24. package/src/addons/orms/drizzle/shared/drizzle.config.ts +12 -0
  25. package/src/addons/orms/drizzle/shared/src/db/client.ts +17 -0
  26. package/src/addons/orms/drizzle/shared/src/db/schema.ts +14 -0
  27. package/src/addons/orms/drizzle/shared/src/modules/_base/query-engine.ts +115 -0
  28. package/src/addons/orms/drizzle/shared/src/modules/_base/registry.ts +15 -0
  29. package/src/addons/orms/sequelize/express/src/app.ts +82 -0
  30. package/src/addons/orms/sequelize/express/src/modules/_base/auto-routes.ts +226 -0
  31. package/src/addons/orms/sequelize/express/src/modules/_base/index.ts +20 -0
  32. package/src/addons/orms/sequelize/express/src/server.ts +32 -0
  33. package/src/addons/orms/sequelize/express/tests/app.test.ts +24 -0
  34. package/src/addons/orms/sequelize/express/vitest.config.ts +20 -0
  35. package/src/addons/orms/sequelize/fastify/src/app.ts +83 -0
  36. package/src/addons/orms/sequelize/fastify/src/modules/_base/auto-routes.ts +216 -0
  37. package/src/addons/orms/sequelize/fastify/src/modules/_base/index.ts +20 -0
  38. package/src/addons/orms/sequelize/fastify/tests/modules/app.test.ts +20 -0
  39. package/src/addons/orms/sequelize/fastify/vitest.config.ts +31 -0
  40. package/src/addons/orms/sequelize/gen-entity/express-router.ts +17 -0
  41. package/src/addons/orms/sequelize/gen-entity/express-test.ts +65 -0
  42. package/src/addons/orms/sequelize/gen-entity/fastify-router.ts +19 -0
  43. package/src/addons/orms/sequelize/gen-entity/fastify-test.ts +89 -0
  44. package/src/addons/orms/sequelize/gen-entity/model.ts +21 -0
  45. package/src/addons/orms/sequelize/manifest.json +53 -0
  46. package/src/addons/orms/sequelize/shared/scripts/db-sync.ts +14 -0
  47. package/src/addons/orms/sequelize/shared/src/db/client.ts +19 -0
  48. package/src/addons/orms/sequelize/shared/src/models/index.ts +9 -0
  49. package/src/addons/orms/sequelize/shared/src/modules/_base/query-engine.ts +101 -0
  50. package/src/addons/orms/sequelize/shared/src/modules/_base/registry.ts +15 -0
  51. package/src/addons/orms/typeorm/express/src/app.ts +82 -0
  52. package/src/addons/orms/typeorm/express/src/modules/_base/auto-routes.ts +249 -0
  53. package/src/addons/orms/typeorm/express/src/modules/_base/index.ts +19 -0
  54. package/src/addons/orms/typeorm/express/src/server.ts +43 -0
  55. package/src/addons/orms/typeorm/express/tests/app.test.ts +24 -0
  56. package/src/addons/orms/typeorm/express/vitest.config.ts +20 -0
  57. package/src/addons/orms/typeorm/fastify/src/app.ts +86 -0
  58. package/src/addons/orms/typeorm/fastify/src/modules/_base/auto-routes.ts +239 -0
  59. package/src/addons/orms/typeorm/fastify/src/modules/_base/index.ts +19 -0
  60. package/src/addons/orms/typeorm/fastify/tests/modules/app.test.ts +20 -0
  61. package/src/addons/orms/typeorm/fastify/vitest.config.ts +31 -0
  62. package/src/addons/orms/typeorm/gen-entity/entity.ts +21 -0
  63. package/src/addons/orms/typeorm/gen-entity/express-router.ts +17 -0
  64. package/src/addons/orms/typeorm/gen-entity/express-test.ts +66 -0
  65. package/src/addons/orms/typeorm/gen-entity/fastify-router.ts +19 -0
  66. package/src/addons/orms/typeorm/gen-entity/fastify-test.ts +89 -0
  67. package/src/addons/orms/typeorm/manifest.json +53 -0
  68. package/src/addons/orms/typeorm/shared/scripts/db-sync.ts +14 -0
  69. package/src/addons/orms/typeorm/shared/src/db/data-source.ts +21 -0
  70. package/src/addons/orms/typeorm/shared/src/entities/index.ts +8 -0
  71. package/src/addons/orms/typeorm/shared/src/modules/_base/query-engine.ts +94 -0
  72. package/src/addons/orms/typeorm/shared/src/modules/_base/registry.ts +15 -0
  73. package/src/addons/orms/typeorm/shared/tsconfig.json +16 -0
  74. package/src/templates/README.md.ejs +21 -4
  75. package/src/templates/ci.yml.ejs +167 -37
  76. package/src/templates/docker-compose.yml.ejs +72 -5
  77. package/src/templates/pre-commit.ejs +28 -4
  78. package/src/templates/setup.sh.ejs +95 -6
  79. package/src/templates/docker-compose.dev.yml.ejs +0 -189
@@ -4,17 +4,20 @@ set -e
4
4
  # ── Secret detection ──────────────────────────────────────────────
5
5
  STAGED_DIFF="$(git diff --cached --diff-filter=ACMR)"
6
6
 
7
- if echo "$STAGED_DIFF" | grep -qE '(AKIA|ASIA)[A-Z0-9]{16}'; then
8
- echo "ERROR: Possible AWS access key detected in staged changes."
7
+ AKIA_HITS="$(echo "$STAGED_DIFF" | grep -E '(AKIA|ASIA)[A-Z0-9]{16}' | grep -vE '(pragma: allowlist secret|gitleaks:allow)' || true)"
8
+ if [ -n "$AKIA_HITS" ]; then
9
+ echo "ERROR: Possible AWS access key detected in staged changes:"
10
+ echo "$AKIA_HITS" | head -5
11
+ echo "Add 'pragma: allowlist secret' on the line to whitelist if intentional."
9
12
  exit 1
10
13
  fi
11
14
 
12
15
  if echo "$STAGED_DIFF" | grep -qE '(password|secret|token)\s*[:=]\s*["\x27][^"'\'']{8,}' 2>/dev/null; then
13
- REAL_SECRETS="$(echo "$STAGED_DIFF" | grep -E '(password|secret|token)\s*[:=]\s*["\x27][^"'\'']{8,}' | grep -vE '(test-secret|dev-secret|example|placeholder|your-|changeme|CHANGE_ME)' || true)"
16
+ REAL_SECRETS="$(echo "$STAGED_DIFF" | grep -E '(password|secret|token)\s*[:=]\s*["\x27][^"'\'']{8,}' | grep -vE '(test-secret|dev-secret|example|placeholder|your-|changeme|CHANGE_ME|pragma: allowlist secret|gitleaks:allow)' || true)"
14
17
  if [ -n "$REAL_SECRETS" ]; then
15
18
  echo "WARNING: Possible secret detected in staged changes:"
16
19
  echo "$REAL_SECRETS" | head -5
17
- echo "If intentional, commit with: git commit --no-verify"
20
+ echo "Add 'pragma: allowlist secret' on the line to whitelist, or commit with --no-verify if intentional."
18
21
  exit 1
19
22
  fi
20
23
  fi
@@ -36,12 +39,33 @@ if [ -n "$<%= inst.upper %>_PY" ]; then
36
39
  echo "$<%= inst.upper %>_PY" | sed 's|^<%= inst.path %>/||' | xargs uv run ruff format
37
40
  echo "$<%= inst.upper %>_PY" | sed 's|^<%= inst.path %>/||' | xargs uv run ruff check --fix
38
41
  uv run mypy
42
+ if grep -rEn 'from src\.[a-z_]+(\.[a-z_]+)?\._[a-z_]+ import' src/; then
43
+ echo "ERROR: src/ files cannot import from another module's _-prefixed file. Import from the package."
44
+ exit 1
45
+ fi
46
+ uv run lint-imports
39
47
  cd ..
40
48
  echo "$<%= inst.upper %>_PY" | xargs git add
41
49
  fi
42
50
  <% } %>
43
51
  <% for (const inst of fastifyInstances) { %>
44
52
 
53
+ <%= inst.upper %>_TS=$(echo "$STAGED_FILES" | grep '^<%= inst.path %>/.*\.ts$' || true)
54
+ <%= inst.upper %>_ALL=$(echo "$STAGED_FILES" | grep '^<%= inst.path %>/' || true)
55
+ if [ -n "$<%= inst.upper %>_ALL" ]; then
56
+ echo "Formatting <%= inst.path %>..."
57
+ cd <%= inst.path %>
58
+ echo "$<%= inst.upper %>_ALL" | sed 's|^<%= inst.path %>/||' | xargs <%= pm.exec %> prettier --write --ignore-unknown
59
+ if [ -n "$<%= inst.upper %>_TS" ]; then
60
+ echo "$<%= inst.upper %>_TS" | sed 's|^<%= inst.path %>/||' | xargs <%= pm.exec %> eslint --fix
61
+ <%= pm.exec %> tsc --noEmit
62
+ fi
63
+ cd ..
64
+ echo "$<%= inst.upper %>_ALL" | xargs git add
65
+ fi
66
+ <% } %>
67
+ <% for (const inst of expressInstances) { %>
68
+
45
69
  <%= inst.upper %>_TS=$(echo "$STAGED_FILES" | grep '^<%= inst.path %>/.*\.ts$' || true)
46
70
  <%= inst.upper %>_ALL=$(echo "$STAGED_FILES" | grep '^<%= inst.path %>/' || true)
47
71
  if [ -n "$<%= inst.upper %>_ALL" ]; then
@@ -5,28 +5,117 @@ git config core.hooksPath .githooks
5
5
  echo "Git hooks configured."
6
6
  <% for (const inst of fastapiInstances) { %>
7
7
 
8
- cd <%= inst.path %> && uv sync --all-extras && cd ..
8
+ (
9
+ cd <%= inst.path %>
10
+ uv sync --all-extras
11
+ )
12
+ if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
13
+ cp <%= inst.path %>/.env.example <%= inst.path %>/.env
14
+ echo "<%= inst.path %>/.env created from .env.example."
15
+ fi
9
16
  echo "<%= inst.display %> dependencies installed."
10
17
  <% } %>
11
18
  <% for (const inst of fastifyInstances) { %>
12
19
 
13
- cd <%= inst.path %> && <%= pm.ci %> && cd ..
20
+ (
21
+ cd <%= inst.path %>
22
+ <%= pm.install %>
23
+ <% if (orm === 'drizzle') { %>
24
+ if [ -f drizzle.config.ts ]; then
25
+ if [ -n "$DATABASE_URL" ]; then
26
+ <%= pm.exec %> drizzle-kit push --force
27
+ else
28
+ echo "<%= inst.display %>: skipping Drizzle schema push (DATABASE_URL not set)."
29
+ fi
30
+ fi
31
+ <% } else if (orm === 'sequelize' || orm === 'typeorm') { %>
32
+ if [ -f scripts/db-sync.ts ]; then
33
+ if [ -n "$DATABASE_URL" ]; then
34
+ <%= pm.exec %> tsx scripts/db-sync.ts
35
+ else
36
+ echo "<%= inst.display %>: skipping schema sync (DATABASE_URL not set)."
37
+ fi
38
+ fi
39
+ <% } else { %>
40
+ if [ -f prisma/schema.prisma ] && [ -z "$(ls -A prisma/migrations 2>/dev/null | grep -v migration_lock.toml)" ]; then
41
+ if [ -n "$DATABASE_URL" ]; then
42
+ <%= pm.exec %> prisma migrate dev --name init --skip-seed
43
+ else
44
+ echo "<%= inst.display %>: skipping initial migration (DATABASE_URL not set)."
45
+ fi
46
+ fi
47
+ <% } %>
48
+ )
49
+ if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
50
+ cp <%= inst.path %>/.env.example <%= inst.path %>/.env
51
+ echo "<%= inst.path %>/.env created from .env.example."
52
+ fi
53
+ echo "<%= inst.display %> dependencies installed."
54
+ <% } %>
55
+ <% for (const inst of expressInstances) { %>
56
+
57
+ (
58
+ cd <%= inst.path %>
59
+ <%= pm.install %>
60
+ <% if (orm === 'drizzle') { %>
61
+ if [ -f drizzle.config.ts ]; then
62
+ if [ -n "$DATABASE_URL" ]; then
63
+ <%= pm.exec %> drizzle-kit push --force
64
+ else
65
+ echo "<%= inst.display %>: skipping Drizzle schema push (DATABASE_URL not set)."
66
+ fi
67
+ fi
68
+ <% } else if (orm === 'sequelize' || orm === 'typeorm') { %>
69
+ if [ -f scripts/db-sync.ts ]; then
70
+ if [ -n "$DATABASE_URL" ]; then
71
+ <%= pm.exec %> tsx scripts/db-sync.ts
72
+ else
73
+ echo "<%= inst.display %>: skipping schema sync (DATABASE_URL not set)."
74
+ fi
75
+ fi
76
+ <% } else { %>
77
+ if [ -f prisma/schema.prisma ] && [ -z "$(ls -A prisma/migrations 2>/dev/null | grep -v migration_lock.toml)" ]; then
78
+ if [ -n "$DATABASE_URL" ]; then
79
+ <%= pm.exec %> prisma migrate dev --name init --skip-seed
80
+ else
81
+ echo "<%= inst.display %>: skipping initial migration (DATABASE_URL not set)."
82
+ fi
83
+ fi
84
+ <% } %>
85
+ )
86
+ if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
87
+ cp <%= inst.path %>/.env.example <%= inst.path %>/.env
88
+ echo "<%= inst.path %>/.env created from .env.example."
89
+ fi
14
90
  echo "<%= inst.display %> dependencies installed."
15
91
  <% } %>
16
92
  <% for (const inst of frontendInstances) { %>
17
93
 
18
- cd <%= inst.path %> && <%= pm.ci %> && cd ..
94
+ (
95
+ cd <%= inst.path %>
96
+ <%= pm.install %>
97
+ )
98
+ if [ ! -f <%= inst.path %>/.env ] && [ -f <%= inst.path %>/.env.example ]; then
99
+ cp <%= inst.path %>/.env.example <%= inst.path %>/.env
100
+ echo "<%= inst.path %>/.env created from .env.example."
101
+ fi
19
102
  echo "<%= inst.display %> dependencies installed."
20
103
  <% } %>
21
104
  <% for (const inst of e2eInstances) { %>
22
105
 
23
- cd <%= inst.path %> && <%= pm.ci %> && cd ..
106
+ (
107
+ cd <%= inst.path %>
108
+ <%= pm.install %>
109
+ )
24
110
  echo "<%= inst.display %> dependencies installed."
25
111
  <% } %>
26
112
  <% for (const inst of mobileInstances) { %>
27
113
 
28
114
  if command -v flutter &>/dev/null; then
29
- cd <%= inst.path %> && flutter pub get && cd ..
115
+ (
116
+ cd <%= inst.path %>
117
+ flutter pub get
118
+ )
30
119
  echo "<%= inst.display %> dependencies installed."
31
120
  else
32
121
  echo "<%= inst.display %> skipped (SDK not installed)."
@@ -34,4 +123,4 @@ fi
34
123
  <% } %>
35
124
 
36
125
  echo ""
37
- echo "Done. Run 'docker compose -f docker-compose.dev.yml up' to start."
126
+ echo "Done. Ensure PostgreSQL is running locally, then run '<%= pm.runDev %>' (or 'uv run main.py') in each service."
@@ -1,189 +0,0 @@
1
- services:
2
- <% if (fastapiInstances.length > 0 || fastifyInstances.length > 0) { %>
3
- db:
4
- image: postgres:16-alpine
5
- environment:
6
- POSTGRES_USER: dev
7
- POSTGRES_PASSWORD: dev
8
- POSTGRES_DB: app
9
- ports:
10
- - '5432:5432'
11
- volumes:
12
- - pgdata:/var/lib/postgresql/data
13
- healthcheck:
14
- test: ['CMD-SHELL', 'pg_isready -U dev -d app']
15
- interval: 5s
16
- timeout: 3s
17
- retries: 5
18
- deploy:
19
- resources:
20
- limits:
21
- memory: 256M
22
- cpus: '0.5'
23
- networks:
24
- - app-network
25
- <% } %>
26
- <% for (const inst of fastapiInstances) { %>
27
- <%= inst.path %>-migrate:
28
- build: ./<%= inst.path %>
29
- command: ['uv', 'run', 'migrate.py']
30
- environment:
31
- - SQLALCHEMY_DATABASE_URI=postgresql+asyncpg://dev:dev@db:5432/app
32
- depends_on:
33
- db:
34
- condition: service_healthy
35
- deploy:
36
- resources:
37
- limits:
38
- memory: 256M
39
- cpus: '0.5'
40
- networks:
41
- - app-network
42
- <%= inst.path %>:
43
- build: ./<%= inst.path %>
44
- command:
45
- [
46
- 'uv', 'run', 'uvicorn', 'src.app:app',
47
- '--host', '0.0.0.0', '--port', '7860',
48
- '--workers', '2', '--timeout-keep-alive', '120', '--reload',
49
- ]
50
- <% if (inst.path === inst.type) { %>
51
- ports:
52
- - '7860:7860'
53
- <% } else { %>
54
- expose:
55
- - '7860'
56
- <% } %>
57
- environment:
58
- - SQLALCHEMY_DATABASE_URI=postgresql+asyncpg://dev:dev@db:5432/app
59
- - CORS_ALLOW_ORIGINS=http://localhost:3000,http://localhost
60
- - JWT_PROVIDER=shared_secret
61
- - JWT_SECRET=dev-secret-that-is-at-least-32-bytes-long
62
- - JWT_ALGORITHMS=HS256
63
- volumes:
64
- - ./<%= inst.path %>/src:/app/src
65
- - ./<%= inst.path %>/alembic.ini:/app/alembic.ini
66
- - ./<%= inst.path %>/migrate.py:/app/migrate.py
67
- depends_on:
68
- <%= inst.path %>-migrate:
69
- condition: service_completed_successfully
70
- restart: unless-stopped
71
- healthcheck:
72
- test:
73
- [
74
- 'CMD', 'python', '-c',
75
- "import urllib.request; urllib.request.urlopen('http://localhost:7860/api/health')",
76
- ]
77
- interval: 15s
78
- timeout: 5s
79
- retries: 3
80
- start_period: 10s
81
- deploy:
82
- resources:
83
- limits:
84
- memory: 512M
85
- cpus: '1.0'
86
- networks:
87
- - app-network
88
- <% } %>
89
- <% for (const inst of fastifyInstances) { %>
90
- <%= inst.path %>-migrate:
91
- build: ./<%= inst.path %>
92
- command: ["sh", "-c", "<%= pm.prismaExec %> migrate deploy"]
93
- environment:
94
- - DATABASE_URL=postgresql://dev:dev@db:5432/app
95
- depends_on:
96
- db:
97
- condition: service_healthy
98
- deploy:
99
- resources:
100
- limits:
101
- memory: 256M
102
- cpus: '0.5'
103
- networks:
104
- - app-network
105
- <%= inst.path %>:
106
- build: ./<%= inst.path %>
107
- command: ["sh", "-c", "<%= pm.runDev %>"]
108
- <% if (inst.path === inst.type) { %>
109
- ports:
110
- - '3000:3000'
111
- <% } else { %>
112
- expose:
113
- - '3000'
114
- <% } %>
115
- environment:
116
- - DATABASE_URL=postgresql://dev:dev@db:5432/app
117
- - CORS_ALLOW_ORIGINS=http://localhost:5173,http://localhost
118
- - JWT_PROVIDER=shared_secret
119
- - JWT_SECRET=dev-secret-that-is-at-least-32-bytes-long
120
- volumes:
121
- - ./<%= inst.path %>/src:/app/src
122
- depends_on:
123
- <%= inst.path %>-migrate:
124
- condition: service_completed_successfully
125
- restart: unless-stopped
126
- healthcheck:
127
- test: ['CMD', 'wget', '--spider', '-q', 'http://localhost:3000/api/health']
128
- interval: 15s
129
- timeout: 5s
130
- retries: 3
131
- start_period: 10s
132
- deploy:
133
- resources:
134
- limits:
135
- memory: 512M
136
- cpus: '1.0'
137
- networks:
138
- - app-network
139
- <% } %>
140
- <% for (const inst of frontendInstances) { %>
141
- <%= inst.path %>:
142
- image: node:20-alpine
143
- working_dir: /app
144
- command: sh -c "<%= pm.install %> && <%= pm.run %> dev -- --host 0.0.0.0"
145
- <% if (inst.path === inst.type) { %>
146
- ports:
147
- - '5173:5173'
148
- <% } else { %>
149
- expose:
150
- - '5173'
151
- <% } %>
152
- env_file:
153
- - ./<%= inst.path %>/.env
154
- volumes:
155
- - ./<%= inst.path %>:/app
156
- - <%= inst.upper.toLowerCase() %>_node_modules:/app/node_modules
157
- <% if (fastifyInstances.length > 0) { %>
158
- depends_on:
159
- <%= fastifyInstances[0].path %>:
160
- condition: service_healthy
161
- <% } else if (fastapiInstances.length > 0) { %>
162
- depends_on:
163
- <%= fastapiInstances[0].path %>:
164
- condition: service_healthy
165
- <% } %>
166
- healthcheck:
167
- test: ['CMD', 'wget', '--spider', '-q', 'http://localhost:5173/']
168
- interval: 15s
169
- timeout: 5s
170
- retries: 3
171
- start_period: 30s
172
- deploy:
173
- resources:
174
- limits:
175
- memory: 512M
176
- cpus: '1.0'
177
- networks:
178
- - app-network
179
- <% } %>
180
- volumes:
181
- <% if (fastapiInstances.length > 0 || fastifyInstances.length > 0) { %>
182
- pgdata:
183
- <% } %>
184
- <% for (const inst of frontendInstances) { %>
185
- <%= inst.upper.toLowerCase() %>_node_modules:
186
- <% } %>
187
- networks:
188
- app-network:
189
- driver: bridge