create-blitzpack 0.1.0 → 0.1.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.
Files changed (259) hide show
  1. package/dist/index.js +35 -77
  2. package/package.json +5 -6
  3. package/template/.dockerignore +0 -59
  4. package/template/.github/workflows/ci.yml +0 -157
  5. package/template/.husky/pre-commit +0 -1
  6. package/template/.husky/pre-push +0 -1
  7. package/template/.lintstagedrc.cjs +0 -4
  8. package/template/.nvmrc +0 -1
  9. package/template/.prettierrc +0 -9
  10. package/template/.vscode/settings.json +0 -13
  11. package/template/CLAUDE.md +0 -175
  12. package/template/CONTRIBUTING.md +0 -32
  13. package/template/Dockerfile +0 -90
  14. package/template/GETTING_STARTED.md +0 -35
  15. package/template/LICENSE +0 -21
  16. package/template/README.md +0 -116
  17. package/template/apps/api/.dockerignore +0 -51
  18. package/template/apps/api/.env.local.example +0 -62
  19. package/template/apps/api/emails/account-deleted-email.tsx +0 -69
  20. package/template/apps/api/emails/components/email-layout.tsx +0 -154
  21. package/template/apps/api/emails/config.ts +0 -22
  22. package/template/apps/api/emails/password-changed-email.tsx +0 -88
  23. package/template/apps/api/emails/password-reset-email.tsx +0 -86
  24. package/template/apps/api/emails/verification-email.tsx +0 -85
  25. package/template/apps/api/emails/welcome-email.tsx +0 -70
  26. package/template/apps/api/package.json +0 -84
  27. package/template/apps/api/prisma/migrations/20251012111439_init/migration.sql +0 -13
  28. package/template/apps/api/prisma/migrations/20251018162629_add_better_auth_fields/migration.sql +0 -67
  29. package/template/apps/api/prisma/migrations/20251019142208_add_user_role_enum/migration.sql +0 -5
  30. package/template/apps/api/prisma/migrations/20251019182151_user_auth/migration.sql +0 -7
  31. package/template/apps/api/prisma/migrations/20251019211416_faster_session_lookup/migration.sql +0 -2
  32. package/template/apps/api/prisma/migrations/20251119124337_add_upload_model/migration.sql +0 -26
  33. package/template/apps/api/prisma/migrations/20251120071241_add_scope_to_account/migration.sql +0 -2
  34. package/template/apps/api/prisma/migrations/20251120072608_add_oauth_token_expiration_fields/migration.sql +0 -10
  35. package/template/apps/api/prisma/migrations/20251120144705_add_audit_logs/migration.sql +0 -29
  36. package/template/apps/api/prisma/migrations/20251127123614_remove_impersonated_by/migration.sql +0 -8
  37. package/template/apps/api/prisma/migrations/20251127125630_remove_audit_logs/migration.sql +0 -11
  38. package/template/apps/api/prisma/migrations/migration_lock.toml +0 -3
  39. package/template/apps/api/prisma/schema.prisma +0 -116
  40. package/template/apps/api/prisma/seed.ts +0 -159
  41. package/template/apps/api/prisma.config.ts +0 -14
  42. package/template/apps/api/src/app.ts +0 -377
  43. package/template/apps/api/src/common/logger.service.ts +0 -227
  44. package/template/apps/api/src/config/env.ts +0 -60
  45. package/template/apps/api/src/config/rate-limit.ts +0 -29
  46. package/template/apps/api/src/hooks/auth.ts +0 -122
  47. package/template/apps/api/src/plugins/auth.ts +0 -198
  48. package/template/apps/api/src/plugins/database.ts +0 -45
  49. package/template/apps/api/src/plugins/logger.ts +0 -33
  50. package/template/apps/api/src/plugins/multipart.ts +0 -16
  51. package/template/apps/api/src/plugins/scalar.ts +0 -20
  52. package/template/apps/api/src/plugins/schedule.ts +0 -52
  53. package/template/apps/api/src/plugins/services.ts +0 -66
  54. package/template/apps/api/src/plugins/swagger.ts +0 -56
  55. package/template/apps/api/src/routes/accounts.ts +0 -91
  56. package/template/apps/api/src/routes/admin-sessions.ts +0 -92
  57. package/template/apps/api/src/routes/metrics.ts +0 -71
  58. package/template/apps/api/src/routes/password.ts +0 -46
  59. package/template/apps/api/src/routes/sessions.ts +0 -53
  60. package/template/apps/api/src/routes/stats.ts +0 -38
  61. package/template/apps/api/src/routes/uploads-serve.ts +0 -27
  62. package/template/apps/api/src/routes/uploads.ts +0 -154
  63. package/template/apps/api/src/routes/users.ts +0 -114
  64. package/template/apps/api/src/routes/verification.ts +0 -90
  65. package/template/apps/api/src/server.ts +0 -34
  66. package/template/apps/api/src/services/accounts.service.ts +0 -125
  67. package/template/apps/api/src/services/authorization.service.ts +0 -162
  68. package/template/apps/api/src/services/email.service.ts +0 -170
  69. package/template/apps/api/src/services/file-storage.service.ts +0 -267
  70. package/template/apps/api/src/services/metrics.service.ts +0 -175
  71. package/template/apps/api/src/services/password.service.ts +0 -56
  72. package/template/apps/api/src/services/sessions.service.spec.ts +0 -134
  73. package/template/apps/api/src/services/sessions.service.ts +0 -276
  74. package/template/apps/api/src/services/stats.service.ts +0 -273
  75. package/template/apps/api/src/services/uploads.service.ts +0 -163
  76. package/template/apps/api/src/services/users.service.spec.ts +0 -249
  77. package/template/apps/api/src/services/users.service.ts +0 -198
  78. package/template/apps/api/src/utils/file-validation.ts +0 -108
  79. package/template/apps/api/start.sh +0 -33
  80. package/template/apps/api/test/helpers/fastify-app.ts +0 -24
  81. package/template/apps/api/test/helpers/mock-authorization.ts +0 -16
  82. package/template/apps/api/test/helpers/mock-logger.ts +0 -28
  83. package/template/apps/api/test/helpers/mock-prisma.ts +0 -30
  84. package/template/apps/api/test/helpers/test-db.ts +0 -125
  85. package/template/apps/api/test/integration/auth-flow.integration.spec.ts +0 -449
  86. package/template/apps/api/test/integration/password.integration.spec.ts +0 -427
  87. package/template/apps/api/test/integration/rate-limit.integration.spec.ts +0 -51
  88. package/template/apps/api/test/integration/sessions.integration.spec.ts +0 -445
  89. package/template/apps/api/test/integration/users.integration.spec.ts +0 -211
  90. package/template/apps/api/test/setup.ts +0 -31
  91. package/template/apps/api/tsconfig.json +0 -26
  92. package/template/apps/api/vitest.config.ts +0 -35
  93. package/template/apps/web/.env.local.example +0 -11
  94. package/template/apps/web/components.json +0 -24
  95. package/template/apps/web/next.config.ts +0 -22
  96. package/template/apps/web/package.json +0 -56
  97. package/template/apps/web/postcss.config.js +0 -5
  98. package/template/apps/web/public/apple-icon.png +0 -0
  99. package/template/apps/web/public/icon.png +0 -0
  100. package/template/apps/web/public/robots.txt +0 -3
  101. package/template/apps/web/src/app/(admin)/admin/layout.tsx +0 -222
  102. package/template/apps/web/src/app/(admin)/admin/page.tsx +0 -157
  103. package/template/apps/web/src/app/(admin)/admin/sessions/page.tsx +0 -18
  104. package/template/apps/web/src/app/(admin)/admin/users/page.tsx +0 -20
  105. package/template/apps/web/src/app/(auth)/forgot-password/page.tsx +0 -177
  106. package/template/apps/web/src/app/(auth)/login/page.tsx +0 -159
  107. package/template/apps/web/src/app/(auth)/reset-password/page.tsx +0 -245
  108. package/template/apps/web/src/app/(auth)/signup/page.tsx +0 -153
  109. package/template/apps/web/src/app/dashboard/change-password/page.tsx +0 -255
  110. package/template/apps/web/src/app/dashboard/page.tsx +0 -296
  111. package/template/apps/web/src/app/error.tsx +0 -32
  112. package/template/apps/web/src/app/examples/file-upload/page.tsx +0 -200
  113. package/template/apps/web/src/app/favicon.ico +0 -0
  114. package/template/apps/web/src/app/global-error.tsx +0 -96
  115. package/template/apps/web/src/app/globals.css +0 -22
  116. package/template/apps/web/src/app/icon.png +0 -0
  117. package/template/apps/web/src/app/layout.tsx +0 -34
  118. package/template/apps/web/src/app/not-found.tsx +0 -28
  119. package/template/apps/web/src/app/page.tsx +0 -192
  120. package/template/apps/web/src/components/admin/activity-feed.tsx +0 -101
  121. package/template/apps/web/src/components/admin/charts/auth-breakdown-chart.tsx +0 -114
  122. package/template/apps/web/src/components/admin/charts/chart-tooltip.tsx +0 -124
  123. package/template/apps/web/src/components/admin/charts/realtime-metrics-chart.tsx +0 -511
  124. package/template/apps/web/src/components/admin/charts/role-distribution-chart.tsx +0 -102
  125. package/template/apps/web/src/components/admin/charts/session-activity-chart.tsx +0 -90
  126. package/template/apps/web/src/components/admin/charts/user-growth-chart.tsx +0 -108
  127. package/template/apps/web/src/components/admin/health-indicator.tsx +0 -175
  128. package/template/apps/web/src/components/admin/refresh-control.tsx +0 -90
  129. package/template/apps/web/src/components/admin/session-revoke-all-dialog.tsx +0 -79
  130. package/template/apps/web/src/components/admin/session-revoke-dialog.tsx +0 -74
  131. package/template/apps/web/src/components/admin/sessions-management-table.tsx +0 -372
  132. package/template/apps/web/src/components/admin/stat-card.tsx +0 -137
  133. package/template/apps/web/src/components/admin/user-create-dialog.tsx +0 -152
  134. package/template/apps/web/src/components/admin/user-delete-dialog.tsx +0 -73
  135. package/template/apps/web/src/components/admin/user-edit-dialog.tsx +0 -170
  136. package/template/apps/web/src/components/admin/users-management-table.tsx +0 -285
  137. package/template/apps/web/src/components/auth/email-verification-banner.tsx +0 -85
  138. package/template/apps/web/src/components/auth/github-button.tsx +0 -40
  139. package/template/apps/web/src/components/auth/google-button.tsx +0 -54
  140. package/template/apps/web/src/components/auth/protected-route.tsx +0 -66
  141. package/template/apps/web/src/components/auth/redirect-if-authenticated.tsx +0 -31
  142. package/template/apps/web/src/components/auth/with-auth.tsx +0 -30
  143. package/template/apps/web/src/components/error/error-card.tsx +0 -47
  144. package/template/apps/web/src/components/error/forbidden.tsx +0 -25
  145. package/template/apps/web/src/components/landing/command-block.tsx +0 -64
  146. package/template/apps/web/src/components/landing/feature-card.tsx +0 -60
  147. package/template/apps/web/src/components/landing/included-feature-card.tsx +0 -63
  148. package/template/apps/web/src/components/landing/logo.tsx +0 -41
  149. package/template/apps/web/src/components/landing/tech-badge.tsx +0 -11
  150. package/template/apps/web/src/components/layout/auth-nav.tsx +0 -58
  151. package/template/apps/web/src/components/layout/footer.tsx +0 -3
  152. package/template/apps/web/src/config/landing-data.ts +0 -152
  153. package/template/apps/web/src/config/site.ts +0 -5
  154. package/template/apps/web/src/hooks/api/__tests__/use-users.test.tsx +0 -181
  155. package/template/apps/web/src/hooks/api/use-admin-sessions.ts +0 -75
  156. package/template/apps/web/src/hooks/api/use-admin-stats.ts +0 -33
  157. package/template/apps/web/src/hooks/api/use-sessions.ts +0 -52
  158. package/template/apps/web/src/hooks/api/use-uploads.ts +0 -156
  159. package/template/apps/web/src/hooks/api/use-users.ts +0 -149
  160. package/template/apps/web/src/hooks/use-mobile.ts +0 -21
  161. package/template/apps/web/src/hooks/use-realtime-metrics.ts +0 -120
  162. package/template/apps/web/src/lib/__tests__/utils.test.ts +0 -29
  163. package/template/apps/web/src/lib/api.ts +0 -151
  164. package/template/apps/web/src/lib/auth.ts +0 -13
  165. package/template/apps/web/src/lib/env.ts +0 -52
  166. package/template/apps/web/src/lib/form-utils.ts +0 -11
  167. package/template/apps/web/src/lib/utils.ts +0 -1
  168. package/template/apps/web/src/providers.tsx +0 -34
  169. package/template/apps/web/src/store/atoms.ts +0 -15
  170. package/template/apps/web/src/test/helpers/test-utils.tsx +0 -44
  171. package/template/apps/web/src/test/setup.ts +0 -8
  172. package/template/apps/web/tailwind.config.ts +0 -5
  173. package/template/apps/web/tsconfig.json +0 -26
  174. package/template/apps/web/vitest.config.ts +0 -32
  175. package/template/assets/logo-512.png +0 -0
  176. package/template/assets/logo.svg +0 -4
  177. package/template/docker-compose.prod.yml +0 -66
  178. package/template/docker-compose.yml +0 -36
  179. package/template/eslint.config.ts +0 -119
  180. package/template/package.json +0 -77
  181. package/template/packages/tailwind-config/package.json +0 -9
  182. package/template/packages/tailwind-config/theme.css +0 -179
  183. package/template/packages/types/package.json +0 -29
  184. package/template/packages/types/src/__tests__/schemas.test.ts +0 -255
  185. package/template/packages/types/src/api-response.ts +0 -53
  186. package/template/packages/types/src/health-check.ts +0 -11
  187. package/template/packages/types/src/pagination.ts +0 -41
  188. package/template/packages/types/src/role.ts +0 -5
  189. package/template/packages/types/src/session.ts +0 -48
  190. package/template/packages/types/src/stats.ts +0 -113
  191. package/template/packages/types/src/upload.ts +0 -51
  192. package/template/packages/types/src/user.ts +0 -36
  193. package/template/packages/types/tsconfig.json +0 -5
  194. package/template/packages/types/vitest.config.ts +0 -21
  195. package/template/packages/ui/components.json +0 -21
  196. package/template/packages/ui/package.json +0 -108
  197. package/template/packages/ui/src/__tests__/button.test.tsx +0 -70
  198. package/template/packages/ui/src/alert-dialog.tsx +0 -141
  199. package/template/packages/ui/src/alert.tsx +0 -66
  200. package/template/packages/ui/src/animated-theme-toggler.tsx +0 -167
  201. package/template/packages/ui/src/avatar.tsx +0 -53
  202. package/template/packages/ui/src/badge.tsx +0 -36
  203. package/template/packages/ui/src/button.tsx +0 -84
  204. package/template/packages/ui/src/card.tsx +0 -92
  205. package/template/packages/ui/src/checkbox.tsx +0 -32
  206. package/template/packages/ui/src/data-table/data-table-column-header.tsx +0 -68
  207. package/template/packages/ui/src/data-table/data-table-pagination.tsx +0 -99
  208. package/template/packages/ui/src/data-table/data-table-toolbar.tsx +0 -55
  209. package/template/packages/ui/src/data-table/data-table-view-options.tsx +0 -63
  210. package/template/packages/ui/src/data-table/data-table.tsx +0 -167
  211. package/template/packages/ui/src/dialog.tsx +0 -143
  212. package/template/packages/ui/src/dropdown-menu.tsx +0 -257
  213. package/template/packages/ui/src/empty-state.tsx +0 -52
  214. package/template/packages/ui/src/file-upload-input.tsx +0 -202
  215. package/template/packages/ui/src/form.tsx +0 -168
  216. package/template/packages/ui/src/hooks/use-mobile.ts +0 -19
  217. package/template/packages/ui/src/icons/brand-icons.tsx +0 -16
  218. package/template/packages/ui/src/input.tsx +0 -21
  219. package/template/packages/ui/src/label.tsx +0 -24
  220. package/template/packages/ui/src/lib/utils.ts +0 -6
  221. package/template/packages/ui/src/password-input.tsx +0 -102
  222. package/template/packages/ui/src/popover.tsx +0 -48
  223. package/template/packages/ui/src/radio-group.tsx +0 -45
  224. package/template/packages/ui/src/scroll-area.tsx +0 -58
  225. package/template/packages/ui/src/select.tsx +0 -187
  226. package/template/packages/ui/src/separator.tsx +0 -28
  227. package/template/packages/ui/src/sheet.tsx +0 -139
  228. package/template/packages/ui/src/sidebar.tsx +0 -726
  229. package/template/packages/ui/src/skeleton-variants.tsx +0 -87
  230. package/template/packages/ui/src/skeleton.tsx +0 -13
  231. package/template/packages/ui/src/slider.tsx +0 -63
  232. package/template/packages/ui/src/sonner.tsx +0 -25
  233. package/template/packages/ui/src/spinner.tsx +0 -16
  234. package/template/packages/ui/src/switch.tsx +0 -31
  235. package/template/packages/ui/src/table.tsx +0 -116
  236. package/template/packages/ui/src/tabs.tsx +0 -66
  237. package/template/packages/ui/src/textarea.tsx +0 -18
  238. package/template/packages/ui/src/tooltip.tsx +0 -61
  239. package/template/packages/ui/src/user-avatar.tsx +0 -97
  240. package/template/packages/ui/test-config.js +0 -3
  241. package/template/packages/ui/tsconfig.json +0 -12
  242. package/template/packages/ui/turbo.json +0 -18
  243. package/template/packages/ui/vitest.config.ts +0 -17
  244. package/template/packages/ui/vitest.setup.ts +0 -1
  245. package/template/packages/utils/package.json +0 -23
  246. package/template/packages/utils/src/__tests__/utils.test.ts +0 -223
  247. package/template/packages/utils/src/array.ts +0 -18
  248. package/template/packages/utils/src/async.ts +0 -3
  249. package/template/packages/utils/src/date.ts +0 -77
  250. package/template/packages/utils/src/errors.ts +0 -73
  251. package/template/packages/utils/src/number.ts +0 -11
  252. package/template/packages/utils/src/string.ts +0 -13
  253. package/template/packages/utils/tsconfig.json +0 -5
  254. package/template/packages/utils/vitest.config.ts +0 -21
  255. package/template/pnpm-workspace.yaml +0 -4
  256. package/template/tsconfig.base.json +0 -32
  257. package/template/turbo.json +0 -133
  258. package/template/vitest.shared.ts +0 -26
  259. package/template/vitest.workspace.ts +0 -9
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ import { spawn } from "child_process";
9
9
  import fs3 from "fs-extra";
