create-tigra 3.2.0 → 4.0.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/README.md +81 -12
- package/bin/create-tigra.js +495 -472
- package/lib/patchers/email-verification.patcher.js +160 -44
- package/modules/email-verification/client/hooks/useVerification.ts +4 -1
- package/modules/email-verification/server/__tests__/verification.integration.test.ts +115 -0
- package/modules/email-verification/server/verification.controller.ts +3 -1
- package/modules/email-verification/server/verification.service.ts +81 -21
- package/package.json +3 -2
- package/template/.github/dependabot.yml +47 -0
- package/template/.github/workflows/audit.yml +36 -0
- package/template/.github/workflows/ci.yml +79 -0
- package/template/AGENTS.md +18 -9
- package/template/client/.dockerignore +1 -0
- package/template/client/.env.example.production +13 -2
- package/template/client/AGENTS.md +13 -5
- package/template/client/Dockerfile +186 -14
- package/template/client/next.config.ts +1 -1
- package/template/client/package-lock.json +15983 -14181
- package/template/client/package.json +56 -48
- package/template/client/scripts/check-sharp.mjs +53 -0
- package/template/client/scripts/next-dev.cjs +5 -1
- package/template/client/src/__tests__/proxy.test.ts +92 -0
- package/template/client/src/app/healthz/route.ts +16 -0
- package/template/client/src/app/layout.tsx +9 -3
- package/template/client/src/app/page.tsx +2 -2
- package/template/client/src/app/providers.tsx +23 -4
- package/template/client/src/components/layout/Header.tsx +7 -3
- package/template/client/src/features/admin/hooks/useAdminSessions.ts +2 -1
- package/template/client/src/features/admin/hooks/useAdminUsers.ts +3 -1
- package/template/client/src/features/admin/types/admin.types.ts +2 -3
- package/template/client/src/features/auth/components/AuthInitializer.tsx +38 -19
- package/template/client/src/features/auth/components/ForgotPasswordForm.tsx +107 -0
- package/template/client/src/features/auth/components/LimitNotice.tsx +28 -0
- package/template/client/src/features/auth/components/LoginForm.tsx +18 -4
- package/template/client/src/features/auth/components/RegisterForm.tsx +23 -7
- package/template/client/src/features/auth/hooks/useAuth.ts +27 -7
- package/template/client/src/features/auth/hooks/usePasswordReset.ts +7 -1
- package/template/client/src/features/auth/services/auth.service.ts +8 -3
- package/template/client/src/features/auth/store/authSlice.ts +7 -2
- package/template/client/src/features/auth/types/auth.types.ts +3 -0
- package/template/client/src/instrumentation-client.ts +9 -1
- package/template/client/src/instrumentation.ts +6 -0
- package/template/client/src/lib/api/__tests__/axios.config.test.ts +183 -0
- package/template/client/src/lib/api/api.types.ts +14 -0
- package/template/client/src/lib/api/axios.config.ts +101 -15
- package/template/client/src/lib/api/hard-redirect.ts +8 -0
- package/template/client/src/lib/api/session-events.ts +29 -0
- package/template/client/src/lib/constants/routes.ts +12 -0
- package/template/client/src/lib/observability/sentry-scrub.ts +71 -0
- package/template/client/src/lib/utils/__tests__/error.test.ts +119 -0
- package/template/client/src/lib/utils/__tests__/form.test.ts +42 -0
- package/template/client/src/lib/utils/__tests__/paths.test.ts +43 -0
- package/template/client/src/lib/utils/__tests__/security.test.ts +40 -0
- package/template/client/src/lib/utils/__tests__/session-marker.test.ts +27 -0
- package/template/client/src/lib/utils/error.ts +86 -1
- package/template/client/src/lib/utils/form.ts +31 -0
- package/template/client/src/lib/utils/paths.ts +18 -0
- package/template/client/src/lib/utils/security.ts +37 -0
- package/template/client/src/lib/utils/session-marker.ts +24 -0
- package/template/client/src/{middleware.ts → proxy.ts} +25 -11
- package/template/client/src/store/__tests__/store.test.ts +44 -0
- package/template/client/src/store/index.ts +26 -8
- package/template/client/vitest.config.mts +48 -0
- package/template/server/.env.example +280 -269
- package/template/server/.env.example.production +283 -236
- package/template/server/AGENTS.md +13 -4
- package/template/server/Dockerfile +181 -14
- package/template/server/docker-compose.yml +4 -2
- package/template/server/docs/deployment.md +63 -0
- package/template/server/docs/logging.md +52 -4
- package/template/server/docs/rate-limits.md +153 -0
- package/template/server/docs/testing.md +63 -0
- package/template/server/eslint.config.mjs +19 -0
- package/template/server/package-lock.json +8784 -8743
- package/template/server/package.json +79 -75
- package/template/server/prisma/migrations/0_init/migration.sql +82 -0
- package/template/server/prisma/migrations/migration_lock.toml +3 -0
- package/template/server/prisma/schema.prisma +19 -6
- package/template/server/prisma/seed.ts +13 -5
- package/template/server/scripts/check-heic.mjs +40 -0
- package/template/server/scripts/check-sharp.mjs +53 -0
- package/template/server/src/__tests__/routes.integration.test.ts +280 -0
- package/template/server/src/app.ts +248 -335
- package/template/server/src/config/__tests__/env.test.ts +219 -0
- package/template/server/src/config/__tests__/rate-limit.config.test.ts +158 -0
- package/template/server/src/config/env.ts +326 -171
- package/template/server/src/config/rate-limit.config.ts +157 -106
- package/template/server/src/jobs/__tests__/cleanup-deleted-accounts.job.test.ts +110 -0
- package/template/server/src/jobs/__tests__/cleanup-expired-auth.job.test.ts +44 -0
- package/template/server/src/jobs/__tests__/jobs.integration.test.ts +88 -0
- package/template/server/src/jobs/__tests__/schedule.test.ts +92 -0
- package/template/server/src/jobs/cleanup-deleted-accounts.job.ts +81 -65
- package/template/server/src/jobs/cleanup-expired-auth.job.ts +32 -24
- package/template/server/src/jobs/index.ts +12 -2
- package/template/server/src/jobs/refresh-cloudflare-ranges.job.ts +28 -0
- package/template/server/src/jobs/schedule.ts +50 -0
- package/template/server/src/libs/__tests__/auth.test.ts +168 -0
- package/template/server/src/libs/__tests__/client-ip.test.ts +257 -121
- package/template/server/src/libs/__tests__/cloudflare-ranges.test.ts +79 -0
- package/template/server/src/libs/__tests__/cookies.test.ts +113 -0
- package/template/server/src/libs/__tests__/email-quota.test.ts +81 -0
- package/template/server/src/libs/__tests__/email.test.ts +68 -0
- package/template/server/src/libs/__tests__/error-handler.test.ts +162 -0
- package/template/server/src/libs/__tests__/health-db-down.integration.test.ts +37 -0
- package/template/server/src/libs/__tests__/health-redis-down.integration.test.ts +45 -0
- package/template/server/src/libs/__tests__/health-routes.test.ts +83 -0
- package/template/server/src/libs/__tests__/health.integration.test.ts +118 -0
- package/template/server/src/libs/__tests__/http.test.ts +74 -2
- package/template/server/src/libs/__tests__/ip-block.test.ts +179 -62
- package/template/server/src/libs/__tests__/logger.test.ts +50 -0
- package/template/server/src/libs/__tests__/monitoring.test.ts +185 -0
- package/template/server/src/libs/__tests__/outbound.integration.test.ts +48 -0
- package/template/server/src/libs/__tests__/prisma-client.test.ts +28 -0
- package/template/server/src/libs/__tests__/query-counter.integration.test.ts +53 -0
- package/template/server/src/libs/__tests__/rate-limiting.test.ts +146 -0
- package/template/server/src/libs/__tests__/rate-limits.integration.test.ts +53 -0
- package/template/server/src/libs/__tests__/redis-required.test.ts +30 -0
- package/template/server/src/libs/__tests__/redis.test.ts +59 -0
- package/template/server/src/libs/__tests__/request-id.test.ts +25 -0
- package/template/server/src/libs/__tests__/requestLogger.test.ts +126 -0
- package/template/server/src/libs/__tests__/safe-http.test.ts +138 -0
- package/template/server/src/libs/__tests__/sentry-scrub.test.ts +82 -0
- package/template/server/src/libs/__tests__/shutdown.test.ts +89 -0
- package/template/server/src/libs/__tests__/url-safety.test.ts +130 -80
- package/template/server/src/libs/account-status.ts +52 -0
- package/template/server/src/libs/auth.ts +51 -12
- package/template/server/src/libs/client-ip.ts +158 -77
- package/template/server/src/libs/cloudflare-ranges.ts +132 -0
- package/template/server/src/libs/cookies.ts +91 -24
- package/template/server/src/libs/email-quota.ts +74 -0
- package/template/server/src/libs/email.ts +46 -9
- package/template/server/src/libs/error-handler.ts +111 -0
- package/template/server/src/libs/health-routes.ts +53 -0
- package/template/server/src/libs/http.ts +139 -47
- package/template/server/src/libs/ip-address.ts +37 -0
- package/template/server/src/libs/ip-block.ts +284 -220
- package/template/server/src/libs/logger.ts +41 -12
- package/template/server/src/libs/monitoring.ts +131 -42
- package/template/server/src/libs/observability/sentry.ts +80 -0
- package/template/server/src/libs/origin-check.ts +9 -7
- package/template/server/src/libs/prisma.ts +47 -4
- package/template/server/src/libs/query-counter.ts +71 -59
- package/template/server/src/libs/rate-limiting.ts +110 -0
- package/template/server/src/libs/redis-required.ts +28 -0
- package/template/server/src/libs/redis.ts +108 -18
- package/template/server/src/libs/request-id.ts +18 -0
- package/template/server/src/libs/requestLogger.ts +112 -17
- package/template/server/src/libs/safe-http.ts +101 -0
- package/template/server/src/libs/shutdown.ts +87 -0
- package/template/server/src/libs/storage/__tests__/fixtures/tiny-heic.ts +13 -0
- package/template/server/src/libs/storage/__tests__/image-optimizer.test.ts +143 -0
- package/template/server/src/libs/storage/__tests__/multipart-limits.test.ts +91 -0
- package/template/server/src/libs/storage/__tests__/upload-persistence.test.ts +52 -0
- package/template/server/src/libs/storage/file-storage.service.ts +104 -83
- package/template/server/src/libs/storage/file-validator.ts +48 -46
- package/template/server/src/libs/storage/image-optimizer.service.ts +78 -72
- package/template/server/src/libs/token-hash.ts +18 -0
- package/template/server/src/libs/url-safety.ts +127 -121
- package/template/server/src/libs/validation-errors.ts +86 -0
- package/template/server/src/modules/admin/__tests__/admin-actions.integration.test.ts +255 -0
- package/template/server/src/modules/admin/__tests__/admin.health.test.ts +82 -0
- package/template/server/src/modules/admin/__tests__/admin.repo.test.ts +55 -0
- package/template/server/src/modules/admin/__tests__/admin.schemas.test.ts +38 -0
- package/template/server/src/modules/admin/__tests__/admin.service.test.ts +162 -0
- package/template/server/src/modules/admin/admin.controller.ts +66 -49
- package/template/server/src/modules/admin/admin.repo.ts +56 -13
- package/template/server/src/modules/admin/admin.routes.ts +48 -2
- package/template/server/src/modules/admin/admin.schemas.ts +18 -6
- package/template/server/src/modules/admin/admin.service.ts +73 -7
- package/template/server/src/modules/auth/__tests__/auth.controller.test.ts +39 -0
- package/template/server/src/modules/auth/__tests__/auth.integration.test.ts +9 -3
- package/template/server/src/modules/auth/__tests__/auth.service.dummy-hash.test.ts +34 -0
- package/template/server/src/modules/auth/__tests__/auth.service.test.ts +332 -49
- package/template/server/src/modules/auth/__tests__/session-cleanup.test.ts +39 -0
- package/template/server/src/modules/auth/__tests__/sessions.integration.test.ts +246 -0
- package/template/server/src/modules/auth/__tests__/token-fingerprints.test.ts +119 -0
- package/template/server/src/modules/auth/auth.controller.ts +133 -128
- package/template/server/src/modules/auth/auth.repo.ts +60 -42
- package/template/server/src/modules/auth/auth.schemas.ts +5 -2
- package/template/server/src/modules/auth/auth.service.ts +197 -109
- package/template/server/src/modules/auth/session.repo.ts +12 -12
- package/template/server/src/modules/files/__tests__/files.integration.test.ts +5 -5
- package/template/server/src/modules/users/__tests__/avatar-upload.test.ts +120 -0
- package/template/server/src/modules/users/__tests__/name-rules.test.ts +46 -0
- package/template/server/src/modules/users/__tests__/users.integration.test.ts +295 -0
- package/template/server/src/modules/users/__tests__/users.repo.test.ts +37 -0
- package/template/server/src/modules/users/__tests__/users.service.test.ts +129 -0
- package/template/server/src/modules/users/users.controller.ts +9 -38
- package/template/server/src/modules/users/users.repo.ts +25 -7
- package/template/server/src/modules/users/users.routes.ts +3 -22
- package/template/server/src/modules/users/users.schemas.ts +15 -9
- package/template/server/src/modules/users/users.service.ts +105 -93
- package/template/server/src/scripts/make-admin.ts +48 -0
- package/template/server/src/server.ts +48 -26
- package/template/server/src/shared/errors/AppError.ts +27 -1
- package/template/server/src/shared/errors/errors.ts +42 -5
- package/template/server/src/shared/responses/successResponse.ts +22 -3
- package/template/server/src/shared/types/index.ts +7 -0
- package/template/server/src/test/__tests__/integration-services.test.ts +66 -0
- package/template/server/src/test/integration-helpers.ts +343 -0
- package/template/server/src/test/integration-services.ts +74 -0
- package/template/server/src/test/integration.global-setup.ts +144 -0
- package/template/server/src/test/integration.setup.ts +35 -158
- package/template/server/src/test/setup.ts +23 -8
- package/template/server/tsconfig.build.json +1 -1
- package/template/server/tsconfig.json +1 -0
- package/template/server/vitest.config.ts +17 -4
- package/template/server/vitest.integration.config.ts +18 -13
- package/template/server/src/libs/storage/filename-sanitizer.ts +0 -71
|
@@ -1,269 +1,280 @@
|
|
|
1
|
-
# ===================================================================
|
|
2
|
-
# APPLICATION CONFIGURATION
|
|
3
|
-
# ===================================================================
|
|
4
|
-
#
|
|
5
|
-
# COOLIFY DEPLOYMENT NOTE:
|
|
6
|
-
# When adding environment variables in Coolify, do NOT check
|
|
7
|
-
# "Available at Buildtime" for any variable unless explicitly noted.
|
|
8
|
-
# The server Dockerfile handles build-time config internally.
|
|
9
|
-
# All variables below are RUNTIME-ONLY unless marked otherwise.
|
|
10
|
-
#
|
|
11
|
-
# ===================================================================
|
|
12
|
-
|
|
13
|
-
# Environment: development | production | test
|
|
14
|
-
# COOLIFY: Do NOT check "Available at Buildtime" — the Dockerfile
|
|
15
|
-
# sets NODE_ENV=development during build to ensure devDependencies install.
|
|
16
|
-
NODE_ENV=development
|
|
17
|
-
|
|
18
|
-
# Server port (default: 8000)
|
|
19
|
-
PORT=8000
|
|
20
|
-
|
|
21
|
-
# Server host (0.0.0.0 = listen on all interfaces)
|
|
22
|
-
HOST=0.0.0.0
|
|
23
|
-
|
|
24
|
-
# ===================================================================
|
|
25
|
-
# SERVER TIMEOUTS
|
|
26
|
-
# ===================================================================
|
|
27
|
-
|
|
28
|
-
# Fastify request timeout in milliseconds (default: 30000 = 30s)
|
|
29
|
-
# Long-running routes (LLM calls, big exports) may need 180000+ (180s).
|
|
30
|
-
# IMPORTANT: the reverse proxy (Nginx/Coolify) timeout must be raised to
|
|
31
|
-
# match, or the proxy cuts the connection before the server does.
|
|
32
|
-
REQUEST_TIMEOUT_MS=30000
|
|
33
|
-
|
|
34
|
-
# Fastify connection timeout in milliseconds (default: 60000 = 60s)
|
|
35
|
-
CONNECTION_TIMEOUT_MS=60000
|
|
36
|
-
|
|
37
|
-
# ===================================================================
|
|
38
|
-
# DATABASE CONFIGURATION (MySQL 8.0+)
|
|
39
|
-
# ===================================================================
|
|
40
|
-
|
|
41
|
-
# Database connection string
|
|
42
|
-
# Format: mysql://username:password@host:port/database
|
|
43
|
-
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime".
|
|
44
|
-
DATABASE_URL="mysql://root:rootpassword@localhost:{{MYSQL_PORT}}/{{DATABASE_NAME}}"
|
|
45
|
-
|
|
46
|
-
# Connection pool
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
# ===================================================================
|
|
53
|
-
# REDIS CONFIGURATION
|
|
54
|
-
# ===================================================================
|
|
55
|
-
|
|
56
|
-
# Redis connection URL
|
|
57
|
-
# Format: redis://[:password@]host:port[/database]
|
|
58
|
-
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime".
|
|
59
|
-
REDIS_URL="redis://localhost:{{REDIS_PORT}}"
|
|
60
|
-
|
|
61
|
-
# Max retry attempts for failed Redis operations
|
|
62
|
-
REDIS_MAX_RETRIES=3
|
|
63
|
-
|
|
64
|
-
# Connection timeout in milliseconds
|
|
65
|
-
REDIS_CONNECT_TIMEOUT=10000
|
|
66
|
-
|
|
67
|
-
# ===================================================================
|
|
68
|
-
# RATE LIMITING
|
|
69
|
-
# ===================================================================
|
|
70
|
-
|
|
71
|
-
# Master switch to enable/disable rate limiting (default: true)
|
|
72
|
-
# Set to false in development to disable all rate limits
|
|
73
|
-
RATE_LIMIT_ENABLED=true
|
|
74
|
-
|
|
75
|
-
# Multiply all rate limit max values by this factor (default: 1)
|
|
76
|
-
# Set to 10 in development for 10x headroom, or 0.5 for tighter limits
|
|
77
|
-
RATE_LIMIT_MULTIPLIER=1
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
#
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
104
|
-
|
|
105
|
-
#
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
#
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
#
|
|
121
|
-
#
|
|
122
|
-
#
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
#
|
|
133
|
-
|
|
134
|
-
#
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
#
|
|
138
|
-
#
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
#
|
|
142
|
-
#
|
|
143
|
-
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
148
|
-
|
|
149
|
-
#
|
|
150
|
-
|
|
151
|
-
#
|
|
152
|
-
#
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
#
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
#
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
#
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
#
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
#
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
#
|
|
189
|
-
#
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
#
|
|
193
|
-
#
|
|
194
|
-
#
|
|
195
|
-
#
|
|
196
|
-
#
|
|
197
|
-
|
|
198
|
-
#
|
|
199
|
-
|
|
200
|
-
#
|
|
201
|
-
#
|
|
202
|
-
#
|
|
203
|
-
|
|
204
|
-
#
|
|
205
|
-
#
|
|
206
|
-
#
|
|
207
|
-
#
|
|
208
|
-
|
|
209
|
-
#
|
|
210
|
-
#
|
|
211
|
-
#
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
#
|
|
215
|
-
#
|
|
216
|
-
#
|
|
217
|
-
|
|
218
|
-
#
|
|
219
|
-
#
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
#
|
|
224
|
-
|
|
225
|
-
#
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
#
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
#
|
|
235
|
-
|
|
236
|
-
#
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
#
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
#
|
|
244
|
-
#
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
#
|
|
248
|
-
#
|
|
249
|
-
#
|
|
250
|
-
#
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
#
|
|
254
|
-
#
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
#
|
|
258
|
-
#
|
|
259
|
-
#
|
|
260
|
-
#
|
|
261
|
-
#
|
|
262
|
-
|
|
263
|
-
#
|
|
264
|
-
#
|
|
265
|
-
#
|
|
266
|
-
|
|
267
|
-
#
|
|
268
|
-
#
|
|
269
|
-
#
|
|
1
|
+
# ===================================================================
|
|
2
|
+
# APPLICATION CONFIGURATION
|
|
3
|
+
# ===================================================================
|
|
4
|
+
#
|
|
5
|
+
# COOLIFY DEPLOYMENT NOTE:
|
|
6
|
+
# When adding environment variables in Coolify, do NOT check
|
|
7
|
+
# "Available at Buildtime" for any variable unless explicitly noted.
|
|
8
|
+
# The server Dockerfile handles build-time config internally.
|
|
9
|
+
# All variables below are RUNTIME-ONLY unless marked otherwise.
|
|
10
|
+
#
|
|
11
|
+
# ===================================================================
|
|
12
|
+
|
|
13
|
+
# Environment: development | production | test
|
|
14
|
+
# COOLIFY: Do NOT check "Available at Buildtime" — the Dockerfile
|
|
15
|
+
# sets NODE_ENV=development during build to ensure devDependencies install.
|
|
16
|
+
NODE_ENV=development
|
|
17
|
+
|
|
18
|
+
# Server port (default: 8000)
|
|
19
|
+
PORT=8000
|
|
20
|
+
|
|
21
|
+
# Server host (0.0.0.0 = listen on all interfaces)
|
|
22
|
+
HOST=0.0.0.0
|
|
23
|
+
|
|
24
|
+
# ===================================================================
|
|
25
|
+
# SERVER TIMEOUTS
|
|
26
|
+
# ===================================================================
|
|
27
|
+
|
|
28
|
+
# Fastify request timeout in milliseconds (default: 30000 = 30s)
|
|
29
|
+
# Long-running routes (LLM calls, big exports) may need 180000+ (180s).
|
|
30
|
+
# IMPORTANT: the reverse proxy (Nginx/Coolify) timeout must be raised to
|
|
31
|
+
# match, or the proxy cuts the connection before the server does.
|
|
32
|
+
REQUEST_TIMEOUT_MS=30000
|
|
33
|
+
|
|
34
|
+
# Fastify connection timeout in milliseconds (default: 60000 = 60s)
|
|
35
|
+
CONNECTION_TIMEOUT_MS=60000
|
|
36
|
+
|
|
37
|
+
# ===================================================================
|
|
38
|
+
# DATABASE CONFIGURATION (MySQL 8.4 LTS; 8.0+ works)
|
|
39
|
+
# ===================================================================
|
|
40
|
+
|
|
41
|
+
# Database connection string
|
|
42
|
+
# Format: mysql://username:password@host:port/database
|
|
43
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime".
|
|
44
|
+
DATABASE_URL="mysql://root:rootpassword@localhost:{{MYSQL_PORT}}/{{DATABASE_NAME}}"
|
|
45
|
+
|
|
46
|
+
# Connection pool: sized INSIDE DATABASE_URL, Prisma has no separate pool variables.
|
|
47
|
+
# Append ?connection_limit=N&pool_timeout=S to the URL, for example:
|
|
48
|
+
# DATABASE_URL="mysql://user:pass@host:3306/db?connection_limit=20&pool_timeout=10"
|
|
49
|
+
# Without connection_limit Prisma opens CPU cores x 2 + 1 connections per process.
|
|
50
|
+
# Keep the total of all app processes below MySQL's max_connections.
|
|
51
|
+
|
|
52
|
+
# ===================================================================
|
|
53
|
+
# REDIS CONFIGURATION
|
|
54
|
+
# ===================================================================
|
|
55
|
+
|
|
56
|
+
# Redis connection URL
|
|
57
|
+
# Format: redis://[:password@]host:port[/database]
|
|
58
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime".
|
|
59
|
+
REDIS_URL="redis://localhost:{{REDIS_PORT}}"
|
|
60
|
+
|
|
61
|
+
# Max retry attempts for failed Redis operations
|
|
62
|
+
REDIS_MAX_RETRIES=3
|
|
63
|
+
|
|
64
|
+
# Connection timeout in milliseconds
|
|
65
|
+
REDIS_CONNECT_TIMEOUT=10000
|
|
66
|
+
|
|
67
|
+
# ===================================================================
|
|
68
|
+
# RATE LIMITING
|
|
69
|
+
# ===================================================================
|
|
70
|
+
|
|
71
|
+
# Master switch to enable/disable rate limiting (default: true; only true or false accepted)
|
|
72
|
+
# Set to false in development to disable all rate limits
|
|
73
|
+
RATE_LIMIT_ENABLED=true
|
|
74
|
+
|
|
75
|
+
# Multiply all rate limit max values by this factor (default: 1)
|
|
76
|
+
# Set to 10 in development for 10x headroom, or 0.5 for tighter limits
|
|
77
|
+
RATE_LIMIT_MULTIPLIER=1
|
|
78
|
+
|
|
79
|
+
# Change any single limit: NAME=MAX/WINDOW, comma-separated, WINDOW like 30s, 15m, 1h.
|
|
80
|
+
# NAME = a key of RATE_LIMITS in src/config/rate-limit.config.ts, DEFAULT (every
|
|
81
|
+
# route without its own limit, 200/1m) or EMAIL_PER_ADDRESS (emails to one address,
|
|
82
|
+
# 3/1h). A typo stops the server at boot. The multiplier still applies on top.
|
|
83
|
+
# All limits, the lockout, the email cap and the auto-block: docs/rate-limits.md
|
|
84
|
+
# Example: RATE_LIMIT_OVERRIDES=AUTH_LOGIN=200/15m,DEFAULT=300/1m
|
|
85
|
+
RATE_LIMIT_OVERRIDES=
|
|
86
|
+
|
|
87
|
+
# Client IP: nothing to configure. The server trusts only its own proxy (Coolify's
|
|
88
|
+
# Traefik) and recognises Cloudflare by its published edge ranges, so rate limits and
|
|
89
|
+
# IP blocks see the real visitor both behind Cloudflare and without it. A leftover
|
|
90
|
+
# TRUST_CLOUDFLARE variable is ignored. See docs/client-ip-behind-proxies.md.
|
|
91
|
+
#
|
|
92
|
+
# Recommended behind Cloudflare: prove requests came through YOUR zone. Add a
|
|
93
|
+
# Cloudflare Transform Rule (Rules > Transform Rules > Modify Request Header) that
|
|
94
|
+
# sets the static header X-Origin-Verify to this value for the app's hostname. Then
|
|
95
|
+
# Cloudflare's visitor header is believed only on requests that carry it, so another
|
|
96
|
+
# Cloudflare customer's Worker cannot forge visitor addresses. Generate:
|
|
97
|
+
# openssl rand -hex 32
|
|
98
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime". Leave empty if unused.
|
|
99
|
+
CLOUDFLARE_ORIGIN_SECRET=
|
|
100
|
+
|
|
101
|
+
# ===================================================================
|
|
102
|
+
# IP AUTO-BLOCK
|
|
103
|
+
# ===================================================================
|
|
104
|
+
#
|
|
105
|
+
# An IP that exceeds rate limits IP_AUTO_BLOCK_THRESHOLD times within
|
|
106
|
+
# IP_AUTO_BLOCK_WINDOW_SECONDS is blocked for IP_AUTO_BLOCK_DURATION_SECONDS.
|
|
107
|
+
# The threshold targets SUSTAINED abuse — keep it high enough that a
|
|
108
|
+
# retry-looping legitimate client or a NAT'd office sharing one IP cannot
|
|
109
|
+
# self-ban. See src/config/rate-limit.config.ts for the interaction notes.
|
|
110
|
+
|
|
111
|
+
# Rate-limit violations before an IP is auto-blocked (default: 20)
|
|
112
|
+
IP_AUTO_BLOCK_THRESHOLD=20
|
|
113
|
+
|
|
114
|
+
# Sliding window for counting violations, in seconds (default: 300 = 5 min)
|
|
115
|
+
IP_AUTO_BLOCK_WINDOW_SECONDS=300
|
|
116
|
+
|
|
117
|
+
# How long an auto-blocked IP stays blocked, in seconds (default: 3600 = 1 hour)
|
|
118
|
+
IP_AUTO_BLOCK_DURATION_SECONDS=3600
|
|
119
|
+
|
|
120
|
+
# ===================================================================
|
|
121
|
+
# ACCOUNT ACTIVATION
|
|
122
|
+
# ===================================================================
|
|
123
|
+
|
|
124
|
+
# When true, new users must verify their email before they can sign in.
|
|
125
|
+
# When false (default), they can sign in right after registering.
|
|
126
|
+
# Turn it on only with the email-verification module, which provides the
|
|
127
|
+
# verify route (it switches this to true when added). Needs RESEND_API_KEY.
|
|
128
|
+
REQUIRE_USER_VERIFICATION=false
|
|
129
|
+
|
|
130
|
+
# ===================================================================
|
|
131
|
+
# FILE UPLOAD
|
|
132
|
+
# ===================================================================
|
|
133
|
+
|
|
134
|
+
# Maximum file upload size in MB (default: 10)
|
|
135
|
+
MAX_FILE_SIZE_MB=10
|
|
136
|
+
|
|
137
|
+
# Two-tier upload storage. BOTH optional — leave unset to use the defaults
|
|
138
|
+
# (<cwd>/uploads/public and <cwd>/uploads/private).
|
|
139
|
+
# PUBLIC tier: served as static files at /uploads/ — viewable by ANYONE,
|
|
140
|
+
# including unauthenticated users (e.g. avatars). @fastify/static
|
|
141
|
+
# is scoped to ONLY this dir so it can never serve a private file.
|
|
142
|
+
# PRIVATE tier: lives OUTSIDE the static root; served ONLY through the
|
|
143
|
+
# auth-gated, owner-scoped route GET /api/v1/files/:filename.
|
|
144
|
+
# Both must live UNDER the Coolify uploads volume (/app/uploads/...) so files
|
|
145
|
+
# survive redeploys — see COOLIFY PERSISTENT STORAGE below.
|
|
146
|
+
# UPLOAD_PUBLIC_DIR=/app/uploads/public
|
|
147
|
+
# UPLOAD_PRIVATE_DIR=/app/uploads/private
|
|
148
|
+
|
|
149
|
+
# COOLIFY PERSISTENT STORAGE (required for uploads to survive redeployments):
|
|
150
|
+
# Go to your service in Coolify → Storages → Add Volume Mount:
|
|
151
|
+
# Name: uploads (or <project-name>-uploads)
|
|
152
|
+
# Source Path: (leave empty — Coolify manages the Docker volume)
|
|
153
|
+
# Destination Path: /app/uploads
|
|
154
|
+
# Without this, all uploaded files are lost on every redeployment. The server
|
|
155
|
+
# logs a "[STORAGE] ... is not on a mounted volume" warning at boot when it
|
|
156
|
+
# runs in a production container without it.
|
|
157
|
+
|
|
158
|
+
# ===================================================================
|
|
159
|
+
# DOCKER PORTS — LOCAL DEVELOPMENT ONLY
|
|
160
|
+
# ===================================================================
|
|
161
|
+
#
|
|
162
|
+
# These ports are used by docker-compose to expose MySQL, Redis, and
|
|
163
|
+
# their admin UIs on your local machine. They are NOT needed in
|
|
164
|
+
# production — production connects via DATABASE_URL and REDIS_URL
|
|
165
|
+
# (typically over a private network), not through exposed ports.
|
|
166
|
+
#
|
|
167
|
+
# Change these if they conflict with other services on your machine.
|
|
168
|
+
|
|
169
|
+
MYSQL_PORT={{MYSQL_PORT}}
|
|
170
|
+
PHPMYADMIN_PORT={{PHPMYADMIN_PORT}}
|
|
171
|
+
REDIS_PORT={{REDIS_PORT}}
|
|
172
|
+
REDIS_COMMANDER_PORT={{REDIS_COMMANDER_PORT}}
|
|
173
|
+
|
|
174
|
+
# ===================================================================
|
|
175
|
+
# JWT AUTHENTICATION
|
|
176
|
+
# ===================================================================
|
|
177
|
+
|
|
178
|
+
# JWT secret key (MUST be at least 32 characters)
|
|
179
|
+
# CRITICAL: Generate a strong random secret for production!
|
|
180
|
+
# Example: openssl rand -base64 48
|
|
181
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime" — this is a secret!
|
|
182
|
+
JWT_SECRET="{{JWT_SECRET}}"
|
|
183
|
+
|
|
184
|
+
# Access token expiry (short-lived)
|
|
185
|
+
# Format: 1s, 1m, 1h, 1d (default: 15m)
|
|
186
|
+
JWT_ACCESS_EXPIRY="15m"
|
|
187
|
+
|
|
188
|
+
# Refresh token expiry (long-lived)
|
|
189
|
+
# Format: 1s, 1m, 1h, 1d (default: 7d)
|
|
190
|
+
JWT_REFRESH_EXPIRY="7d"
|
|
191
|
+
|
|
192
|
+
# Cookie signing secret (separate from JWT for defense-in-depth)
|
|
193
|
+
# Optional: defaults to JWT_SECRET if not set
|
|
194
|
+
# For production: generate a separate secret: openssl rand -hex 48
|
|
195
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime" — this is a secret!
|
|
196
|
+
# COOKIE_SECRET="CHANGE_ME_generate_with_openssl_rand_hex_48"
|
|
197
|
+
|
|
198
|
+
# Cookie domain when client and API run on sibling subdomains of one domain
|
|
199
|
+
# (the only split setup supported: the cookies stay SameSite Strict/Lax).
|
|
200
|
+
# REQUIRED when client and API are on different subdomains:
|
|
201
|
+
# Client: https://app.example.com | API: https://api.example.com
|
|
202
|
+
# → Set COOKIE_DOMAIN=".example.com" (note the leading dot)
|
|
203
|
+
# NOT needed when client and API share the same hostname (local dev, same-origin prod)
|
|
204
|
+
# It scopes ONLY the non-secret auth_session indicator, so the client's Next.js
|
|
205
|
+
# middleware can see that a session exists. The access/refresh token cookies stay
|
|
206
|
+
# host-only on the API (never shared with other subdomains).
|
|
207
|
+
# COOKIE_DOMAIN=".example.com"
|
|
208
|
+
|
|
209
|
+
# ===================================================================
|
|
210
|
+
# CORS (Cross-Origin Resource Sharing)
|
|
211
|
+
# ===================================================================
|
|
212
|
+
|
|
213
|
+
# Allowed origins for CORS
|
|
214
|
+
# Development: Optional (allows all origins for easier local dev)
|
|
215
|
+
# Production: REQUIRED (must be your frontend URL for security)
|
|
216
|
+
# Multiple origins: Separate with commas
|
|
217
|
+
# Bare origins only: scheme://host[:port], lowercase, no path, no trailing
|
|
218
|
+
# slash, no *. The server refuses anything else at boot and prints the fix.
|
|
219
|
+
# Examples:
|
|
220
|
+
# Single origin: CORS_ORIGIN="https://myapp.com"
|
|
221
|
+
# Multiple origins: CORS_ORIGIN="https://myapp.com,https://app.myapp.com"
|
|
222
|
+
# Local dev: CORS_ORIGIN="http://localhost:3001"
|
|
223
|
+
# CORS_ORIGIN="http://localhost:3001"
|
|
224
|
+
|
|
225
|
+
# ===================================================================
|
|
226
|
+
# EMAIL (Resend)
|
|
227
|
+
# ===================================================================
|
|
228
|
+
|
|
229
|
+
# Resend API key for transactional emails (password reset, verification, etc.)
|
|
230
|
+
# Get your API key from: https://resend.com/api-keys
|
|
231
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime" — this is a secret!
|
|
232
|
+
RESEND_API_KEY="re_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
233
|
+
|
|
234
|
+
# Sender email address
|
|
235
|
+
# Development: Use Resend's test address (onboarding@resend.dev) — delivers to your Resend dashboard
|
|
236
|
+
# Production: Use a verified domain email (e.g., noreply@yourdomain.com)
|
|
237
|
+
RESEND_FROM_EMAIL="onboarding@resend.dev"
|
|
238
|
+
|
|
239
|
+
# Frontend URL used to build links in emails (e.g., password reset links)
|
|
240
|
+
# Must match the URL where your Next.js client is running
|
|
241
|
+
CLIENT_URL="http://localhost:3000"
|
|
242
|
+
|
|
243
|
+
# ===================================================================
|
|
244
|
+
# LOGGING
|
|
245
|
+
# ===================================================================
|
|
246
|
+
|
|
247
|
+
# Log level: fatal | error | warn | info | debug | trace
|
|
248
|
+
# Production: info or warn (reduces noise)
|
|
249
|
+
# Development: debug (verbose logging)
|
|
250
|
+
# Staging: info
|
|
251
|
+
LOG_LEVEL=info
|
|
252
|
+
|
|
253
|
+
# ===================================================================
|
|
254
|
+
# DATABASE SEEDING (npm run prisma:seed — dev/test only)
|
|
255
|
+
# ===================================================================
|
|
256
|
+
|
|
257
|
+
# Passwords for the seeded demo accounts (admin@example.com / user@example.com).
|
|
258
|
+
# Optional in development — well-known dev defaults (Admin123! / User123!) are
|
|
259
|
+
# used when unset. The seed script REFUSES to run when NODE_ENV=production.
|
|
260
|
+
# SEED_ADMIN_PASSWORD="choose-a-dev-admin-password"
|
|
261
|
+
# SEED_USER_PASSWORD="choose-a-dev-user-password"
|
|
262
|
+
|
|
263
|
+
# ===================================================================
|
|
264
|
+
# ERROR TRACKING (Optional)
|
|
265
|
+
# ===================================================================
|
|
266
|
+
|
|
267
|
+
# Sentry DSN for error tracking and monitoring
|
|
268
|
+
# Get your DSN from: https://sentry.io/settings/projects/
|
|
269
|
+
# Leave empty to disable Sentry — with no DSN, init is a no-op (fully inert).
|
|
270
|
+
# COOLIFY: Runtime only. Do NOT check "Available at Buildtime".
|
|
271
|
+
# Example: SENTRY_DSN="https://examplePublicKey@o0.ingest.sentry.io/0"
|
|
272
|
+
# SENTRY_DSN=""
|
|
273
|
+
|
|
274
|
+
# Fraction of transactions sampled for performance tracing (0.0–1.0, default 0.1).
|
|
275
|
+
# Only takes effect when SENTRY_DSN is set.
|
|
276
|
+
# SENTRY_TRACES_SAMPLE_RATE=0.1
|
|
277
|
+
|
|
278
|
+
# Environment tag attached to Sentry events (e.g. production, staging).
|
|
279
|
+
# Defaults to NODE_ENV when unset.
|
|
280
|
+
# SENTRY_ENVIRONMENT=""
|