deploy-bbc 1.2.1 → 1.2.3

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 (243) hide show
  1. package/README.md +142 -281
  2. package/dist/index.js +16870 -0
  3. package/dist/templates/base/.env.example +3 -0
  4. package/dist/templates/base/package.json +20 -0
  5. package/dist/templates/base/src/config/index.ts +8 -0
  6. package/dist/templates/base/src/routes/index.ts +12 -0
  7. package/dist/templates/base/src/types/index.ts +2 -0
  8. package/dist/templates/base-bun-native/.env.example +3 -0
  9. package/dist/templates/base-bun-native/package.json +19 -0
  10. package/dist/templates/base-bun-native/src/config/index.ts +8 -0
  11. package/dist/templates/base-bun-native/src/index.ts +50 -0
  12. package/dist/templates/base-bun-native/src/routes/index.ts +21 -0
  13. package/dist/templates/base-bun-native/src/types/index.ts +2 -0
  14. package/dist/templates/base-express/.env.example +3 -0
  15. package/dist/templates/base-express/package.json +21 -0
  16. package/dist/templates/base-express/src/config/index.ts +8 -0
  17. package/dist/templates/base-express/src/routes/index.ts +12 -0
  18. package/dist/templates/base-express/src/types/index.ts +2 -0
  19. package/dist/templates/templates/base/README.md +31 -0
  20. package/dist/templates/templates/base/src/index.ts +26 -0
  21. package/dist/templates/templates/base/src/middleware/error.ts +13 -0
  22. package/dist/templates/templates/base/src/middleware/logger.ts +8 -0
  23. package/dist/templates/templates/base/src/utils/env.ts +5 -0
  24. package/dist/templates/templates/base/tsconfig.json +20 -0
  25. package/dist/templates/templates/base-bun-native/README.md +31 -0
  26. package/dist/templates/templates/base-bun-native/src/middleware/error.ts +20 -0
  27. package/dist/templates/templates/base-bun-native/src/middleware/logger.ts +6 -0
  28. package/dist/templates/templates/base-bun-native/src/utils/env.ts +5 -0
  29. package/dist/templates/templates/base-bun-native/tsconfig.json +20 -0
  30. package/dist/templates/templates/base-express/README.md +31 -0
  31. package/dist/templates/templates/base-express/src/index.ts +27 -0
  32. package/dist/templates/templates/base-express/src/middleware/error.ts +15 -0
  33. package/dist/templates/templates/base-express/src/middleware/logger.ts +12 -0
  34. package/dist/templates/templates/base-express/src/utils/env.ts +5 -0
  35. package/dist/templates/templates/base-express/tsconfig.json +20 -0
  36. package/dist/templates/templates/extras/ai/anthropic/src/services/ai/anthropic.ts +0 -0
  37. package/dist/templates/templates/extras/ai/gemini/src/services/ai/gemini.ts +0 -0
  38. package/dist/templates/templates/extras/ai/openai/src/routes/ai/chat.ts +0 -0
  39. package/dist/templates/templates/extras/ai/openai/src/services/ai/openai.ts +0 -0
  40. package/dist/templates/templates/extras/ai/vercel-ai/src/routes/ai/generate.ts +0 -0
  41. package/dist/templates/templates/extras/ai/vercel-ai/src/routes/ai/stream.ts +0 -0
  42. package/dist/templates/templates/extras/ai/vercel-ai/src/services/ai/index.ts +0 -0
  43. package/dist/templates/templates/extras/auth/jwt/src/middleware/auth.ts +0 -0
  44. package/dist/templates/templates/extras/auth/jwt/src/routes/auth.ts +0 -0
  45. package/dist/templates/templates/extras/auth/jwt/src/utils/jwt.ts +0 -0
  46. package/dist/templates/templates/extras/auth/oauth/src/config/oauth.ts +0 -0
  47. package/dist/templates/templates/extras/auth/oauth/src/routes/auth.ts +0 -0
  48. package/dist/templates/templates/extras/auth/session/src/config/session.ts +0 -0
  49. package/dist/templates/templates/extras/auth/session/src/middleware/session.ts +0 -0
  50. package/dist/templates/templates/extras/cloud/aws/src/services/aws/s3.ts +0 -0
  51. package/dist/templates/templates/extras/cloud/aws/src/services/aws/ses.ts +0 -0
  52. package/dist/templates/templates/extras/cloud/azure/src/services/azure/blob.ts +0 -0
  53. package/dist/templates/templates/extras/cloud/cloudflare-r2/src/services/cloudflare/r2.ts +0 -0
  54. package/dist/templates/templates/extras/cloud/gcp/src/services/gcp/storage.ts +0 -0
  55. package/dist/templates/templates/extras/database/mongodb/src/db/index.ts +0 -0
  56. package/dist/templates/templates/extras/database/mongodb/src/db/models/user.model.ts +0 -0
  57. package/dist/templates/templates/extras/database/mysql/drizzle.config.ts +0 -0
  58. package/dist/templates/templates/extras/database/postgres/src/db/index.ts +0 -0
  59. package/dist/templates/templates/extras/database/redis/src/db/redis.ts +0 -0
  60. package/dist/templates/templates/extras/docs/scalar/src/openapi/index.ts +0 -0
  61. package/dist/templates/templates/extras/docs/scalar/src/routes/docs.ts +0 -0
  62. package/dist/templates/templates/extras/docs/swagger/src/openapi/index.ts +0 -0
  63. package/dist/templates/templates/extras/docs/swagger/src/routes/docs.ts +0 -0
  64. package/dist/templates/templates/extras/email/nodemailer/src/services/email/nodemailer.ts +0 -0
  65. package/dist/templates/templates/extras/email/resend/src/services/email/resend.ts +0 -0
  66. package/dist/templates/templates/extras/email/resend/src/templates/email/welcome.ts +0 -0
  67. package/dist/templates/templates/extras/email/sendgrid/src/services/email/sendgrid.ts +0 -0
  68. package/dist/templates/templates/extras/observability/logtail/src/config/logger.ts +0 -0
  69. package/dist/templates/templates/extras/observability/sentry/src/config/sentry.ts +0 -0
  70. package/dist/templates/templates/extras/observability/sentry/src/middleware/sentry.ts +0 -0
  71. package/dist/templates/templates/extras/queue/bullmq/src/queue/index.ts +0 -0
  72. package/dist/templates/templates/extras/queue/bullmq/src/queue/jobs/email.job.ts +0 -0
  73. package/dist/templates/templates/extras/queue/bullmq/src/queue/processors/email.processor.ts +0 -0
  74. package/dist/templates/templates/extras/queue/bullmq/src/routes/queue.ts +0 -0
  75. package/dist/templates/templates/extras/queue/inngest/src/inngest/client.ts +0 -0
  76. package/dist/templates/templates/extras/queue/inngest/src/inngest/functions/email.ts +0 -0
  77. package/dist/templates/templates/extras/queue/inngest/src/routes/inngest.ts +0 -0
  78. package/dist/templates/templates/extras/realtime/socketio/src/socket/handlers.ts +0 -0
  79. package/dist/templates/templates/extras/realtime/socketio/src/socket/index.ts +0 -0
  80. package/dist/templates/templates/extras/realtime/sse/src/routes/sse.ts +0 -0
  81. package/dist/templates/templates/extras/testing/vitest/src/__tests__/example.test.ts +0 -0
  82. package/dist/templates/templates/extras/testing/vitest/src/__tests__/setup.ts +0 -0
  83. package/dist/templates/templates/extras/testing/vitest/vitest.config.ts +0 -0
  84. package/dist/templates/templates/extras/validation/yup/src/middleware/index.ts +1 -0
  85. package/dist/templates/templates/extras/validation/yup/src/middleware/validate.ts +83 -0
  86. package/dist/templates/templates/extras/validation/yup/src/routes/users.ts +132 -0
  87. package/dist/templates/templates/extras/validation/zod/src/middleware/index.ts +1 -0
  88. package/dist/templates/templates/extras/validation/zod/src/middleware/validate.ts +80 -0
  89. package/dist/templates/templates/extras/validation/zod/src/routes/users.ts +128 -0
  90. package/package.json +43 -9
  91. package/.cspell.json +0 -38
  92. package/CLAUDE.md +0 -403
  93. package/cli/README.md +0 -345
  94. package/cli/package.json +0 -54
  95. package/cli/src/cli/index.ts +0 -454
  96. package/cli/src/helpers/create-project.ts +0 -66
  97. package/cli/src/helpers/generate-docker-compose.ts +0 -133
  98. package/cli/src/helpers/generate-dockerfile.ts +0 -45
  99. package/cli/src/helpers/init-git.ts +0 -33
  100. package/cli/src/helpers/install-dependencies.ts +0 -28
  101. package/cli/src/helpers/log-next-steps.ts +0 -87
  102. package/cli/src/helpers/scaffold-project.ts +0 -88
  103. package/cli/src/index.ts +0 -18
  104. package/cli/src/installers/ai.ts +0 -123
  105. package/cli/src/installers/auth.ts +0 -132
  106. package/cli/src/installers/base.ts +0 -16
  107. package/cli/src/installers/cloud.ts +0 -127
  108. package/cli/src/installers/database.ts +0 -212
  109. package/cli/src/installers/docs.ts +0 -93
  110. package/cli/src/installers/email.ts +0 -119
  111. package/cli/src/installers/env-variables.ts +0 -27
  112. package/cli/src/installers/index.ts +0 -145
  113. package/cli/src/installers/observability.ts +0 -103
  114. package/cli/src/installers/queue.ts +0 -103
  115. package/cli/src/installers/ratelimit.ts +0 -98
  116. package/cli/src/installers/realtime.ts +0 -79
  117. package/cli/src/installers/testing.ts +0 -88
  118. package/cli/src/installers/validation.ts +0 -85
  119. package/cli/src/types/index.ts +0 -126
  120. package/cli/src/utils/add-package-dependency.ts +0 -56
  121. package/cli/src/utils/dependency-version-map.ts +0 -85
  122. package/cli/src/utils/logger.ts +0 -19
  123. package/cli/src/utils/parse-name-and-path.ts +0 -71
  124. package/cli/src/utils/render-title.ts +0 -11
  125. package/cli/tsconfig.json +0 -35
  126. package/test-cli.sh +0 -56
  127. package/tsconfig.json +0 -15
  128. /package/{cli/src → dist}/templates/base/README.md +0 -0
  129. /package/{cli/src → dist}/templates/base/src/index.ts +0 -0
  130. /package/{cli/src → dist}/templates/base/src/middleware/error.ts +0 -0
  131. /package/{cli/src → dist}/templates/base/src/middleware/logger.ts +0 -0
  132. /package/{cli/src → dist}/templates/base/src/utils/env.ts +0 -0
  133. /package/{cli/src → dist}/templates/base/tsconfig.json +0 -0
  134. /package/{cli/src → dist}/templates/base-bun-native/README.md +0 -0
  135. /package/{cli/src → dist}/templates/base-bun-native/src/middleware/error.ts +0 -0
  136. /package/{cli/src → dist}/templates/base-bun-native/src/middleware/logger.ts +0 -0
  137. /package/{cli/src → dist}/templates/base-bun-native/src/utils/env.ts +0 -0
  138. /package/{cli/src → dist}/templates/base-bun-native/tsconfig.json +0 -0
  139. /package/{cli/src → dist}/templates/base-express/README.md +0 -0
  140. /package/{cli/src → dist}/templates/base-express/src/index.ts +0 -0
  141. /package/{cli/src → dist}/templates/base-express/src/middleware/error.ts +0 -0
  142. /package/{cli/src → dist}/templates/base-express/src/middleware/logger.ts +0 -0
  143. /package/{cli/src → dist}/templates/base-express/src/utils/env.ts +0 -0
  144. /package/{cli/src → dist}/templates/base-express/tsconfig.json +0 -0
  145. /package/{cli/src → dist}/templates/extras/ai/anthropic/src/routes/ai/claude.ts +0 -0
  146. /package/{cli/src → dist}/templates/extras/ai/anthropic/src/services/ai/anthropic.ts +0 -0
  147. /package/{cli/src → dist}/templates/extras/ai/gemini/src/services/ai/gemini.ts +0 -0
  148. /package/{cli/src → dist}/templates/extras/ai/openai/src/routes/ai/chat.ts +0 -0
  149. /package/{cli/src → dist}/templates/extras/ai/openai/src/services/ai/openai.ts +0 -0
  150. /package/{cli/src → dist}/templates/extras/ai/vercel-ai/src/routes/ai/generate.ts +0 -0
  151. /package/{cli/src → dist}/templates/extras/ai/vercel-ai/src/routes/ai/stream.ts +0 -0
  152. /package/{cli/src → dist}/templates/extras/ai/vercel-ai/src/services/ai/index.ts +0 -0
  153. /package/{cli/src → dist}/templates/extras/auth/jwt/src/middleware/auth.ts +0 -0
  154. /package/{cli/src → dist}/templates/extras/auth/jwt/src/routes/auth.ts +0 -0
  155. /package/{cli/src → dist}/templates/extras/auth/jwt/src/utils/jwt.ts +0 -0
  156. /package/{cli/src → dist}/templates/extras/auth/oauth/src/config/oauth.ts +0 -0
  157. /package/{cli/src → dist}/templates/extras/auth/oauth/src/routes/auth.ts +0 -0
  158. /package/{cli/src → dist}/templates/extras/auth/session/src/config/session.ts +0 -0
  159. /package/{cli/src → dist}/templates/extras/auth/session/src/middleware/session.ts +0 -0
  160. /package/{cli/src → dist}/templates/extras/cloud/aws/src/services/aws/s3.ts +0 -0
  161. /package/{cli/src → dist}/templates/extras/cloud/aws/src/services/aws/ses.ts +0 -0
  162. /package/{cli/src → dist}/templates/extras/cloud/azure/src/services/azure/blob.ts +0 -0
  163. /package/{cli/src → dist}/templates/extras/cloud/cloudflare-r2/src/services/cloudflare/r2.ts +0 -0
  164. /package/{cli/src → dist}/templates/extras/cloud/gcp/src/services/gcp/storage.ts +0 -0
  165. /package/{cli/src → dist}/templates/extras/database/mongodb/src/db/index.ts +0 -0
  166. /package/{cli/src → dist}/templates/extras/database/mongodb/src/db/models/user.model.ts +0 -0
  167. /package/{cli/src → dist}/templates/extras/database/mysql/drizzle.config.ts +0 -0
  168. /package/{cli/src → dist}/templates/extras/database/postgres/src/db/index.ts +0 -0
  169. /package/{cli/src → dist}/templates/extras/database/redis/src/db/redis.ts +0 -0
  170. /package/{cli/src → dist}/templates/extras/docs/scalar/src/openapi/index.ts +0 -0
  171. /package/{cli/src → dist}/templates/extras/docs/scalar/src/routes/docs.ts +0 -0
  172. /package/{cli/src → dist}/templates/extras/docs/swagger/src/openapi/index.ts +0 -0
  173. /package/{cli/src → dist}/templates/extras/docs/swagger/src/routes/docs.ts +0 -0
  174. /package/{cli/src → dist}/templates/extras/email/nodemailer/src/services/email/nodemailer.ts +0 -0
  175. /package/{cli/src → dist}/templates/extras/email/resend/src/services/email/resend.ts +0 -0
  176. /package/{cli/src → dist}/templates/extras/email/resend/src/templates/email/welcome.ts +0 -0
  177. /package/{cli/src → dist}/templates/extras/email/sendgrid/src/services/email/sendgrid.ts +0 -0
  178. /package/{cli/src → dist}/templates/extras/observability/logtail/src/config/logger.ts +0 -0
  179. /package/{cli/src → dist}/templates/extras/observability/sentry/src/config/sentry.ts +0 -0
  180. /package/{cli/src → dist}/templates/extras/observability/sentry/src/middleware/sentry.ts +0 -0
  181. /package/{cli/src → dist}/templates/extras/queue/bullmq/src/queue/index.ts +0 -0
  182. /package/{cli/src → dist}/templates/extras/queue/bullmq/src/queue/jobs/email.job.ts +0 -0
  183. /package/{cli/src → dist}/templates/extras/queue/bullmq/src/queue/processors/email.processor.ts +0 -0
  184. /package/{cli/src → dist}/templates/extras/queue/bullmq/src/routes/queue.ts +0 -0
  185. /package/{cli/src → dist}/templates/extras/queue/inngest/src/inngest/client.ts +0 -0
  186. /package/{cli/src → dist}/templates/extras/queue/inngest/src/inngest/functions/email.ts +0 -0
  187. /package/{cli/src → dist}/templates/extras/queue/inngest/src/routes/inngest.ts +0 -0
  188. /package/{cli/src → dist}/templates/extras/realtime/socketio/src/socket/handlers.ts +0 -0
  189. /package/{cli/src → dist}/templates/extras/realtime/socketio/src/socket/index.ts +0 -0
  190. /package/{cli/src → dist}/templates/extras/realtime/sse/src/routes/sse.ts +0 -0
  191. /package/{cli/src → dist}/templates/extras/testing/vitest/src/__tests__/example.test.ts +0 -0
  192. /package/{cli/src → dist}/templates/extras/testing/vitest/src/__tests__/setup.ts +0 -0
  193. /package/{cli/src → dist}/templates/extras/testing/vitest/vitest.config.ts +0 -0
  194. /package/{cli/src → dist}/templates/extras/validation/yup/src/middleware/index.ts +0 -0
  195. /package/{cli/src → dist}/templates/extras/validation/yup/src/middleware/validate.ts +0 -0
  196. /package/{cli/src → dist}/templates/extras/validation/yup/src/routes/users.ts +0 -0
  197. /package/{cli/src → dist}/templates/extras/validation/zod/src/middleware/index.ts +0 -0
  198. /package/{cli/src → dist}/templates/extras/validation/zod/src/middleware/validate.ts +0 -0
  199. /package/{cli/src → dist}/templates/extras/validation/zod/src/routes/users.ts +0 -0
  200. /package/{cli/src → dist/templates}/templates/base/.env.example +0 -0
  201. /package/{cli/src → dist/templates}/templates/base/package.json +0 -0
  202. /package/{cli/src → dist/templates}/templates/base/src/config/index.ts +0 -0
  203. /package/{cli/src → dist/templates}/templates/base/src/controllers/user/create-user.controller.ts +0 -0
  204. /package/{cli/src → dist/templates}/templates/base/src/controllers/user/delete-user.controller.ts +0 -0
  205. /package/{cli/src → dist/templates}/templates/base/src/controllers/user/get-user.controller.ts +0 -0
  206. /package/{cli/src → dist/templates}/templates/base/src/controllers/user/get-users.controller.ts +0 -0
  207. /package/{cli/src → dist/templates}/templates/base/src/controllers/user/update-user.controller.ts +0 -0
  208. /package/{cli/src → dist/templates}/templates/base/src/models/user.model.ts +0 -0
  209. /package/{cli/src → dist/templates}/templates/base/src/routes/index.ts +0 -0
  210. /package/{cli/src → dist/templates}/templates/base/src/routes/user.route.ts +0 -0
  211. /package/{cli/src → dist/templates}/templates/base/src/types/common/api-response.types.ts +0 -0
  212. /package/{cli/src → dist/templates}/templates/base/src/types/index.ts +0 -0
  213. /package/{cli/src → dist/templates}/templates/base/src/types/models/user.types.ts +0 -0
  214. /package/{cli/src → dist/templates}/templates/base-bun-native/.env.example +0 -0
  215. /package/{cli/src → dist/templates}/templates/base-bun-native/package.json +0 -0
  216. /package/{cli/src → dist/templates}/templates/base-bun-native/src/config/index.ts +0 -0
  217. /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/create-user.controller.ts +0 -0
  218. /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/delete-user.controller.ts +0 -0
  219. /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/get-user.controller.ts +0 -0
  220. /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/get-users.controller.ts +0 -0
  221. /package/{cli/src → dist/templates}/templates/base-bun-native/src/controllers/user/update-user.controller.ts +0 -0
  222. /package/{cli/src → dist/templates}/templates/base-bun-native/src/index.ts +0 -0
  223. /package/{cli/src → dist/templates}/templates/base-bun-native/src/models/user.model.ts +0 -0
  224. /package/{cli/src → dist/templates}/templates/base-bun-native/src/routes/index.ts +0 -0
  225. /package/{cli/src → dist/templates}/templates/base-bun-native/src/routes/user.route.ts +0 -0
  226. /package/{cli/src → dist/templates}/templates/base-bun-native/src/types/common/api-response.types.ts +0 -0
  227. /package/{cli/src → dist/templates}/templates/base-bun-native/src/types/index.ts +0 -0
  228. /package/{cli/src → dist/templates}/templates/base-bun-native/src/types/models/user.types.ts +0 -0
  229. /package/{cli/src → dist/templates}/templates/base-express/.env.example +0 -0
  230. /package/{cli/src → dist/templates}/templates/base-express/package.json +0 -0
  231. /package/{cli/src → dist/templates}/templates/base-express/src/config/index.ts +0 -0
  232. /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/create-user.controller.ts +0 -0
  233. /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/delete-user.controller.ts +0 -0
  234. /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/get-user.controller.ts +0 -0
  235. /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/get-users.controller.ts +0 -0
  236. /package/{cli/src → dist/templates}/templates/base-express/src/controllers/user/update-user.controller.ts +0 -0
  237. /package/{cli/src → dist/templates}/templates/base-express/src/models/user.model.ts +0 -0
  238. /package/{cli/src → dist/templates}/templates/base-express/src/routes/index.ts +0 -0
  239. /package/{cli/src → dist/templates}/templates/base-express/src/routes/user.route.ts +0 -0
  240. /package/{cli/src → dist/templates}/templates/base-express/src/types/common/api-response.types.ts +0 -0
  241. /package/{cli/src → dist/templates}/templates/base-express/src/types/index.ts +0 -0
  242. /package/{cli/src → dist/templates}/templates/base-express/src/types/models/user.types.ts +0 -0
  243. /package/{prettier.config.mjs → dist/templates/templates/extras/ai/anthropic/src/routes/ai/claude.ts} +0 -0
