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.
- package/LICENSE +21 -0
- package/README.md +642 -0
- package/bin/cli.js +12 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +113 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/dependencies.d.ts +82 -0
- package/dist/config/dependencies.d.ts.map +1 -0
- package/dist/config/dependencies.js +82 -0
- package/dist/config/dependencies.js.map +1 -0
- package/dist/config/presets.d.ts +3 -0
- package/dist/config/presets.d.ts.map +1 -0
- package/dist/config/presets.js +174 -0
- package/dist/config/presets.js.map +1 -0
- package/dist/generators/index.d.ts +40 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +130 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/onboarding.d.ts +8 -0
- package/dist/generators/onboarding.d.ts.map +1 -0
- package/dist/generators/onboarding.js +141 -0
- package/dist/generators/onboarding.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/features.d.ts +14 -0
- package/dist/prompts/features.d.ts.map +1 -0
- package/dist/prompts/features.js +96 -0
- package/dist/prompts/features.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +93 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/onboarding.d.ts +6 -0
- package/dist/prompts/onboarding.d.ts.map +1 -0
- package/dist/prompts/onboarding.js +37 -0
- package/dist/prompts/onboarding.js.map +1 -0
- package/dist/prompts/orm.d.ts +3 -0
- package/dist/prompts/orm.d.ts.map +1 -0
- package/dist/prompts/orm.js +23 -0
- package/dist/prompts/orm.js.map +1 -0
- package/dist/prompts/packageManager.d.ts +2 -0
- package/dist/prompts/packageManager.d.ts.map +1 -0
- package/dist/prompts/packageManager.js +18 -0
- package/dist/prompts/packageManager.js.map +1 -0
- package/dist/prompts/platform.d.ts +3 -0
- package/dist/prompts/platform.d.ts.map +1 -0
- package/dist/prompts/platform.js +21 -0
- package/dist/prompts/platform.js.map +1 -0
- package/dist/prompts/preset.d.ts +4 -0
- package/dist/prompts/preset.d.ts.map +1 -0
- package/dist/prompts/preset.js +165 -0
- package/dist/prompts/preset.js.map +1 -0
- package/dist/prompts/project.d.ts +2 -0
- package/dist/prompts/project.d.ts.map +1 -0
- package/dist/prompts/project.js +27 -0
- package/dist/prompts/project.js.map +1 -0
- package/dist/prompts/sdks.d.ts +2 -0
- package/dist/prompts/sdks.d.ts.map +1 -0
- package/dist/prompts/sdks.js +46 -0
- package/dist/prompts/sdks.js.map +1 -0
- package/dist/types/index.d.ts +77 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cleanup.d.ts +5 -0
- package/dist/utils/cleanup.d.ts.map +1 -0
- package/dist/utils/cleanup.js +38 -0
- package/dist/utils/cleanup.js.map +1 -0
- package/dist/utils/copy.d.ts +10 -0
- package/dist/utils/copy.d.ts.map +1 -0
- package/dist/utils/copy.js +53 -0
- package/dist/utils/copy.js.map +1 -0
- package/dist/utils/errors.d.ts +33 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +136 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/git.d.ts +5 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +33 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +22 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/package.d.ts +16 -0
- package/dist/utils/package.d.ts.map +1 -0
- package/dist/utils/package.js +86 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/system-validation.d.ts +9 -0
- package/dist/utils/system-validation.d.ts.map +1 -0
- package/dist/utils/system-validation.js +31 -0
- package/dist/utils/system-validation.js.map +1 -0
- package/dist/utils/template.d.ts +20 -0
- package/dist/utils/template.d.ts.map +1 -0
- package/dist/utils/template.js +234 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/validation.d.ts +8 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +94 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +96 -0
- package/templates/base/backend/.dockerignore.ejs +62 -0
- package/templates/base/backend/.env.example.ejs +116 -0
- package/templates/base/backend/Dockerfile.ejs +142 -0
- package/templates/base/backend/controllers/event-queue/index.ts +20 -0
- package/templates/base/backend/controllers/event-queue/workers/user.ts +39 -0
- package/templates/base/backend/controllers/rest-api/index.ts +48 -0
- package/templates/base/backend/controllers/rest-api/plugins/auth.ts +152 -0
- package/templates/base/backend/controllers/rest-api/plugins/config.ts +64 -0
- package/templates/base/backend/controllers/rest-api/plugins/error-handler.ts +118 -0
- package/templates/base/backend/controllers/rest-api/routes/auth.ts.ejs +180 -0
- package/templates/base/backend/controllers/rest-api/routes/device-sessions.ts +197 -0
- package/templates/base/backend/controllers/rest-api/routes/oauth-web.ts.ejs +375 -0
- package/templates/base/backend/controllers/rest-api/server.ts.ejs +87 -0
- package/templates/base/backend/domain/device-session/repository.drizzle.ts +209 -0
- package/templates/base/backend/domain/device-session/repository.prisma.ts +248 -0
- package/templates/base/backend/domain/device-session/schema.ts +72 -0
- package/templates/base/backend/domain/session/repository.drizzle.ts +72 -0
- package/templates/base/backend/domain/session/repository.prisma.ts +72 -0
- package/templates/base/backend/domain/session/schema.ts +29 -0
- package/templates/base/backend/domain/user/repository.drizzle.ts +127 -0
- package/templates/base/backend/domain/user/repository.prisma.ts +115 -0
- package/templates/base/backend/domain/user/schema.ts +14 -0
- package/templates/base/backend/drizzle/schema.drizzle.ts +111 -0
- package/templates/base/backend/drizzle.config.drizzle.ts +13 -0
- package/templates/base/backend/lib/auth.drizzle.ts.ejs +104 -0
- package/templates/base/backend/lib/auth.prisma.ts.ejs +97 -0
- package/templates/base/backend/lib/constants.ts.ejs +29 -0
- package/templates/base/backend/package.json.ejs +50 -0
- package/templates/base/backend/prisma/schema.prisma.ejs +102 -0
- package/templates/base/backend/prisma.config.prisma.ts +12 -0
- package/templates/base/backend/tsconfig.json +39 -0
- package/templates/base/backend/utils/db.drizzle.ts +41 -0
- package/templates/base/backend/utils/db.prisma.ts +51 -0
- package/templates/base/backend/utils/email.ts.ejs +35 -0
- package/templates/base/backend/utils/errors.ts +348 -0
- package/templates/base/backend/utils/redis.ts.ejs +279 -0
- package/templates/base/mobile/.env.example.ejs +35 -0
- package/templates/base/mobile/.gitignore.ejs +167 -0
- package/templates/base/mobile/app/+not-found.tsx +85 -0
- package/templates/base/mobile/app/_layout.tsx.ejs +71 -0
- package/templates/base/mobile/app.json.ejs +88 -0
- package/templates/base/mobile/assets/images/adaptive-icon.png +0 -0
- package/templates/base/mobile/assets/images/favicon.png +0 -0
- package/templates/base/mobile/assets/images/icon.png +0 -0
- package/templates/base/mobile/assets/images/onboarding_page_1.png +0 -0
- package/templates/base/mobile/assets/images/onboarding_page_2.png +0 -0
- package/templates/base/mobile/assets/images/onboarding_page_3.png +0 -0
- package/templates/base/mobile/assets/images/paywall_image.png +0 -0
- package/templates/base/mobile/assets/images/splash.png +0 -0
- package/templates/base/mobile/eas.json.ejs +49 -0
- package/templates/base/mobile/metro.config.js +9 -0
- package/templates/base/mobile/package.json.ejs +53 -0
- package/templates/base/mobile/src/components/ui/Button.tsx +131 -0
- package/templates/base/mobile/src/components/ui/Card.tsx +68 -0
- package/templates/base/mobile/src/components/ui/IconSymbol.tsx +90 -0
- package/templates/base/mobile/src/components/ui/Input.tsx +142 -0
- package/templates/base/mobile/src/components/ui/LoadingSpinner.tsx +98 -0
- package/templates/base/mobile/src/components/ui/OnboardingLayout.tsx +356 -0
- package/templates/base/mobile/src/components/ui/PaywallLayout.tsx +311 -0
- package/templates/base/mobile/src/components/ui/Skeleton.tsx +58 -0
- package/templates/base/mobile/src/components/ui/index.ts +6 -0
- package/templates/base/mobile/src/constants/Theme.ts +163 -0
- package/templates/base/mobile/src/context/ThemeContext.tsx +157 -0
- package/templates/base/mobile/src/lib/auth-client.ts.ejs +51 -0
- package/templates/base/mobile/src/services/api.ts.ejs +71 -0
- package/templates/base/mobile/src/services/errorService.ts +179 -0
- package/templates/base/mobile/src/services/sdkInitializer.ts.ejs +36 -0
- package/templates/base/mobile/src/store/index.ts.ejs +18 -0
- package/templates/base/mobile/src/store/ui.store.ts +100 -0
- package/templates/base/mobile/src/utils/formatters.ts +105 -0
- package/templates/base/mobile/src/utils/logger.ts +73 -0
- package/templates/base/mobile/src/utils/responsive.ts +234 -0
- package/templates/base/mobile/tsconfig.json +32 -0
- package/templates/base/web/.env.example.ejs +26 -0
- package/templates/base/web/components.json +22 -0
- package/templates/base/web/eslint.config.mjs +18 -0
- package/templates/base/web/next.config.ts +7 -0
- package/templates/base/web/package.json.ejs +35 -0
- package/templates/base/web/postcss.config.mjs +7 -0
- package/templates/base/web/public/.gitkeep +0 -0
- package/templates/base/web/public/file.svg +1 -0
- package/templates/base/web/public/globe.svg +1 -0
- package/templates/base/web/public/next.svg +1 -0
- package/templates/base/web/public/vercel.svg +1 -0
- package/templates/base/web/public/window.svg +1 -0
- package/templates/base/web/src/app/favicon.ico +0 -0
- package/templates/base/web/src/app/globals.css +152 -0
- package/templates/base/web/src/app/layout.tsx.ejs +54 -0
- package/templates/base/web/src/app/page.tsx.ejs +92 -0
- package/templates/base/web/src/components/auth/auth-hydrator.tsx.ejs +19 -0
- package/templates/base/web/src/components/auth/protected-route.tsx.ejs +109 -0
- package/templates/base/web/src/components/providers/device-session-setup.tsx.ejs +56 -0
- package/templates/base/web/src/components/providers/theme-provider.tsx +17 -0
- package/templates/base/web/src/components/theme-toggle.tsx +34 -0
- package/templates/base/web/src/components/ui/button.tsx +62 -0
- package/templates/base/web/src/components/ui/card.tsx +92 -0
- package/templates/base/web/src/components/ui/input.tsx +21 -0
- package/templates/base/web/src/components/ui/label.tsx +24 -0
- package/templates/base/web/src/components/ui/skeleton.tsx +13 -0
- package/templates/base/web/src/components/ui/spinner.tsx +20 -0
- package/templates/base/web/src/hooks/use-device-session.ts.ejs +40 -0
- package/templates/base/web/src/hooks/use-session.ts.ejs +56 -0
- package/templates/base/web/src/lib/auth/actions.ts.ejs +334 -0
- package/templates/base/web/src/lib/auth/config.ts.ejs +65 -0
- package/templates/base/web/src/lib/auth/cookies.ts.ejs +74 -0
- package/templates/base/web/src/lib/auth/index.ts.ejs +40 -0
- package/templates/base/web/src/lib/auth/oauth.ts.ejs +72 -0
- package/templates/base/web/src/lib/auth/pkce.ts.ejs +48 -0
- package/templates/base/web/src/lib/auth/sessions.ts.ejs +135 -0
- package/templates/base/web/src/lib/auth/user-agent.ts.ejs +47 -0
- package/templates/base/web/src/lib/device/actions.ts.ejs +148 -0
- package/templates/base/web/src/lib/device/id.ts.ejs +74 -0
- package/templates/base/web/src/lib/utils.ts +6 -0
- package/templates/base/web/src/proxy.ts.ejs +66 -0
- package/templates/base/web/src/store/auth.store.ts.ejs +89 -0
- package/templates/base/web/src/store/deviceSession.store.ts.ejs +141 -0
- package/templates/base/web/tsconfig.json +34 -0
- package/templates/features/mobile/auth/app/(auth)/_layout.tsx +16 -0
- package/templates/features/mobile/auth/app/(auth)/login.tsx +86 -0
- package/templates/features/mobile/auth/app/(auth)/register.tsx +86 -0
- package/templates/features/mobile/auth/components/auth/LoginForm.tsx.ejs +349 -0
- package/templates/features/mobile/auth/components/auth/RegisterForm.tsx.ejs +407 -0
- package/templates/features/mobile/auth/components/auth/index.ts +2 -0
- package/templates/features/mobile/auth/hooks/index.ts.ejs +1 -0
- package/templates/features/mobile/auth/hooks/useAuth.ts.ejs +367 -0
- package/templates/features/mobile/auth/services/deviceSession.ts +370 -0
- package/templates/features/mobile/auth/store/deviceSession.store.ts +326 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/_layout.tsx.ejs +11 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/page-1.tsx.ejs +52 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/page-2.tsx.ejs +52 -0
- package/templates/features/mobile/onboarding/app/(onboarding)/page-3.tsx.ejs +60 -0
- package/templates/features/mobile/paywall/app/paywall.tsx +550 -0
- package/templates/features/mobile/tabs/app/(tabs)/_layout.tsx +26 -0
- package/templates/features/mobile/tabs/app/(tabs)/index.tsx +565 -0
- package/templates/features/web/.gitkeep +0 -0
- package/templates/features/web/auth/app/(app)/dashboard/dashboard-client.tsx.ejs +166 -0
- package/templates/features/web/auth/app/(app)/dashboard/page.tsx.ejs +24 -0
- package/templates/features/web/auth/app/(app)/layout.tsx.ejs +43 -0
- package/templates/features/web/auth/app/(app)/settings/sessions/page.tsx.ejs +29 -0
- package/templates/features/web/auth/app/(app)/settings/sessions/sessions-client.tsx.ejs +77 -0
- package/templates/features/web/auth/app/(auth)/forgot-password/page.tsx.ejs +127 -0
- package/templates/features/web/auth/app/(auth)/layout.tsx.ejs +32 -0
- package/templates/features/web/auth/app/(auth)/login/page.tsx.ejs +35 -0
- package/templates/features/web/auth/app/(auth)/register/page.tsx.ejs +19 -0
- package/templates/features/web/auth/app/(auth)/reset-password/page.tsx.ejs +40 -0
- package/templates/features/web/auth/app/(auth)/verify-email/page.tsx.ejs +198 -0
- package/templates/features/web/auth/app/auth/callback/route.ts.ejs +152 -0
- package/templates/features/web/auth/components/auth/login-form.tsx.ejs +100 -0
- package/templates/features/web/auth/components/auth/oauth-buttons.tsx.ejs +126 -0
- package/templates/features/web/auth/components/auth/password-reset-form.tsx.ejs +103 -0
- package/templates/features/web/auth/components/auth/register-form.tsx.ejs +139 -0
- package/templates/features/web/auth/components/settings/session-card.tsx.ejs +132 -0
- package/templates/integrations/mobile/adjust/services/adjustService.ts.ejs +163 -0
- package/templates/integrations/mobile/adjust/store/adjust.store.ts +243 -0
- package/templates/integrations/mobile/att/services/attService.ts +84 -0
- package/templates/integrations/mobile/att/services/trackingPermissions.ts +208 -0
- package/templates/integrations/mobile/att/store/att.store.ts +162 -0
- package/templates/integrations/mobile/revenuecat/services/revenuecatService.ts.ejs +174 -0
- package/templates/integrations/mobile/revenuecat/store/revenuecat.store.ts +286 -0
- package/templates/integrations/mobile/scate/services/scateService.ts.ejs +85 -0
- package/templates/integrations/mobile/scate/store/scate.store.ts +125 -0
- package/templates/integrations/web/.gitkeep +0 -0
- package/templates/shared/.env.example.ejs +21 -0
- package/templates/shared/.gitignore.ejs +145 -0
- package/templates/shared/README.md.ejs +134 -0
- package/templates/shared/docker-compose.prod.yml.ejs +120 -0
- package/templates/shared/docker-compose.yml.ejs +129 -0
- package/templates/shared/scripts/docker-dev.sh.ejs +395 -0
- package/templates/shared/scripts/docker-prod.sh.ejs +542 -0
- 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
|
+
<% } %>
|