create-stackr 0.2.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 (274) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +642 -0
  3. package/bin/cli.js +12 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +113 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/config/dependencies.d.ts +82 -0
  9. package/dist/config/dependencies.d.ts.map +1 -0
  10. package/dist/config/dependencies.js +82 -0
  11. package/dist/config/dependencies.js.map +1 -0
  12. package/dist/config/presets.d.ts +3 -0
  13. package/dist/config/presets.d.ts.map +1 -0
  14. package/dist/config/presets.js +174 -0
  15. package/dist/config/presets.js.map +1 -0
  16. package/dist/generators/index.d.ts +40 -0
  17. package/dist/generators/index.d.ts.map +1 -0
  18. package/dist/generators/index.js +130 -0
  19. package/dist/generators/index.js.map +1 -0
  20. package/dist/generators/onboarding.d.ts +8 -0
  21. package/dist/generators/onboarding.d.ts.map +1 -0
  22. package/dist/generators/onboarding.js +141 -0
  23. package/dist/generators/onboarding.js.map +1 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.js +65 -0
  27. package/dist/index.js.map +1 -0
  28. package/dist/prompts/features.d.ts +14 -0
  29. package/dist/prompts/features.d.ts.map +1 -0
  30. package/dist/prompts/features.js +96 -0
  31. package/dist/prompts/features.js.map +1 -0
  32. package/dist/prompts/index.d.ts +3 -0
  33. package/dist/prompts/index.d.ts.map +1 -0
  34. package/dist/prompts/index.js +93 -0
  35. package/dist/prompts/index.js.map +1 -0
  36. package/dist/prompts/onboarding.d.ts +6 -0
  37. package/dist/prompts/onboarding.d.ts.map +1 -0
  38. package/dist/prompts/onboarding.js +37 -0
  39. package/dist/prompts/onboarding.js.map +1 -0
  40. package/dist/prompts/orm.d.ts +3 -0
  41. package/dist/prompts/orm.d.ts.map +1 -0
  42. package/dist/prompts/orm.js +23 -0
  43. package/dist/prompts/orm.js.map +1 -0
  44. package/dist/prompts/packageManager.d.ts +2 -0
  45. package/dist/prompts/packageManager.d.ts.map +1 -0
  46. package/dist/prompts/packageManager.js +18 -0
  47. package/dist/prompts/packageManager.js.map +1 -0
  48. package/dist/prompts/platform.d.ts +3 -0
  49. package/dist/prompts/platform.d.ts.map +1 -0
  50. package/dist/prompts/platform.js +21 -0
  51. package/dist/prompts/platform.js.map +1 -0
  52. package/dist/prompts/preset.d.ts +4 -0
  53. package/dist/prompts/preset.d.ts.map +1 -0
  54. package/dist/prompts/preset.js +165 -0
  55. package/dist/prompts/preset.js.map +1 -0
  56. package/dist/prompts/project.d.ts +2 -0
  57. package/dist/prompts/project.d.ts.map +1 -0
  58. package/dist/prompts/project.js +27 -0
  59. package/dist/prompts/project.js.map +1 -0
  60. package/dist/prompts/sdks.d.ts +2 -0
  61. package/dist/prompts/sdks.d.ts.map +1 -0
  62. package/dist/prompts/sdks.js +46 -0
  63. package/dist/prompts/sdks.js.map +1 -0
  64. package/dist/types/index.d.ts +77 -0
  65. package/dist/types/index.d.ts.map +1 -0
  66. package/dist/types/index.js +25 -0
  67. package/dist/types/index.js.map +1 -0
  68. package/dist/utils/cleanup.d.ts +5 -0
  69. package/dist/utils/cleanup.d.ts.map +1 -0
  70. package/dist/utils/cleanup.js +38 -0
  71. package/dist/utils/cleanup.js.map +1 -0
  72. package/dist/utils/copy.d.ts +10 -0
  73. package/dist/utils/copy.d.ts.map +1 -0
  74. package/dist/utils/copy.js +53 -0
  75. package/dist/utils/copy.js.map +1 -0
  76. package/dist/utils/errors.d.ts +33 -0
  77. package/dist/utils/errors.d.ts.map +1 -0
  78. package/dist/utils/errors.js +136 -0
  79. package/dist/utils/errors.js.map +1 -0
  80. package/dist/utils/git.d.ts +5 -0
  81. package/dist/utils/git.d.ts.map +1 -0
  82. package/dist/utils/git.js +33 -0
  83. package/dist/utils/git.js.map +1 -0
  84. package/dist/utils/logger.d.ts +9 -0
  85. package/dist/utils/logger.d.ts.map +1 -0
  86. package/dist/utils/logger.js +22 -0
  87. package/dist/utils/logger.js.map +1 -0
  88. package/dist/utils/package.d.ts +16 -0
  89. package/dist/utils/package.d.ts.map +1 -0
  90. package/dist/utils/package.js +86 -0
  91. package/dist/utils/package.js.map +1 -0
  92. package/dist/utils/system-validation.d.ts +9 -0
  93. package/dist/utils/system-validation.d.ts.map +1 -0
  94. package/dist/utils/system-validation.js +31 -0
  95. package/dist/utils/system-validation.js.map +1 -0
  96. package/dist/utils/template.d.ts +20 -0
  97. package/dist/utils/template.d.ts.map +1 -0
  98. package/dist/utils/template.js +234 -0
  99. package/dist/utils/template.js.map +1 -0
  100. package/dist/utils/validation.d.ts +8 -0
  101. package/dist/utils/validation.d.ts.map +1 -0
  102. package/dist/utils/validation.js +94 -0
  103. package/dist/utils/validation.js.map +1 -0
  104. package/package.json +96 -0
  105. package/templates/base/backend/.dockerignore.ejs +62 -0
  106. package/templates/base/backend/.env.example.ejs +116 -0
  107. package/templates/base/backend/Dockerfile.ejs +142 -0
  108. package/templates/base/backend/controllers/event-queue/index.ts +20 -0
  109. package/templates/base/backend/controllers/event-queue/workers/user.ts +39 -0
  110. package/templates/base/backend/controllers/rest-api/index.ts +48 -0
  111. package/templates/base/backend/controllers/rest-api/plugins/auth.ts +152 -0
  112. package/templates/base/backend/controllers/rest-api/plugins/config.ts +64 -0
  113. package/templates/base/backend/controllers/rest-api/plugins/error-handler.ts +118 -0
  114. package/templates/base/backend/controllers/rest-api/routes/auth.ts.ejs +180 -0
  115. package/templates/base/backend/controllers/rest-api/routes/device-sessions.ts +197 -0
  116. package/templates/base/backend/controllers/rest-api/routes/oauth-web.ts.ejs +375 -0
  117. package/templates/base/backend/controllers/rest-api/server.ts.ejs +87 -0
  118. package/templates/base/backend/domain/device-session/repository.drizzle.ts +209 -0
  119. package/templates/base/backend/domain/device-session/repository.prisma.ts +248 -0
  120. package/templates/base/backend/domain/device-session/schema.ts +72 -0
  121. package/templates/base/backend/domain/session/repository.drizzle.ts +72 -0
  122. package/templates/base/backend/domain/session/repository.prisma.ts +72 -0
  123. package/templates/base/backend/domain/session/schema.ts +29 -0
  124. package/templates/base/backend/domain/user/repository.drizzle.ts +127 -0
  125. package/templates/base/backend/domain/user/repository.prisma.ts +115 -0
  126. package/templates/base/backend/domain/user/schema.ts +14 -0
  127. package/templates/base/backend/drizzle/schema.drizzle.ts +111 -0
  128. package/templates/base/backend/drizzle.config.drizzle.ts +13 -0
  129. package/templates/base/backend/lib/auth.drizzle.ts.ejs +104 -0
  130. package/templates/base/backend/lib/auth.prisma.ts.ejs +97 -0
  131. package/templates/base/backend/lib/constants.ts.ejs +29 -0
  132. package/templates/base/backend/package.json.ejs +50 -0
  133. package/templates/base/backend/prisma/schema.prisma.ejs +102 -0
  134. package/templates/base/backend/prisma.config.prisma.ts +12 -0
  135. package/templates/base/backend/tsconfig.json +39 -0
  136. package/templates/base/backend/utils/db.drizzle.ts +41 -0
  137. package/templates/base/backend/utils/db.prisma.ts +51 -0
  138. package/templates/base/backend/utils/email.ts.ejs +35 -0
  139. package/templates/base/backend/utils/errors.ts +348 -0
  140. package/templates/base/backend/utils/redis.ts.ejs +279 -0
  141. package/templates/base/mobile/.env.example.ejs +35 -0
  142. package/templates/base/mobile/.gitignore.ejs +167 -0
  143. package/templates/base/mobile/app/+not-found.tsx +85 -0
  144. package/templates/base/mobile/app/_layout.tsx.ejs +71 -0
  145. package/templates/base/mobile/app.json.ejs +88 -0
  146. package/templates/base/mobile/assets/images/adaptive-icon.png +0 -0
  147. package/templates/base/mobile/assets/images/favicon.png +0 -0
  148. package/templates/base/mobile/assets/images/icon.png +0 -0
  149. package/templates/base/mobile/assets/images/onboarding_page_1.png +0 -0
  150. package/templates/base/mobile/assets/images/onboarding_page_2.png +0 -0
  151. package/templates/base/mobile/assets/images/onboarding_page_3.png +0 -0
  152. package/templates/base/mobile/assets/images/paywall_image.png +0 -0
  153. package/templates/base/mobile/assets/images/splash.png +0 -0
  154. package/templates/base/mobile/eas.json.ejs +49 -0
  155. package/templates/base/mobile/metro.config.js +9 -0
  156. package/templates/base/mobile/package.json.ejs +53 -0
  157. package/templates/base/mobile/src/components/ui/Button.tsx +131 -0
  158. package/templates/base/mobile/src/components/ui/Card.tsx +68 -0
  159. package/templates/base/mobile/src/components/ui/IconSymbol.tsx +90 -0
  160. package/templates/base/mobile/src/components/ui/Input.tsx +142 -0
  161. package/templates/base/mobile/src/components/ui/LoadingSpinner.tsx +98 -0
  162. package/templates/base/mobile/src/components/ui/OnboardingLayout.tsx +356 -0
  163. package/templates/base/mobile/src/components/ui/PaywallLayout.tsx +311 -0
  164. package/templates/base/mobile/src/components/ui/Skeleton.tsx +58 -0
  165. package/templates/base/mobile/src/components/ui/index.ts +6 -0
  166. package/templates/base/mobile/src/constants/Theme.ts +163 -0
  167. package/templates/base/mobile/src/context/ThemeContext.tsx +157 -0
  168. package/templates/base/mobile/src/lib/auth-client.ts.ejs +51 -0
  169. package/templates/base/mobile/src/services/api.ts.ejs +71 -0
  170. package/templates/base/mobile/src/services/errorService.ts +179 -0
  171. package/templates/base/mobile/src/services/sdkInitializer.ts.ejs +36 -0
  172. package/templates/base/mobile/src/store/index.ts.ejs +18 -0
  173. package/templates/base/mobile/src/store/ui.store.ts +100 -0
  174. package/templates/base/mobile/src/utils/formatters.ts +105 -0
  175. package/templates/base/mobile/src/utils/logger.ts +73 -0
  176. package/templates/base/mobile/src/utils/responsive.ts +234 -0
  177. package/templates/base/mobile/tsconfig.json +32 -0
  178. package/templates/base/web/.env.example.ejs +26 -0
  179. package/templates/base/web/components.json +22 -0
  180. package/templates/base/web/eslint.config.mjs +18 -0
  181. package/templates/base/web/next.config.ts +7 -0
  182. package/templates/base/web/package.json.ejs +35 -0
  183. package/templates/base/web/postcss.config.mjs +7 -0
  184. package/templates/base/web/public/.gitkeep +0 -0
  185. package/templates/base/web/public/file.svg +1 -0
  186. package/templates/base/web/public/globe.svg +1 -0
  187. package/templates/base/web/public/next.svg +1 -0
  188. package/templates/base/web/public/vercel.svg +1 -0
  189. package/templates/base/web/public/window.svg +1 -0
  190. package/templates/base/web/src/app/favicon.ico +0 -0
  191. package/templates/base/web/src/app/globals.css +152 -0
  192. package/templates/base/web/src/app/layout.tsx.ejs +54 -0
  193. package/templates/base/web/src/app/page.tsx.ejs +92 -0
  194. package/templates/base/web/src/components/auth/auth-hydrator.tsx.ejs +19 -0
  195. package/templates/base/web/src/components/auth/protected-route.tsx.ejs +109 -0
  196. package/templates/base/web/src/components/providers/device-session-setup.tsx.ejs +56 -0
  197. package/templates/base/web/src/components/providers/theme-provider.tsx +17 -0
  198. package/templates/base/web/src/components/theme-toggle.tsx +34 -0
  199. package/templates/base/web/src/components/ui/button.tsx +62 -0
  200. package/templates/base/web/src/components/ui/card.tsx +92 -0
  201. package/templates/base/web/src/components/ui/input.tsx +21 -0
  202. package/templates/base/web/src/components/ui/label.tsx +24 -0
  203. package/templates/base/web/src/components/ui/skeleton.tsx +13 -0
  204. package/templates/base/web/src/components/ui/spinner.tsx +20 -0
  205. package/templates/base/web/src/hooks/use-device-session.ts.ejs +40 -0
  206. package/templates/base/web/src/hooks/use-session.ts.ejs +56 -0
  207. package/templates/base/web/src/lib/auth/actions.ts.ejs +334 -0
  208. package/templates/base/web/src/lib/auth/config.ts.ejs +65 -0
  209. package/templates/base/web/src/lib/auth/cookies.ts.ejs +74 -0
  210. package/templates/base/web/src/lib/auth/index.ts.ejs +40 -0
  211. package/templates/base/web/src/lib/auth/oauth.ts.ejs +72 -0
  212. package/templates/base/web/src/lib/auth/pkce.ts.ejs +48 -0
  213. package/templates/base/web/src/lib/auth/sessions.ts.ejs +135 -0
  214. package/templates/base/web/src/lib/auth/user-agent.ts.ejs +47 -0
  215. package/templates/base/web/src/lib/device/actions.ts.ejs +148 -0
  216. package/templates/base/web/src/lib/device/id.ts.ejs +74 -0
  217. package/templates/base/web/src/lib/utils.ts +6 -0
  218. package/templates/base/web/src/proxy.ts.ejs +66 -0
  219. package/templates/base/web/src/store/auth.store.ts.ejs +89 -0
  220. package/templates/base/web/src/store/deviceSession.store.ts.ejs +141 -0
  221. package/templates/base/web/tsconfig.json +34 -0
  222. package/templates/features/mobile/auth/app/(auth)/_layout.tsx +16 -0
  223. package/templates/features/mobile/auth/app/(auth)/login.tsx +86 -0
  224. package/templates/features/mobile/auth/app/(auth)/register.tsx +86 -0
  225. package/templates/features/mobile/auth/components/auth/LoginForm.tsx.ejs +349 -0
  226. package/templates/features/mobile/auth/components/auth/RegisterForm.tsx.ejs +407 -0
  227. package/templates/features/mobile/auth/components/auth/index.ts +2 -0
  228. package/templates/features/mobile/auth/hooks/index.ts.ejs +1 -0
  229. package/templates/features/mobile/auth/hooks/useAuth.ts.ejs +367 -0
  230. package/templates/features/mobile/auth/services/deviceSession.ts +370 -0
  231. package/templates/features/mobile/auth/store/deviceSession.store.ts +326 -0
  232. package/templates/features/mobile/onboarding/app/(onboarding)/_layout.tsx.ejs +11 -0
  233. package/templates/features/mobile/onboarding/app/(onboarding)/page-1.tsx.ejs +52 -0
  234. package/templates/features/mobile/onboarding/app/(onboarding)/page-2.tsx.ejs +52 -0
  235. package/templates/features/mobile/onboarding/app/(onboarding)/page-3.tsx.ejs +60 -0
  236. package/templates/features/mobile/paywall/app/paywall.tsx +550 -0
  237. package/templates/features/mobile/tabs/app/(tabs)/_layout.tsx +26 -0
  238. package/templates/features/mobile/tabs/app/(tabs)/index.tsx +565 -0
  239. package/templates/features/web/.gitkeep +0 -0
  240. package/templates/features/web/auth/app/(app)/dashboard/dashboard-client.tsx.ejs +166 -0
  241. package/templates/features/web/auth/app/(app)/dashboard/page.tsx.ejs +24 -0
  242. package/templates/features/web/auth/app/(app)/layout.tsx.ejs +43 -0
  243. package/templates/features/web/auth/app/(app)/settings/sessions/page.tsx.ejs +29 -0
  244. package/templates/features/web/auth/app/(app)/settings/sessions/sessions-client.tsx.ejs +77 -0
  245. package/templates/features/web/auth/app/(auth)/forgot-password/page.tsx.ejs +127 -0
  246. package/templates/features/web/auth/app/(auth)/layout.tsx.ejs +32 -0
  247. package/templates/features/web/auth/app/(auth)/login/page.tsx.ejs +35 -0
  248. package/templates/features/web/auth/app/(auth)/register/page.tsx.ejs +19 -0
  249. package/templates/features/web/auth/app/(auth)/reset-password/page.tsx.ejs +40 -0
  250. package/templates/features/web/auth/app/(auth)/verify-email/page.tsx.ejs +198 -0
  251. package/templates/features/web/auth/app/auth/callback/route.ts.ejs +152 -0
  252. package/templates/features/web/auth/components/auth/login-form.tsx.ejs +100 -0
  253. package/templates/features/web/auth/components/auth/oauth-buttons.tsx.ejs +126 -0
  254. package/templates/features/web/auth/components/auth/password-reset-form.tsx.ejs +103 -0
  255. package/templates/features/web/auth/components/auth/register-form.tsx.ejs +139 -0
  256. package/templates/features/web/auth/components/settings/session-card.tsx.ejs +132 -0
  257. package/templates/integrations/mobile/adjust/services/adjustService.ts.ejs +163 -0
  258. package/templates/integrations/mobile/adjust/store/adjust.store.ts +243 -0
  259. package/templates/integrations/mobile/att/services/attService.ts +84 -0
  260. package/templates/integrations/mobile/att/services/trackingPermissions.ts +208 -0
  261. package/templates/integrations/mobile/att/store/att.store.ts +162 -0
  262. package/templates/integrations/mobile/revenuecat/services/revenuecatService.ts.ejs +174 -0
  263. package/templates/integrations/mobile/revenuecat/store/revenuecat.store.ts +286 -0
  264. package/templates/integrations/mobile/scate/services/scateService.ts.ejs +85 -0
  265. package/templates/integrations/mobile/scate/store/scate.store.ts +125 -0
  266. package/templates/integrations/web/.gitkeep +0 -0
  267. package/templates/shared/.env.example.ejs +21 -0
  268. package/templates/shared/.gitignore.ejs +145 -0
  269. package/templates/shared/README.md.ejs +134 -0
  270. package/templates/shared/docker-compose.prod.yml.ejs +120 -0
  271. package/templates/shared/docker-compose.yml.ejs +129 -0
  272. package/templates/shared/scripts/docker-dev.sh.ejs +395 -0
  273. package/templates/shared/scripts/docker-prod.sh.ejs +542 -0
  274. package/templates/shared/scripts/setup.sh.ejs +979 -0