@@ -1,454 +0,0 @@
1
- import * as p from "@clack/prompts";
2
- import chalk from "chalk";
3
- import { Command } from "commander";
4
- import { type CliFlags, type CliResults, AvailablePackages } from "../types/index.js";
5
-
6
- const defaultOptions: CliFlags = {
7
- noGit: false,
8
- noInstall: false,
9
- default: false,
10
- CI: false,
11
- };
12
-
13
- export const run_cli = async (): Promise<CliResults> => {
14
- const program = new Command()
15
- .name("deploy-bbc")
16
- .description("Bootstrap a production-ready backend with Bun")
17
- .argument("[dir]", "The name of the application")
18
- .option("--noGit", "Skip git initialization", defaultOptions.noGit)
19
- .option("--noInstall", "Skip dependency installation", defaultOptions.noInstall)
20
- .option("--default", "Use default options", defaultOptions.default)
21
- // CI Mode
22
- .option("--CI", "Run in CI mode (non-interactive)", defaultOptions.CI)
23
- // Framework options
24
- .option("--hono", "Use Hono framework (default)")
25
- .option("--express", "Use Express framework")
26
- .option("--bun-native", "Use Bun native HTTP server")
27
- // Database options
28
- .option("--postgres", "Include PostgreSQL")
29
- .option("--mysql", "Include MySQL")
30
- .option("--mongodb", "Include MongoDB")
31
- .option("--redis", "Include Redis")
32
- // Auth options
33
- .option("--jwt", "Include JWT authentication")
34
- .option("--oauth", "Include OAuth 2.0")
35
- .option("--session", "Include session-based auth")
36
- // AI options
37
- .option("--openai", "Include OpenAI SDK")
38
- .option("--anthropic", "Include Anthropic Claude SDK")
39
- .option("--gemini", "Include Google Gemini SDK")
40
- .option("--vercelAI", "Include Vercel AI SDK")
41
- // Cloud options
42
- .option("--aws", "Include AWS SDK")
43
- .option("--gcp", "Include Google Cloud SDK")
44
- .option("--azure", "Include Azure SDK")
45
- .option("--cloudflareR2", "Include Cloudflare R2")
46
- // Communication options
47
- .option("--resend", "Include Resend email service")
48
- .option("--sendgrid", "Include SendGrid")
49
- .option("--nodemailer", "Include NodeMailer")
50
- .option("--socketio", "Include Socket.io")
51
- .option("--sse", "Include Server-Sent Events")
52
- // Infrastructure options
53
- .option("--bullmq", "Include BullMQ")
54
- .option("--inngest", "Include Inngest")
55
- .option("--upstashRateLimit", "Include Upstash Rate Limit")
56
- .option("--customRateLimit", "Include custom rate limiting")
57
- .option("--sentry", "Include Sentry")
58
- .option("--logtail", "Include LogTail")
59
- // DevX options
60
- .option("--swagger", "Include Swagger/OpenAPI")
61
- .option("--scalar", "Include Scalar API docs")
62
- .option("--vitest", "Include Vitest testing")
63
- // Validation options
64
- .option("--zod", "Include Zod validation")
65
- .option("--yup", "Include Yup validation")
66
- .parse(process.argv);
67
-
68
- const cliProvidedName = program.args[0];
69
- const cliOptions = program.opts<CliFlags>();
70
-
71
- // CI Mode - skip interactive prompts
72
- if (cliOptions.CI) {
73
- return build_from_flags(cliProvidedName, cliOptions);
74
- }
75
-
76
- // Interactive Mode
77
- const intro = `
78
- ╔═══════════════════════════════════════════════╗
79
- ║ ║
80
- ║ 🚀 deploy-bbc ║
81
- ║ (Best Backend Code) ║
82
- ║ ║
83
- ║ Bootstrap a production-ready backend ║
84
- ║ with Bun, TypeScript & Docker ║
85
- ║ ║
86
- ╚═══════════════════════════════════════════════╝
87
- `;
88
-
89
- console.log(chalk.cyan(intro));
90
-
91
- p.intro(chalk.bgCyan(chalk.black(" deploy-bbc ")));
92
-
93
- const project = await p.group(
94
- {
95
- // ──────────────────────────────────────────
96
- // 📦 CORE
97
- // ──────────────────────────────────────────
98
- ...add_cli_header("📦 CORE"),
99
-
100
- projectName: () =>
101
- p.text({
102
- message: "What will your project be called?",
103
- placeholder: "my-awesome-api (or . for current directory)",
104
- defaultValue: cliProvidedName || "my-backend",
105
- validate: (value) => {
106
- if (!value) return "Please enter a project name";
107
- // Allow '.' for current directory or paths
108
- if (value === "." || value.startsWith("./") || value.startsWith("../") || value.startsWith("~/")) {
109
- return; // Valid path
110
- }
111
- // Otherwise check for valid name format
112
- if (!/^[a-z0-9-_/]+$/i.test(value))
113
- return "Only letters, numbers, dashes, underscores, and slashes";
114
- },
115
- }),
116
-
117
- framework: () =>
118
- p.select<any, "hono" | "express" | "bun-native">({
119
- message: "Which framework would you like to use?",
120
- options: [
121
- {
122
- value: "hono",
123
- label: "Hono",
124
- hint: "Ultrafast web framework (recommended)",
125
- },
126
- {
127
- value: "express",
128
- label: "Express",
129
- hint: "Battle-tested Node.js framework",
130
- },
131
- {
132
- value: "bun-native",
133
- label: "Bun Native",
134
- hint: "Native Bun.serve() API",
135
- },
136
- ],
137
- initialValue: "hono",
138
- }),
139
-
140
- databases: () =>
141
- p.multiselect({
142
- message: "Which database(s) would you like to use?",
143
- options: [
144
- {
145
- value: AvailablePackages.postgres,
146
- label: "PostgreSQL",
147
- hint: "Dockerized • Drizzle ORM",
148
- },
149
- {
150
- value: AvailablePackages.mysql,
151
- label: "MySQL",
152
- hint: "Dockerized • Drizzle ORM",
153
- },
154
- {
155
- value: AvailablePackages.mongodb,
156
- label: "MongoDB",
157
- hint: "Not dockerized • Mongoose",
158
- },
159
- {
160
- value: AvailablePackages.redis,
161
- label: "Redis",
162
- hint: "Dockerized • Caching & Sessions",
163
- },
164
- ],
165
- required: false,
166
- }),
167
-
168
- auth: () =>
169
- p.multiselect({
170
- message: "Select authentication methods:",
171
- options: [
172
- {
173
- value: AvailablePackages.jwt,
174
- label: "JWT Token Auth",
175
- hint: "Stateless tokens",
176
- },
177
- {
178
- value: AvailablePackages.oauth,
179
- label: "OAuth 2.0",
180
- hint: "Google, GitHub, etc.",
181
- },
182
- {
183
- value: AvailablePackages.session,
184
- label: "Session-based Auth",
185
- hint: "Requires Redis",
186
- },
187
- ],
188
- required: false,
189
- }),
190
-
191
- // ──────────────────────────────────────────
192
- // 🤖 AI & ML
193
- // ──────────────────────────────────────────
194
- ...add_cli_header("🤖 AI & ML"),
195
-
196
- aiProviders: () =>
197
- p.multiselect({
198
- message: "AI Providers: (select all that apply)",
199
- options: [
200
- {
201
- value: AvailablePackages.openai,
202
- label: "OpenAI",
203
- hint: "GPT-4, DALL-E, Whisper",
204
- },
205
- {
206
- value: AvailablePackages.anthropic,
207
- label: "Anthropic Claude",
208
- hint: "Claude 3.5 Sonnet",
209
- },
210
- {
211
- value: AvailablePackages.gemini,
212
- label: "Google Gemini",
213
- hint: "Gemini Pro",
214
- },
215
- { value: "none", label: "None", hint: "Skip AI integration" },
216
- ],
217
- required: false,
218
- }),
219
-
220
- vercelAI: ({ results }) => {
221
- const hasAI =
222
- results.aiProviders?.length && results.aiProviders.length > 0 &&
223
- !results.aiProviders?.includes("none");
224
-
225
- if (!hasAI) return Promise.resolve(false);
226
-
227
- return p.confirm({
228
- message: "Use Vercel AI SDK for unified interface?",
229
- initialValue: true,
230
- });
231
- },
232
-
233
- // ──────────────────────────────────────────
234
- // 📧 COMMUNICATIONS
235
- // ──────────────────────────────────────────
236
- ...add_cli_header("📧 COMMUNICATIONS"),
237
-
238
- emailService: () =>
239
- p.select<any, AvailablePackages | "none">({
240
- message: "Email service:",
241
- options: [
242
- {
243
- value: AvailablePackages.resend,
244
- label: "Resend",
245
- hint: "Modern, developer-first",
246
- },
247
- {
248
- value: AvailablePackages.sendgrid,
249
- label: "SendGrid",
250
- hint: "Enterprise-grade",
251
- },
252
- {
253
- value: AvailablePackages.nodemailer,
254
- label: "NodeMailer (SMTP)",
255
- hint: "Self-hosted",
256
- },
257
- { value: "none", label: "None" },
258
- ],
259
- initialValue: "none",
260
- }),
261
-
262
- realtime: () =>
263
- p.select<any, AvailablePackages | "none">({
264
- message: "Real-time capabilities:",
265
- options: [
266
- {
267
- value: AvailablePackages.socketio,
268
- label: "Socket.io",
269
- hint: "WebSockets + fallbacks",
270
- },
271
- {
272
- value: AvailablePackages.sse,
273
- label: "Server-Sent Events (SSE)",
274
- hint: "Native, unidirectional",
275
- },
276
- { value: "none", label: "None" },
277
- ],
278
- initialValue: "none",
279
- }),
280
-
281
- // ──────────────────────────────────────────
282
- // 🔧 INFRASTRUCTURE
283
- // ──────────────────────────────────────────
284
- ...add_cli_header("🔧 INFRASTRUCTURE"),
285
-
286
- backgroundJobs: () =>
287
- p.select<any, AvailablePackages | "none">({
288
- message: "Background jobs & queues:",
289
- options: [
290
- {
291
- value: AvailablePackages.bullmq,
292
- label: "BullMQ",
293
- hint: "Redis-based, feature-rich",
294
- },
295
- {
296
- value: AvailablePackages.inngest,
297
- label: "Inngest",
298
- hint: "Serverless-first, durable",
299
- },
300
- { value: "none", label: "None" },
301
- ],
302
- initialValue: "none",
303
- }),
304
-
305
- // ──────────────────────────────────────────
306
- // 📚 DEVELOPER EXPERIENCE
307
- // ──────────────────────────────────────────
308
- ...add_cli_header("📚 DEVELOPER EXPERIENCE"),
309
-
310
- apiDocs: () =>
311
- p.select<any, AvailablePackages | "none">({
312
- message: "API Documentation:",
313
- options: [
314
- {
315
- value: AvailablePackages.swagger,
316
- label: "Swagger/OpenAPI",
317
- hint: "Industry standard",
318
- },
319
- {
320
- value: AvailablePackages.scalar,
321
- label: "Scalar",
322
- hint: "Modern, beautiful UI",
323
- },
324
- { value: "none", label: "None" },
325
- ],
326
- initialValue: AvailablePackages.swagger,
327
- }),
328
-
329
- testing: () =>
330
- p.confirm({
331
- message: "Set up testing with Vitest?",
332
- initialValue: true,
333
- }),
334
-
335
- validation: () =>
336
- p.select<any, AvailablePackages | "none">({
337
- message: "Request validation library:",
338
- options: [
339
- {
340
- value: AvailablePackages.zod,
341
- label: "Zod",
342
- hint: "TypeScript-first, lightweight",
343
- },
344
- {
345
- value: AvailablePackages.yup,
346
- label: "Yup",
347
- hint: "Schema builder, runtime validation",
348
- },
349
- { value: "none", label: "None" },
350
- ],
351
- initialValue: AvailablePackages.zod,
352
- }),
353
-
354
- installDeps: () =>
355
- p.confirm({
356
- message: "Install dependencies?",
357
- initialValue: !cliOptions.noInstall,
358
- }),
359
-
360
- initGit: () =>
361
- p.confirm({
362
- message: "Initialize git repository?",
363
- initialValue: !cliOptions.noGit,
364
- }),
365
- },
366
- {
367
- onCancel: () => {
368
- p.cancel("Operation cancelled");
369
- process.exit(0);
370
- },
371
- }
372
- );
373
-
374
- // Build packages array
375
- const aiPackages = (project.aiProviders as (AvailablePackages | string)[] | undefined)?.filter(p => p !== "none") as AvailablePackages[] || [];
376
- const packages: AvailablePackages[] = [
377
- ...(project.databases || []),
378
- ...(project.auth || []),
379
- ...aiPackages,
380
- project.vercelAI ? AvailablePackages.vercelAI : null,
381
- typeof project.emailService === "string" && project.emailService !== "none" ? project.emailService as AvailablePackages : null,
382
- typeof project.realtime === "string" && project.realtime !== "none" ? project.realtime as AvailablePackages : null,
383
- typeof project.backgroundJobs === "string" && project.backgroundJobs !== "none" ? project.backgroundJobs as AvailablePackages : null,
384
- typeof project.apiDocs === "string" && project.apiDocs !== "none" ? project.apiDocs as AvailablePackages : null,
385
- project.testing ? AvailablePackages.vitest : null,
386
- typeof project.validation === "string" && project.validation !== "none" ? project.validation as AvailablePackages : null,
387
- ].filter(Boolean) as AvailablePackages[];
388
-
389
- return {
390
- appName: project.projectName as string,
391
- framework: project.framework as "hono" | "express" | "bun-native",
392
- packages,
393
- flags: {
394
- ...defaultOptions,
395
- noInstall: !project.installDeps,
396
- noGit: !project.initGit,
397
- },
398
- };
399
- };
400
-
401
- // Helper to add section headers
402
- function add_cli_header(title: string) {
403
- return {
404
- [`_${title.replace(/[^a-zA-Z0-9]/g, "")}`]: () => {
405
- console.log(chalk.bold.cyan(`\n${title}`));
406
- return Promise.resolve();
407
- },
408
- };
409
- }
410
-
411
- // Build project from CLI flags (CI mode)
412
- function build_from_flags(
413
- appName: string | undefined,
414
- flags: CliFlags & { hono?: boolean; express?: boolean; "bun-native"?: boolean }
415
- ): CliResults {
416
- const packages: AvailablePackages[] = [];
417
-
418
- // Determine framework
419
- let framework: "hono" | "express" | "bun-native" = "hono";
420
- if (flags.express) framework = "express";
421
- else if (flags["bun-native"]) framework = "bun-native";
422
-
423
- // Add packages based on flags
424
- if (flags.postgres) packages.push(AvailablePackages.postgres);
425
- if (flags.mysql) packages.push(AvailablePackages.mysql);
426
- if (flags.mongodb) packages.push(AvailablePackages.mongodb);
427
- if (flags.redis) packages.push(AvailablePackages.redis);
428
- if (flags.jwt) packages.push(AvailablePackages.jwt);
429
- if (flags.oauth) packages.push(AvailablePackages.oauth);
430
- if (flags.session) packages.push(AvailablePackages.session);
431
- if (flags.openai) packages.push(AvailablePackages.openai);
432
- if (flags.anthropic) packages.push(AvailablePackages.anthropic);
433
- if (flags.gemini) packages.push(AvailablePackages.gemini);
434
- if (flags.vercelAI) packages.push(AvailablePackages.vercelAI);
435
- if (flags.resend) packages.push(AvailablePackages.resend);
436
- if (flags.sendgrid) packages.push(AvailablePackages.sendgrid);
437
- if (flags.nodemailer) packages.push(AvailablePackages.nodemailer);
438
- if (flags.socketio) packages.push(AvailablePackages.socketio);
439
- if (flags.sse) packages.push(AvailablePackages.sse);
440
- if (flags.bullmq) packages.push(AvailablePackages.bullmq);
441
- if (flags.inngest) packages.push(AvailablePackages.inngest);
442
- if (flags.swagger) packages.push(AvailablePackages.swagger);
443
- if (flags.scalar) packages.push(AvailablePackages.scalar);
444
- if (flags.vitest) packages.push(AvailablePackages.vitest);
445
- if (flags.zod) packages.push(AvailablePackages.zod);
446
- if (flags.yup) packages.push(AvailablePackages.yup);
447
-
448
- return {
449
- appName: appName || "my-backend",
450
- framework,
451
- packages,
452
- flags,
453
- };
454
- }
@@ -1,66 +0,0 @@
1
- import { type CliResults, type InstallerOptions } from "../types/index.js";
2
- import { parse_name_and_path } from "../utils/parse-name-and-path.js";
3
- import { scaffold_project } from "./scaffold-project.js";
4
- import { build_installer_map, run_installers } from "../installers/index.js";
5
- import { generate_dockerfile } from "./generate-dockerfile.js";
6
- import { generate_docker_compose } from "./generate-docker-compose.js";
7
- import { install_dependencies } from "./install-dependencies.js";
8
- import { init_git } from "./init-git.js";
9
- import { log_next_steps } from "./log-next-steps.js";
10
- import { render_title } from "../utils/render-title.js";
11
-
12
- /**
13
- * Main orchestration function for project creation.
14
- * Coordinates all steps: parsing, scaffolding, installing packages, and setup.
15
- *
16
- * @param cliResults - Results from CLI argument parsing
17
- */
18
- export async function create_project(cliResults: CliResults): Promise<void> {
19
- try {
20
- // Step 1: Parse and validate project name and path
21
- render_title("Validating project name");
22
- const { projectName, projectDir } = parse_name_and_path(cliResults.appName);
23
-
24
- // Step 2: Create installer options
25
- const installerOptions: InstallerOptions = {
26
- projectDir,
27
- appName: projectName,
28
- framework: cliResults.framework,
29
- packages: cliResults.packages,
30
- noInstall: cliResults.flags.noInstall,
31
- };
32
-
33
- // Step 3: Scaffold base project structure
34
- render_title("Creating project structure");
35
- await scaffold_project(installerOptions);
36
-
37
- // Step 4: Build installer map and run installers
38
- render_title("Installing selected packages");
39
- const installerMap = build_installer_map(installerOptions);
40
- await run_installers(installerMap, installerOptions);
41
-
42
- // Step 5: Generate Docker files
43
- render_title("Generating Docker configuration");
44
- await generate_dockerfile(installerOptions);
45
- await generate_docker_compose(installerOptions);
46
-
47
- // Step 6: Install dependencies (unless --noInstall flag)
48
- if (!cliResults.flags.noInstall) {
49
- render_title("Installing dependencies");
50
- await install_dependencies(projectDir);
51
- }
52
-
53
- // Step 7: Initialize Git (unless --noGit flag)
54
- if (!cliResults.flags.noGit) {
55
- render_title("Initializing Git repository");
56
- await init_git(projectDir);
57
- }
58
-
59
- // Step 8: Display next steps
60
- log_next_steps(installerOptions, cliResults);
61
- } catch (error) {
62
- console.error("\n❌ Project creation failed:");
63
- console.error(error instanceof Error ? error.message : String(error));
64
- process.exit(1);
65
- }
66
- }
@@ -1,133 +0,0 @@
1
- import path from "path";
2
- import fs from "fs-extra";
3
- import { type InstallerOptions, AvailablePackages } from "../types/index.js";
4
-
5
- /**
6
- * Generates a docker-compose.yml file based on selected packages.
7
- * Includes services for databases, redis, and the main application.
8
- *
9
- * @param options - Installer options with selected packages
10
- */
11
- export async function generate_docker_compose(
12
- options: InstallerOptions
13
- ): Promise<void> {
14
- const { projectDir, packages, appName } = options;
15
-
16
- // Check which services are needed
17
- const hasPostgres = packages.includes(AvailablePackages.postgres);
18
- const hasMysql = packages.includes(AvailablePackages.mysql);
19
- const hasMongodb = packages.includes(AvailablePackages.mongodb);
20
- const hasRedis = packages.includes(AvailablePackages.redis);
21
-
22
- // Only generate docker-compose if we have any services to include
23
- if (!hasPostgres && !hasMysql && !hasMongodb && !hasRedis) {
24
- return;
25
- }
26
-
27
- let composeContent = `version: '3.8'
28
-
29
- services:
30
- `;
31
-
32
- // Add app service
33
- composeContent += ` app:
34
- build: .
35
- ports:
36
- - "8000:8000"
37
- environment:
38
- - NODE_ENV=production
39
- env_file:
40
- - .env
41
- `;
42
-
43
- // Add depends_on for databases
44
- const dependencies: string[] = [];
45
- if (hasPostgres) dependencies.push("postgres");
46
- if (hasMysql) dependencies.push("mysql");
47
- if (hasMongodb) dependencies.push("mongodb");
48
- if (hasRedis) dependencies.push("redis");
49
-
50
- if (dependencies.length > 0) {
51
- composeContent += ` depends_on:
52
- `;
53
- dependencies.forEach((dep) => {
54
- composeContent += ` - ${dep}\n`;
55
- });
56
- }
57
-
58
- // Add PostgreSQL service
59
- if (hasPostgres) {
60
- composeContent += `
61
- postgres:
62
- image: postgres:16-alpine
63
- environment:
64
- POSTGRES_USER: \${POSTGRES_USER:-user}
65
- POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:-password}
66
- POSTGRES_DB: \${POSTGRES_DB:-${appName}}
67
- ports:
68
- - "5432:5432"
69
- volumes:
70
- - postgres_data:/var/lib/postgresql/data
71
- `;
72
- }
73
-
74
- // Add MySQL service
75
- if (hasMysql) {
76
- composeContent += `
77
- mysql:
78
- image: mysql:8.0
79
- environment:
80
- MYSQL_ROOT_PASSWORD: \${MYSQL_ROOT_PASSWORD:-rootpassword}
81
- MYSQL_DATABASE: \${MYSQL_DATABASE:-${appName}}
82
- MYSQL_USER: \${MYSQL_USER:-user}
83
- MYSQL_PASSWORD: \${MYSQL_PASSWORD:-password}
84
- ports:
85
- - "3306:3306"
86
- volumes:
87
- - mysql_data:/var/lib/mysql
88
- `;
89
- }
90
-
91
- // Add MongoDB service
92
- if (hasMongodb) {
93
- composeContent += `
94
- mongodb:
95
- image: mongo:7.0
96
- environment:
97
- MONGO_INITDB_ROOT_USERNAME: \${MONGO_ROOT_USER:-root}
98
- MONGO_INITDB_ROOT_PASSWORD: \${MONGO_ROOT_PASSWORD:-password}
99
- MONGO_INITDB_DATABASE: \${MONGO_DATABASE:-${appName}}
100
- ports:
101
- - "27017:27017"
102
- volumes:
103
- - mongodb_data:/data/db
104
- `;
105
- }
106
-
107
- // Add Redis service
108
- if (hasRedis) {
109
- composeContent += `
110
- redis:
111
- image: redis:7-alpine
112
- ports:
113
- - "6379:6379"
114
- volumes:
115
- - redis_data:/data
116
- command: redis-server --appendonly yes
117
- `;
118
- }
119
-
120
- // Add volumes section
121
- composeContent += `
122
- volumes:
123
- `;
124
-
125
- if (hasPostgres) composeContent += ` postgres_data:\n`;
126
- if (hasMysql) composeContent += ` mysql_data:\n`;
127
- if (hasMongodb) composeContent += ` mongodb_data:\n`;
128
- if (hasRedis) composeContent += ` redis_data:\n`;
129
-
130
- // Write docker-compose.yml
131
- const dockerComposePath = path.join(projectDir, "docker-compose.yml");
132
- await fs.writeFile(dockerComposePath, composeContent);
133
- }
@@ -1,45 +0,0 @@
1
- import path from "path";
2
- import fs from "fs-extra";
3
- import { type InstallerOptions } from "../types/index.js";
4
-
5
- /**
6
- * Generates a Dockerfile for the project.
7
- * Uses Bun's official image with multi-stage build for production optimization.
8
- *
9
- * @param options - Installer options
10
- */
11
- export async function generate_dockerfile(
12
- options: InstallerOptions
13
- ): Promise<void> {
14
- const { projectDir } = options;
15
-
16
- const dockerfileContent = `# Use Bun's official image
17
- FROM oven/bun:1 as base
18
- WORKDIR /app
19
-
20
- # Install dependencies
21
- FROM base AS dependencies
22
- COPY package.json bun.lockb ./
23
- RUN bun install --frozen-lockfile
24
-
25
- # Copy source code
26
- FROM base AS build
27
- COPY --from=dependencies /app/node_modules ./node_modules
28
- COPY . .
29
-
30
- # Production image
31
- FROM base AS production
32
- ENV NODE_ENV=production
33
- COPY --from=dependencies /app/node_modules ./node_modules
34
- COPY --from=build /app .
35
-
36
- # Expose port
37
- EXPOSE 8000
38
-
39
- # Run the application
40
- CMD ["bun", "run", "src/index.ts"]
41
- `;
42
-
43
- const dockerfilePath = path.join(projectDir, "Dockerfile");
44
- await fs.writeFile(dockerfilePath, dockerfileContent);
45
- }