10
10
  import ora from "ora";
11
11
  import path3 from "path";
12
- import { fileURLToPath } from "url";
13
12
 
14
13
  // src/git.ts
15
14
  import { execSync } from "child_process";
@@ -39,28 +38,6 @@ function initGit(targetDir) {
39
38
  import prompts from "prompts";
40
39
 
41
40
  // src/constants.ts
42
- var TEMPLATE_EXCLUDES = [
43
- "node_modules",
44
- ".next",
45
- ".turbo",
46
- "dist",
47
- "build",
48
- "coverage",
49
- ".git",
50
- "pnpm-lock.yaml",
51
- "*.tsbuildinfo",
52
- "tsconfig.tsbuildinfo",
53
- ".env.local",
54
- ".env.*.local",
55
- ".DS_Store",
56
- ".temp",
57
- ".claude",
58
- ".cursor",
59
- "create-blitzpack",
60
- "apps/api/src/generated",
61
- "apps/api/public/uploads",
62
- "scripts/setup.js"
63
- ];
64
41
  var REPLACEABLE_FILES = [
65
42
  "package.json",
66
43
  "apps/web/src/config/site.ts",
@@ -178,47 +155,28 @@ async function getProjectOptions(providedName, flags = {}) {
178
155
 
179
156
  // src/template.ts
180
157
  import fs from "fs-extra";
158
+ import { downloadTemplate } from "giget";
181
159
  import path from "path";
182
- function shouldExclude(relativePath) {
183
- const normalizedPath = relativePath.replace(/\\/g, "/");
184
- for (const pattern of TEMPLATE_EXCLUDES) {
185
- if (pattern.startsWith("*")) {
186
- const ext = pattern.slice(1);
187
- if (normalizedPath.endsWith(ext)) return true;
188
- } else if (normalizedPath === pattern || normalizedPath.startsWith(pattern + "/")) {
189
- return true;
190
- } else {
191
- const parts = normalizedPath.split("/");
192
- if (parts.includes(pattern)) return true;
193
- }
194
- }
195
- return false;
196
- }
197
- async function copyDir(src, dest, baseDir) {
198
- await fs.ensureDir(dest);
199
- const entries = await fs.readdir(src, { withFileTypes: true });
200
- for (const entry of entries) {
201
- const srcPath = path.join(src, entry.name);
202
- const destPath = path.join(dest, entry.name);
203
- const relativePath = path.relative(baseDir, srcPath);
204
- if (shouldExclude(relativePath)) {
205
- continue;
206
- }
207
- if (entry.isDirectory()) {
208
- await copyDir(srcPath, destPath, baseDir);
209
- } else {
210
- await fs.copy(srcPath, destPath);
160
+ var GITHUB_REPO = "github:CarboxyDev/blitzpack";
161
+ var POST_DOWNLOAD_EXCLUDES = [
162
+ "create-blitzpack",
163
+ "scripts/setup.js",
164
+ ".github"
165
+ ];
166
+ async function cleanupExcludes(targetDir) {
167
+ for (const exclude of POST_DOWNLOAD_EXCLUDES) {
168
+ const fullPath = path.join(targetDir, exclude);
169
+ if (await fs.pathExists(fullPath)) {
170
+ await fs.remove(fullPath);
211
171
  }
212
172
  }
213
173
  }
214
- async function copyTemplate(templateDir, targetDir) {
215
- if (await fs.pathExists(targetDir)) {
216
- const files = await fs.readdir(targetDir);
217
- if (files.length > 0) {
218
- throw new Error(`Directory ${targetDir} is not empty`);
219
- }
220
- }
221
- await copyDir(templateDir, targetDir, templateDir);
174
+ async function downloadAndPrepareTemplate(targetDir) {
175
+ await downloadTemplate(GITHUB_REPO, {
176
+ dir: targetDir,
177
+ force: true
178
+ });
179
+ await cleanupExcludes(targetDir);
222
180
  }
223
181
 
224
182
  // src/transform.ts
@@ -237,10 +195,16 @@ function transformPackageJson(content, vars, filePath) {
237
195
  return JSON.stringify(pkg, null, 2) + "\n";
238
196
  }
239
197
  function transformSiteConfig(content, vars) {
240
- return content.replace(/name: ['"].*['"]/, `name: '${vars.projectName}'`).replace(/description: ['"].*['"]/, `description: '${vars.projectDescription}'`).replace(/github: ['"].*['"]/, `github: ''`);
198
+ return content.replace(/name: ['"].*['"]/, `name: '${vars.projectName}'`).replace(
199
+ /description: ['"].*['"]/,
200
+ `description: '${vars.projectDescription}'`
201
+ ).replace(/github: ['"].*['"]/, `github: ''`);
241
202
  }
242
203
  function transformLayout(content, vars) {
243
- return content.replace(/title: ['"].*['"]/, `title: '${vars.projectName}'`).replace(/description: ['"].*['"]/, `description: '${vars.projectDescription}'`);
204
+ return content.replace(/title: ['"].*['"]/, `title: '${vars.projectName}'`).replace(
205
+ /description: ['"].*['"]/,
206
+ `description: '${vars.projectDescription}'`
207
+ );
244
208
  }
245
209
  function transformSwagger(content, vars) {
246
210
  return content.replace(/title: ['"].*['"]/, `title: '${vars.projectName} API'`).replace(
@@ -319,7 +283,6 @@ async function transformFiles(targetDir, vars) {
319
283
  }
320
284
 
321
285
  // src/commands/create.ts
322
- var __dirname = path3.dirname(fileURLToPath(import.meta.url));
323
286
  var ENV_FILES = [
324
287
  { from: "apps/web/.env.local.example", to: "apps/web/.env.local" },
325
288
  { from: "apps/api/.env.local.example", to: "apps/api/.env.local" }
@@ -358,7 +321,7 @@ function printDryRun(options) {
358
321
  console.log();
359
322
  console.log(chalk2.bold(" Would run:"));
360
323
  console.log();
361
- console.log(` ${chalk2.dim("\u2022")} Copy template files`);
324
+ console.log(` ${chalk2.dim("\u2022")} Download template from GitHub`);
362
325
  console.log(` ${chalk2.dim("\u2022")} Transform package.json files`);
363
326
  console.log(` ${chalk2.dim("\u2022")} Create .env.local files`);
364
327
  if (!options.skipGit) {
@@ -394,18 +357,11 @@ async function create(projectName, flags) {
394
357
  return;
395
358
  }
396
359
  }
397
- const templateDir = path3.resolve(__dirname, "..", "template");
398
- if (!await fs3.pathExists(templateDir)) {
399
- printError(
400
- "Template directory not found. This is a bug in create-blitzpack."
401
- );
402
- return;
403
- }
404
360
  const spinner = ora();
405
361
  try {
406
- spinner.start("Creating project structure...");
407
- await copyTemplate(templateDir, targetDir);
408
- spinner.succeed("Created project structure");
362
+ spinner.start("Downloading template from GitHub...");
363
+ await downloadAndPrepareTemplate(targetDir);
364
+ spinner.succeed("Downloaded template");
409
365
  spinner.start("Configuring project...");
410
366
  await transformFiles(targetDir, {
411
367
  projectName: options.projectName,
@@ -446,7 +402,9 @@ async function create(projectName, flags) {
446
402
 
447
403
  // src/index.ts
448
404
  var program = new Command();
449
- program.name("create-blitzpack").description("Create a new Blitzpack project").version("0.1.0").argument("[project-name]", "Name of the project").option("--skip-git", "Skip git initialization").option("--skip-install", "Skip dependency installation").option("--dry-run", "Show what would be done without making changes").action(async (projectName, options) => {
450
- await create(projectName, options);
451
- });
405
+ program.name("create-blitzpack").description("Create a new Blitzpack project").version("0.1.0").argument("[project-name]", "Name of the project").option("--skip-git", "Skip git initialization").option("--skip-install", "Skip dependency installation").option("--dry-run", "Show what would be done without making changes").action(
406
+ async (projectName, options) => {
407
+ await create(projectName, options);
408
+ }
409
+ );
452
410
  program.parse();
package/package.json CHANGED
@@ -1,26 +1,25 @@
1
1
  {
2
2
  "name": "create-blitzpack",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Create a new Blitzpack project - full-stack TypeScript monorepo with Next.js and Fastify",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "create-blitzpack": "./dist/index.js"
8
8
  },
9
9
  "files": [
10
- "dist",
11
- "template"
10
+ "dist"
12
11
  ],
13
12
  "scripts": {
14
13
  "dev": "tsup --watch",
15
- "build": "pnpm run build:template && tsup",
16
- "build:template": "node scripts/copy-template.js",
14
+ "build": "tsup",
17
15
  "typecheck": "tsc --noEmit",
18
- "clean": "rm -rf dist template"
16
+ "clean": "rm -rf dist"
19
17
  },
20
18
  "dependencies": {
21
19
  "chalk": "^5.4.1",
22
20
  "commander": "^13.1.0",
23
21
  "fs-extra": "^11.3.0",
22
+ "giget": "^2.0.0",
24
23
  "ora": "^8.2.0",
25
24
  "prompts": "^2.4.2",
26
25
  "validate-npm-package-name": "^6.0.0"
@@ -1,59 +0,0 @@
1
- # Dependencies
2
- node_modules
3
- npm-debug.log
4
- pnpm-debug.log
5
- yarn-error.log
6
-
7
- # Build outputs (but keep package dist/ folders for copying built packages)
8
- # We ignore these initially but packages/*/dist will be built during Docker build
9
- .next
10
- .turbo
11
- *.tsbuildinfo
12
- apps/*/dist
13
-
14
- # Testing
15
- coverage
16
- .vitest
17
-
18
- # Environment files (never include in image)
19
- .env
20
- .env.local
21
- .env.*.local
22
- .env.development
23
- .env.production
24
-
25
- # Git
26
- .git
27
- .gitignore
28
- .github
29
-
30
- # IDE
31
- .vscode
32
- .idea
33
- *.swp
34
- *.swo
35
- *~
36
-
37
- # OS
38
- .DS_Store
39
- Thumbs.db
40
-
41
- # Logs
42
- logs
43
- *.log
44
-
45
- # Documentation (not needed in production)
46
- README.md
47
- DEPLOYMENT.md
48
- CLAUDE.md
49
- *.md
50
-
51
- # Docker
52
- Dockerfile
53
- .dockerignore
54
- docker-compose.yml
55
-
56
- # Misc
57
- .husky
58
- scripts
59
- # Keep config/ for package builds
@@ -1,157 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main, development]
6
- pull_request:
7
- branches: [main, development]
8
-
9
- # Cancel in-progress runs when a new commit is pushed
10
- concurrency:
11
- group: ${{ github.workflow }}-${{ github.ref }}
12
- cancel-in-progress: true
13
-
14
- jobs:
15
- # Fast checks that can run in parallel
16
- lint:
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: actions/checkout@v4
20
-
21
- - name: Setup pnpm
22
- uses: pnpm/action-setup@v4
23
-
24
- - name: Setup Node.js
25
- uses: actions/setup-node@v4
26
- with:
27
- node-version: '20'
28
- cache: 'pnpm'
29
-
30
- - name: Install dependencies
31
- run: pnpm install --frozen-lockfile
32
-
33
- - name: Run lint
34
- run: pnpm run lint
35
-
36
- typecheck:
37
- runs-on: ubuntu-latest
38
- steps:
39
- - uses: actions/checkout@v4
40
-
41
- - name: Setup pnpm
42
- uses: pnpm/action-setup@v4
43
-
44
- - name: Setup Node.js
45
- uses: actions/setup-node@v4
46
- with:
47
- node-version: '20'
48
- cache: 'pnpm'
49
-
50
- - name: Install dependencies
51
- run: pnpm install --frozen-lockfile
52
-
53
- - name: Create .env for Prisma
54
- run: echo "DATABASE_URL=postgresql://user:pass@localhost:5432/db" > apps/api/.env
55
-
56
- - name: Generate Prisma Client
57
- run: pnpm --filter @repo/api db:generate
58
-
59
- - name: Run typecheck
60
- run: pnpm run typecheck --filter '!@repo/api' # FIXME: Temporary workaround because of prisma v7 issues
61
-
62
- # Tests and build run after lint/typecheck pass
63
- test:
64
- runs-on: ubuntu-latest
65
- needs: [lint, typecheck]
66
-
67
- # PostgreSQL service for integration tests
68
- services:
69
- postgres:
70
- image: postgres:17-alpine
71
- env:
72
- POSTGRES_USER: postgres
73
- POSTGRES_PASSWORD: postgres
74
- POSTGRES_DB: app_dev_test
75
- POSTGRES_HOST_AUTH_METHOD: trust
76
- options: >-
77
- --health-cmd "pg_isready -U postgres"
78
- --health-interval 10s
79
- --health-timeout 5s
80
- --health-retries 5
81
- ports:
82
- - 5432:5432
83
-
84
- env:
85
- NODE_ENV: test
86
- DATABASE_URL: postgresql://postgres:postgres@localhost:5432/app_dev
87
- API_URL: http://localhost:8080
88
- FRONTEND_URL: http://localhost:3000
89
- PORT: 8080
90
- LOG_LEVEL: minimal
91
- COOKIE_SECRET: test-cookie-secret-for-ci
92
- BETTER_AUTH_SECRET: test-secret-minimum-32-characters-long-for-ci
93
- BETTER_AUTH_URL: http://localhost:8080
94
-
95
- steps:
96
- - uses: actions/checkout@v4
97
-
98
- - name: Setup pnpm
99
- uses: pnpm/action-setup@v4
100
-
101
- - name: Setup Node.js
102
- uses: actions/setup-node@v4
103
- with:
104
- node-version: '20'
105
- cache: 'pnpm'
106
-
107
- - name: Install dependencies
108
- run: pnpm install --frozen-lockfile
109
-
110
- - name: Generate Prisma Client
111
- run: cd apps/api && npx prisma generate
112
-
113
- - name: Run tests
114
- run: pnpm run test
115
-
116
- build:
117
- runs-on: ubuntu-latest
118
- needs: [lint, typecheck]
119
- steps:
120
- - uses: actions/checkout@v4
121
-
122
- - name: Setup pnpm
123
- uses: pnpm/action-setup@v4
124
-
125
- - name: Setup Node.js
126
- uses: actions/setup-node@v4
127
- with:
128
- node-version: '20'
129
- cache: 'pnpm'
130
-
131
- - name: Install dependencies
132
- run: pnpm install --frozen-lockfile
133
-
134
- - name: Generate Prisma Client
135
- run: pnpm --filter @repo/api db:generate
136
-
137
- - name: Setup Turborepo cache
138
- uses: actions/cache@v4
139
- with:
140
- path: .turbo
141
- key: ${{ runner.os }}-turbo-${{ github.sha }}
142
- restore-keys: |
143
- ${{ runner.os }}-turbo-
144
-
145
- - name: Build
146
- run: pnpm run build
147
- env:
148
- NODE_ENV: production
149
- API_URL: 'http://localhost:8080'
150
- FRONTEND_URL: 'http://localhost:3000'
151
- DATABASE_URL: 'postgresql://user:pass@localhost:5432/db'
152
- PORT: '8080'
153
- LOG_LEVEL: 'minimal'
154
- COOKIE_SECRET: 'ci-test-secret-not-for-production'
155
- BETTER_AUTH_SECRET: 'ci-test-secret-not-for-production'
156
- BETTER_AUTH_URL: 'http://localhost:8080'
157
- NEXT_PUBLIC_API_URL: 'http://localhost:8080/api'
@@ -1 +0,0 @@
1
- pnpm lint-staged
@@ -1 +0,0 @@
1
- pnpm typecheck && pnpm test
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- '*.{ts,tsx,js,jsx}': ['eslint --fix', 'prettier --write'],
3
- '*.{json,md,yml,yaml}': ['prettier --write'],
4
- };
package/template/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 20.0.0
@@ -1,9 +0,0 @@
1
- {
2
- "semi": true,
3
- "trailingComma": "es5",
4
- "singleQuote": true,
5
- "printWidth": 80,
6
- "tabWidth": 2,
7
- "useTabs": false,
8
- "plugins": ["prettier-plugin-tailwindcss"]
9
- }
@@ -1,13 +0,0 @@
1
- {
2
- "editor.formatOnSave": true,
3
- "editor.defaultFormatter": "esbenp.prettier-vscode",
4
- "editor.codeActionsOnSave": {
5
- "source.fixAll.eslint": "explicit"
6
- },
7
- "eslint.workingDirectories": [{ "mode": "auto" }],
8
- "typescript.tsdk": "node_modules/typescript/lib",
9
- "typescript.enablePromptUseWorkspaceTsdk": true,
10
- "typescript.preferences.includePackageJsonAutoImports": "on",
11
- "typescript.validate.enable": true,
12
- "prisma.pinToPrisma6": false
13
- }
@@ -1,175 +0,0 @@
1
- # CLAUDE.md
2
-
3
- You are a Senior Full-stack Developer and an Expert in TypeScript, Next.js 16, React 19, Fastify, Prisma v7, PostgreSQL, TailwindCSS v5, and shadcn/ui. You are collaborating with a human developer on a production-ready full-stack application.
4
-
5
- ---
6
-
7
- ## Critical Requirements & Constraints
8
-
9
- ### Forbidden Behaviors
10
-
11
- - NEVER create markdown files unless the user explicitly asks for it. This is very important
12
- - NEVER create `index.ts` barrel files. This is a strict requirement
13
- - AVOID writing comments in code unless absolutely necessary for non-obvious edge cases
14
-
15
- ### Workflow Requirements
16
-
17
- - Make sure you aggressively prefer planning and waiting for user confirmation before writing code for medium to big tasks. This is a strict requirement
18
- - If you are unsure about anything, ask the user for clarification. This is a strict requirement
19
- - Prefer using commands or exec scripts (like `pnpm dlx`) for setup related tasks instead of making all the files manually. In case the command requires interactive input, ask the user to do it themselves and provide them with suitable guidance
20
-
21
- ### Collaboration Principles
22
-
23
- - Always be unbiased towards the code, the user's preference and opinions. If you do not agree with the user, make it clear with them. Treat them like a peer
24
- - Always mention alternative approaches to the user if you think it's necessary
25
- - Do not be afraid of hurting the user's feelings or making them feel bad about their skills. Having well-written and maintainable code is significantly more important than cozying up to the user
26
- - Always give a brief and compact summary of all the changes done
27
-
28
- ---
29
-
30
- ## Common Commands
31
-
32
- ### Development Commands
33
-
34
- ```bash
35
- pnpm dev
36
- pnpm build
37
- pnpm typecheck
38
- pnpm test
39
- pnpm test:unit
40
- pnpm test:integration
41
- pnpm lint
42
- ```
43
-
44
- ### Individual Package Commands
45
-
46
- ```bash
47
- # Web (Next.js on port 3000)
48
- cd apps/web
49
- pnpm dev
50
- pnpm typecheck
51
-
52
- # API (Fastify on port 8080)
53
- cd apps/api
54
- pnpm dev
55
- pnpm start
56
- ```
57
-
58
- ### Database Commands (run from `apps/api`)
59
-
60
- ```bash
61
- pnpm db:generate # Generate Prisma Client
62
- pnpm db:migrate # Create and apply migrations
63
- pnpm db:push # Push schema changes (no migration files)
64
- pnpm db:studio # Open Prisma Studio UI
65
- pnpm db:seed # Seed database
66
- ```
67
-
68
- ---
69
-
70
- ## Coding Standards
71
-
72
- ### Code Style
73
-
74
- - Type Definitions: Prefer `interface` for public-facing types and object shapes, `type` for unions, intersections, and computed types
75
- - Use descriptive variable names with auxiliary verbs (`isLoading`, `hasError`, `canSubmit`)
76
- - Favor default exports for pages and named exports for utilities or functions
77
- - **IMPORTANT**: Always use import aliases for files in apps. For packages, use relative imports.
78
-
79
- ### Error Handling
80
-
81
- - Use our custom error classes from `packages/utils/src/errors.ts`
82
- - Provide user-friendly error messages and avoid leaking implementation details
83
-
84
- ---
85
-
86
- ## Project Architecture
87
-
88
- ### Packages
89
-
90
- - All packages (`@repo/packages-types`, `@repo/packages-utils`) are consumed directly as TypeScript source files
91
- - No build or watch required for these packages
92
-
93
- ### Environment
94
-
95
- - Environment variables are managed per-app with Zod validation
96
- - Web: Only `NEXT_PUBLIC_*` variables are exposed to the browser
97
- - Prisma CLI commands are wrapped with `dotenv-cli` to read from `.env.local`
98
-
99
- ### Database
100
-
101
- - The API uses Prisma 7 as the ORM with PostgreSQL
102
- - Prisma queries are automatically logged based on `LOG_LEVEL`
103
-
104
- ### Type Safety & Validation
105
-
106
- - The codebase emphasizes runtime and compile-time type safety with **Zod v4 as the single validation library** across the entire stack
107
- - No class-validator
108
-
109
- ### Testing
110
-
111
- Unit Tests: `*.spec.ts`
112
- Integration Tests: `*.integration.spec.ts`
113
-
114
- ### Authentication
115
-
116
- - Uses Better Auth
117
- - When creating test users with password auth, set `accountId` to the user's email (not user.id)
118
-
119
- ---
120
-
121
- ## Web Architecture Patterns
122
-
123
- ### State Management
124
-
125
- - TanStack Query (React Query): For API calls and data synchronization
126
- - Jotai: For client-side global state (UI state, user preferences)
127
-
128
- ### API Integration
129
-
130
- - API config centralized in `apps/web/src/lib/api.ts`
131
- - **API Response Unwrapping**: The `api.ts` fetcher unwraps `{ data: T }` to `T` but preserves `{ data: T[], pagination: {...} }` responses intact
132
-
133
- ### Authentication & Protected Routes
134
-
135
- The web app uses Better Auth for authentication with modern patterns:
136
-
137
- - **Auth Client**: Configured in `apps/web/src/lib/auth.ts`
138
- - Provides `useSession()` hook for accessing current user/session
139
- - Handles sign in/out, session persistence via cookies
140
- - **Protected Routes**: `<ProtectedRoute>` wrapper component for page-level protection
141
-
142
- ### UI Component Patterns
143
-
144
- - Use Shadcn UI components as base, extend them before creating custom ones
145
- - Implement thoughtful micro-interactions and hover states wherever needed
146
- - Use Framer Motion for animations, Lucide React for icons
147
- - Prefer using `Skeleton` components for loading states instead of spinners (especially for data fetching components)
148
- - Always create a proper loading state for data fetching components.
149
- - Always use `cn` helper for class name merging
150
- - Never write svg code. Always use existing icons from code or Lucide.
151
-
152
- ---
153
-
154
- ## API Architecture Patterns
155
-
156
- ### Fastify Structure
157
-
158
- - The Fastify API follows a plugin-based architecture
159
- - Validation: Zod schemas directly in route definitions via `fastify-type-provider-zod`
160
- - Dependency Injection: Manual DI via Fastify decorators
161
-
162
- ### Logging
163
-
164
- - The API uses Pino for structured logging with request tracing
165
- - Verbosity controlled by `LOG_LEVEL` env var: `minimal` | `normal` | `detailed` | `verbose`
166
- - **IMPORTANT**: Never use `console.log` in the API. Use the logger service instead
167
-
168
- **Log Methods:**
169
-
170
- - `logger.info(message, context?)` - Standard information
171
- - `logger.error(message, error?, context?)` - Errors with automatic Error serialization
172
- - `logger.warn(message, context?)` - Warnings
173
- - `logger.debug(message, context?)` - Debug information (detailed+ level)
174
- - `logger.trace(message, context?)` - Trace logs (verbose level only)
175
- - `logger.perf(message, metrics)` - Performance metrics
@@ -1,32 +0,0 @@
1
- # Contributing to Blitzpack
2
-
3
- Thank you for your interest in contributing! This is a TypeScript monorepo template designed to help developers ship full-stack applications super fast.
4
-
5
- ---
6
-
7
- ## Setup
8
-
9
- 1. Fork and clone the repository
10
- 2. Run `pnpm install && pnpm init:project`
11
- 3. Start development: `pnpm dev`
12
-
13
- ## Development
14
-
15
- 1. Create a feature branch: `git checkout -b feature/your-feature`
16
- 2. Make changes following the code style in `CLAUDE.md`
17
- 3. Run checks: `pnpm typecheck && pnpm lint && pnpm test && pnpm build`
18
- 4. Commit like a sane person
19
- 5. Push and create a Pull request
20
-
21
- ## Code Style
22
-
23
- - Follow patterns in `CLAUDE.md`
24
- - Always use import aliases (`@/...`)
25
-
26
- ## Pull Requests
27
-
28
- - Rebase on latest main before submitting
29
- - Ensure all CI checks pass
30
- - Update documentation if needed
31
-
32
- For detailed architecture and patterns, see `CLAUDE.md`.