@@ -0,0 +1,134 @@
1
+ # <%= projectName %>
2
+
3
+ Generated with [create-fullstack-app](https://github.com/yourusername/create-fullstack-app)
4
+
5
+ ## Features
6
+
7
+ <% if (features.onboarding.enabled) { %>- ✅ Onboarding Flow (<%= features.onboarding.pages %> pages)
8
+ <% } %><% if (features.authentication) { %>- ✅ JWT Authentication
9
+ <% } %><% if (features.paywall) { %>- ✅ Subscription Paywall
10
+ <% } %><% if (integrations.revenueCat.enabled) { %>- ✅ RevenueCat Integration
11
+ <% } %><% if (integrations.adjust.enabled) { %>- ✅ Adjust Attribution & Analytics
12
+ <% } %><% if (integrations.scate.enabled) { %>- ✅ Scate User Engagement
13
+ <% } %>
14
+ ## Getting Started
15
+
16
+ ### 1. Configure API Keys
17
+
18
+ ```bash
19
+ cp mobile/.env.example mobile/.env
20
+ cp backend/.env.example backend/.env
21
+ # Edit .env files with your API keys
22
+ ```
23
+
24
+ ### 2. Start Docker Services
25
+
26
+ ```bash
27
+ ./scripts/setup.sh
28
+ ```
29
+
30
+ <% if (platforms.includes('mobile')) { %>
31
+ ### 3. Start Mobile App
32
+
33
+ ```bash
34
+ cd mobile
35
+ <%= packageManager %> install
36
+ <%= packageManager %> start
37
+ ```
38
+ <% } %>
39
+ <% if (platforms.includes('web')) { %>
40
+ ### <%= platforms.includes('mobile') ? '4' : '3' %>. Start Web App
41
+
42
+ ```bash
43
+ cd web
44
+ <%= packageManager %> install
45
+ <%= packageManager %> run dev
46
+ ```
47
+
48
+ The web app will be available at `http://localhost:3000`.
49
+ <% } %>
50
+
51
+ ### <%= platforms.includes('mobile') && platforms.includes('web') ? '5' : platforms.includes('mobile') || platforms.includes('web') ? '4' : '3' %>. Start Backend
52
+
53
+ ```bash
54
+ cd backend
55
+ <%= packageManager %> install
56
+ <%= packageManager %> run dev:rest-api
57
+ ```
58
+
59
+ ## Building for Production
60
+
61
+ This project uses Expo Application Services (EAS) for native builds:
62
+
63
+ ### One-time Setup
64
+
65
+ 1. Install EAS CLI globally:
66
+ ```bash
67
+ npm install -g eas-cli
68
+ ```
69
+
70
+ 2. Create an Expo account and log in:
71
+ ```bash
72
+ eas login
73
+ ```
74
+
75
+ 3. Configure your project:
76
+ ```bash
77
+ cd mobile
78
+ eas build:configure
79
+ ```
80
+
81
+ ### Building
82
+
83
+ Build for both iOS and Android:
84
+ ```bash
85
+ eas build --platform all
86
+ ```
87
+
88
+ Build for specific platform:
89
+ ```bash
90
+ eas build --platform ios
91
+ eas build --platform android
92
+ ```
93
+
94
+ For more information, see the [EAS Build documentation](https://docs.expo.dev/build/introduction/).
95
+ <% if (platforms.includes('web')) { %>
96
+
97
+ ## Web App
98
+
99
+ The web application is built with:
100
+ - **Next.js 15** - React framework with App Router
101
+ - **TypeScript** - Type safety
102
+ - **Tailwind CSS** - Utility-first styling
103
+ - **shadcn/ui** - UI component library
104
+
105
+ ### Development
106
+
107
+ ```bash
108
+ cd web
109
+ <%= packageManager %> run dev
110
+ ```
111
+
112
+ The web app will be available at `http://localhost:3000`.
113
+ <% } %>
114
+
115
+ ## Project Structure
116
+
117
+ ```
118
+ <%= projectName %>/
119
+ <% if (platforms.includes('mobile')) { %>├── mobile/ # React Native (Expo) mobile app
120
+ <% } %><% if (platforms.includes('web')) { %>├── web/ # Next.js web app
121
+ <% } %>├── backend/ # Node.js backend API
122
+ ├── scripts/ # Setup and utility scripts
123
+ └── docker-compose.yml
124
+ ```
125
+
126
+ ## Documentation
127
+
128
+ <% if (platforms.includes('mobile')) { %>- [Mobile App Documentation](./mobile/README.md)
129
+ <% } %><% if (platforms.includes('web')) { %>- [Web App Documentation](./web/README.md)
130
+ <% } %>- [Backend API Documentation](./backend/README.md)
131
+
132
+ ## License
133
+
134
+ MIT
@@ -0,0 +1,120 @@
1
+ # Simplified Docker Compose for Production Deployment
2
+ # Essential services with basic security practices
3
+
4
+ version: '3.8'
5
+
6
+ services:
7
+ <% if (backend.eventQueue) { %>
8
+ # =============================================================================
9
+ # Redis Cache & Job Queue (Production)
10
+ # =============================================================================
11
+ redis:
12
+ image: redis:7-alpine
13
+ container_name: auth_boilerplate_redis_prod
14
+ restart: always
15
+ command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
16
+ environment:
17
+ REDIS_PASSWORD: ${REDIS_PASSWORD}
18
+ ports:
19
+ - "127.0.0.1:6379:6379" # Bind to localhost only
20
+ volumes:
21
+ - redis_prod_data:/data
22
+ healthcheck:
23
+ test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
24
+ interval: 30s
25
+ timeout: 5s
26
+ retries: 5
27
+ deploy:
28
+ resources:
29
+ limits:
30
+ memory: 512M
31
+ reservations:
32
+ memory: 256M
33
+
34
+ <% } %>
35
+ # =============================================================================
36
+ # PostgreSQL Database (Production)
37
+ # =============================================================================
38
+ database:
39
+ image: postgres:16-alpine
40
+ container_name: auth_boilerplate_db_prod
41
+ restart: always
42
+ environment:
43
+ POSTGRES_USER: ${DB_USER:-postgres}
44
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
45
+ POSTGRES_DB: ${DB_NAME:-auth_boilerplate}
46
+ ports:
47
+ - "127.0.0.1:5432:5432" # Bind to localhost only
48
+ volumes:
49
+ - postgres_prod_data:/var/lib/postgresql/data
50
+ healthcheck:
51
+ test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-auth_boilerplate}"]
52
+ interval: 30s
53
+ timeout: 5s
54
+ retries: 5
55
+
56
+ # =============================================================================
57
+ # REST API Service (Production)
58
+ # =============================================================================
59
+ rest-api:
60
+ build:
61
+ context: ./backend
62
+ target: rest-api-prod
63
+ dockerfile: Dockerfile
64
+ container_name: auth_boilerplate_rest_api_prod
65
+ restart: always
66
+ environment:
67
+ NODE_ENV: production
68
+ DATABASE_URL: postgresql://${DB_USER:-postgres}:${DB_PASSWORD}@database:5432/${DB_NAME:-auth_boilerplate}?schema=public
69
+ JWT_SECRET: ${JWT_SECRET}
70
+ API_HOST: 0.0.0.0
71
+ API_PORT: 8080
72
+ LOG_LEVEL: ${LOG_LEVEL:-info}
73
+ ports:
74
+ - "127.0.0.1:8080:8080" # Bind to localhost only (use reverse proxy if needed)
75
+ depends_on:
76
+ database:
77
+ condition: service_healthy
78
+ healthcheck:
79
+ test: ["CMD", "bun", "-e", "const res = await fetch('http://localhost:8080/'); process.exit(res.ok ? 0 : 1)"]
80
+ interval: 30s
81
+ timeout: 10s
82
+ retries: 3
83
+ start_period: 30s
84
+
85
+ <% if (backend.eventQueue) { %>
86
+ # =============================================================================
87
+ # Event Queue Service (Production)
88
+ # =============================================================================
89
+ event-queue:
90
+ build:
91
+ context: ./backend
92
+ target: event-queue-prod
93
+ dockerfile: Dockerfile
94
+ container_name: auth_boilerplate_event_queue_prod
95
+ restart: always
96
+ environment:
97
+ NODE_ENV: production
98
+ DATABASE_URL: postgresql://${DB_USER:-postgres}:${DB_PASSWORD}@database:5432/${DB_NAME:-auth_boilerplate}?schema=public
99
+ JWT_SECRET: ${JWT_SECRET}
100
+ LOG_LEVEL: ${LOG_LEVEL:-info}
101
+ REDIS_HOST: redis
102
+ REDIS_PORT: 6379
103
+ REDIS_PASSWORD: ${REDIS_PASSWORD}
104
+ depends_on:
105
+ database:
106
+ condition: service_healthy
107
+ redis:
108
+ condition: service_healthy
109
+
110
+ <% } %>
111
+ # =============================================================================
112
+ # Production Volumes
113
+ # =============================================================================
114
+ volumes:
115
+ postgres_prod_data:
116
+ driver: local
117
+ <% if (backend.eventQueue) { %>
118
+ redis_prod_data:
119
+ driver: local
120
+ <% } %>
@@ -0,0 +1,129 @@
1
+ # Simplified Docker Compose for Backend Development
2
+ # Clean setup with database and microservices
3
+
4
+ version: '3.8'
5
+
6
+ services:
7
+ <% if (backend.eventQueue) { %>
8
+ # =============================================================================
9
+ # Redis Cache & Job Queue
10
+ # =============================================================================
11
+ redis:
12
+ image: redis:7-alpine
13
+ container_name: auth_boilerplate_redis
14
+ restart: unless-stopped
15
+ command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-redis-password}
16
+ environment:
17
+ REDIS_PASSWORD: ${REDIS_PASSWORD:-redis-password}
18
+ ports:
19
+ - "6379:6379"
20
+ volumes:
21
+ - redis_data:/data
22
+ healthcheck:
23
+ test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
24
+ interval: 10s
25
+ timeout: 3s
26
+ retries: 3
27
+
28
+ <% } %>
29
+ # =============================================================================
30
+ # PostgreSQL Database
31
+ # =============================================================================
32
+ database:
33
+ image: postgres:16-alpine
34
+ container_name: auth_boilerplate_db
35
+ restart: unless-stopped
36
+ environment:
37
+ POSTGRES_USER: ${DB_USER}
38
+ POSTGRES_PASSWORD: ${DB_PASSWORD}
39
+ POSTGRES_DB: ${DB_NAME}
40
+ ports:
41
+ - "5432:5432"
42
+ volumes:
43
+ - postgres_data:/var/lib/postgresql/data
44
+ healthcheck:
45
+ test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
46
+ interval: 10s
47
+ timeout: 5s
48
+ retries: 3
49
+
50
+ # =============================================================================
51
+ # REST API Service (Development)
52
+ # =============================================================================
53
+ rest-api:
54
+ build:
55
+ context: ./backend
56
+ target: rest-api-dev
57
+ dockerfile: Dockerfile
58
+ container_name: auth_boilerplate_rest_api
59
+ restart: unless-stopped
60
+ environment:
61
+ NODE_ENV: development
62
+ DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@database:5432/${DB_NAME}?schema=public
63
+ JWT_SECRET: ${JWT_SECRET}
64
+ API_HOST: 0.0.0.0
65
+ API_PORT: 8080
66
+ LOG_LEVEL: debug
67
+ # Note: BetterAuth and OAuth config loaded from env_file: ./backend/.env
68
+ ports:
69
+ - "8080:8080"
70
+ volumes:
71
+ # Hot reload for development
72
+ - ./backend:/app:cached
73
+ - /app/node_modules
74
+ <% if (backend.orm === 'prisma') { %>
75
+ - /app/prisma/generated
76
+ <% } %>
77
+ depends_on:
78
+ database:
79
+ condition: service_healthy
80
+ # Optional environment file
81
+ env_file:
82
+ - ./backend/.env
83
+
84
+ <% if (backend.eventQueue) { %>
85
+ # =============================================================================
86
+ # Event Queue Service (Development)
87
+ # =============================================================================
88
+ event-queue:
89
+ build:
90
+ context: ./backend
91
+ target: event-queue-dev
92
+ dockerfile: Dockerfile
93
+ container_name: auth_boilerplate_event_queue
94
+ restart: unless-stopped
95
+ environment:
96
+ NODE_ENV: development
97
+ DATABASE_URL: postgresql://${DB_USER}:${DB_PASSWORD}@database:5432/${DB_NAME}?schema=public
98
+ JWT_SECRET: ${JWT_SECRET}
99
+ LOG_LEVEL: debug
100
+ REDIS_HOST: redis
101
+ REDIS_PORT: 6379
102
+ REDIS_PASSWORD: ${REDIS_PASSWORD:-redis-password}
103
+ volumes:
104
+ # Hot reload for development
105
+ - ./backend:/app:cached
106
+ - /app/node_modules
107
+ <% if (backend.orm === 'prisma') { %>
108
+ - /app/prisma/generated
109
+ <% } %>
110
+ depends_on:
111
+ database:
112
+ condition: service_healthy
113
+ redis:
114
+ condition: service_healthy
115
+ # Optional environment file
116
+ env_file:
117
+ - ./backend/.env
118
+
119
+ <% } %>
120
+ # =============================================================================
121
+ # Volumes for data persistence
122
+ # =============================================================================
123
+ volumes:
124
+ postgres_data:
125
+ driver: local
126
+ <% if (backend.eventQueue) { %>
127
+ redis_data:
128
+ driver: local
129
+ <% } %>