create-tigra 3.3.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 +72 -10
- 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 +44 -13
- 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 +35 -18
- 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 +13 -2
- package/template/client/src/features/auth/components/RegisterForm.tsx +23 -7
- package/template/client/src/features/auth/hooks/useAuth.ts +11 -1
- 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/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 +1 -1
- 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 +81 -0
- 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/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 -270
- package/template/server/.env.example.production +283 -242
- package/template/server/AGENTS.md +13 -4
- package/template/server/Dockerfile +176 -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 +0 -3
- 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 -346
- 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 -182
- package/template/server/src/config/rate-limit.config.ts +157 -106
- package/template/server/src/jobs/__tests__/cleanup-deleted-accounts.job.test.ts +60 -8
- 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 +38 -36
- 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 +98 -7
- 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 +53 -2
- 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 +38 -2
- 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 -80
- 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/auth.ts +39 -10
- 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 +53 -14
- 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 -221
- package/template/server/src/libs/logger.ts +41 -12
- package/template/server/src/libs/monitoring.ts +127 -41
- package/template/server/src/libs/observability/sentry.ts +1 -1
- 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 +27 -1
- 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 +59 -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 +94 -84
- package/template/server/src/libs/storage/file-validator.ts +48 -46
- package/template/server/src/libs/storage/image-optimizer.service.ts +16 -5
- 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 +49 -10
- 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 +66 -4
- 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 +197 -37
- 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 +44 -44
- package/template/server/src/modules/auth/auth.schemas.ts +4 -2
- package/template/server/src/modules/auth/auth.service.ts +167 -96
- package/template/server/src/modules/auth/session.repo.ts +12 -0
- 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 +23 -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 +3 -10
- 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
package/README.md
CHANGED
|
@@ -19,24 +19,26 @@ npx create-tigra my-app
|
|
|
19
19
|
| State | Redux Toolkit (auth), React Query v5 (server data) |
|
|
20
20
|
| Forms | React Hook Form + Zod validation |
|
|
21
21
|
| HTTP | Axios with httpOnly cookie auth + auto refresh |
|
|
22
|
-
| Auth UI | Login,
|
|
22
|
+
| Auth UI | Login, register and forgot-password form components (no pages: add your own `/login` and `/register` pages. The proxy, `src/proxy.ts`, sends signed-out visitors of `/dashboard`, `/profile` and `/admin` to `/login`) |
|
|
23
23
|
| Components | Header, Footer, Loading, Error, Empty states |
|
|
24
24
|
| Theme | Light/Dark mode with next-themes |
|
|
25
|
+
| Testing | Vitest unit tests of the client's logic: the API client's session rules (refresh, a lost refresh race between tabs, a ban mid-session), the proxy's CSP and redirects, redirect safety, error and field-error parsing; a coverage floor in CI |
|
|
25
26
|
|
|
26
27
|
### Server (Fastify 5)
|
|
27
28
|
|
|
28
29
|
| Feature | Technology |
|
|
29
30
|
|---|---|
|
|
30
31
|
| Framework | Fastify 5 with TypeScript (strict) |
|
|
31
|
-
| Database | MySQL 8.
|
|
32
|
+
| Database | MySQL 8.4 + Prisma 6 ORM |
|
|
32
33
|
| Cache | Redis 7 (ioredis) |
|
|
33
34
|
| Auth | JWT (httpOnly cookies), session management |
|
|
34
35
|
| Validation | Zod schemas on all inputs |
|
|
35
|
-
| Security | Helmet, CORS, rate limiting, password hashing (Argon2) |
|
|
36
|
+
| Security | Helmet, CORS, rate limiting (per route, per IP, set through ENV), login lockout, IP auto-block, password hashing (Argon2). If Redis goes down, the limits, lockout and blocks are off until it is back |
|
|
36
37
|
| File uploads | Multipart + Sharp image optimization |
|
|
37
38
|
| Logging | Pino with pretty dev output |
|
|
38
|
-
| Testing | Vitest
|
|
39
|
+
| Testing | Vitest: unit tests (no database needed) and integration tests of every route against a real MySQL and Redis (Testcontainers, or services you already run); a coverage ratchet; CI, a weekly dependency audit and Dependabot security updates for GitHub included |
|
|
39
40
|
| Dev tools | Docker Compose (MySQL, phpMyAdmin, Redis, Redis Commander) |
|
|
41
|
+
| Production images | Node 24 Alpine Dockerfiles (server and client) with sharp built on a pinned libvips, so they run on any x86-64 CPU, including VPSes without x86-64-v2, plus curl for Coolify's health check |
|
|
40
42
|
|
|
41
43
|
### Codex Development
|
|
42
44
|
|
|
@@ -46,7 +48,7 @@ The security workflow falls back to the bundled skill when Codex Security is una
|
|
|
46
48
|
|
|
47
49
|
## Prerequisites
|
|
48
50
|
|
|
49
|
-
- **Node.js** 22.12+
|
|
51
|
+
- **Node.js** 24+ with **npm** 11.19+ for the generated apps (the CLI itself runs on Node 22.12+). Early Node 24 releases ship an older npm 11 whose lockfiles the Docker images reject; check `npm -v` and update with `npm install -g npm@11`.
|
|
50
52
|
- **Docker** (for MySQL and Redis)
|
|
51
53
|
|
|
52
54
|
## After Scaffolding
|
|
@@ -57,25 +59,25 @@ cd my-app/server
|
|
|
57
59
|
docker compose up -d
|
|
58
60
|
|
|
59
61
|
# 2. Install server dependencies & set up database
|
|
60
|
-
npm
|
|
61
|
-
|
|
62
|
+
# (npm ci installs the shipped package-lock.json exactly, without rewriting it;
|
|
63
|
+
# the CLI already wrote server/.env and client/.env with fresh secrets, so do
|
|
64
|
+
# not copy .env.example over them: the server refuses its placeholder secret)
|
|
65
|
+
npm ci
|
|
62
66
|
npm run prisma:generate
|
|
63
|
-
npm run prisma:migrate:dev
|
|
67
|
+
npm run prisma:migrate:dev # creates the tables from the shipped 0_init migration
|
|
64
68
|
|
|
65
69
|
# 3. Start the server
|
|
66
70
|
npm run dev
|
|
67
71
|
|
|
68
72
|
# 4. In a new terminal, set up the client
|
|
69
73
|
cd my-app/client
|
|
70
|
-
npm
|
|
71
|
-
cp .env.example .env
|
|
74
|
+
npm ci
|
|
72
75
|
npm run dev
|
|
73
76
|
```
|
|
74
77
|
|
|
75
78
|
- Server: http://localhost:8000
|
|
76
79
|
- Client: http://localhost:3000
|
|
77
|
-
- phpMyAdmin
|
|
78
|
-
- Redis Commander: http://localhost:8081 (optional — see below)
|
|
80
|
+
- phpMyAdmin and Redis Commander (optional, see below): each project gets its own ports, so several projects can run side by side. The CLI prints them when it finishes; they are also in `server/docker-compose.yml`.
|
|
79
81
|
|
|
80
82
|
The admin UIs (phpMyAdmin, Redis Commander) are behind the docker-compose `tools` profile and do **not** start with plain `docker compose up -d`. Start them with:
|
|
81
83
|
|
|
@@ -84,9 +86,76 @@ cd my-app/server
|
|
|
84
86
|
docker compose --profile tools up -d
|
|
85
87
|
```
|
|
86
88
|
|
|
89
|
+
## Testing and CI
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cd my-app/server
|
|
93
|
+
npm test # unit tests: no database, no Docker
|
|
94
|
+
npm run test:coverage # the same, with the coverage ratchet (vitest.config.ts)
|
|
95
|
+
npm run test:integration # every route against a real MySQL + Redis
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The integration tests start a throwaway MySQL and Redis with Testcontainers (Docker must run). To use services you
|
|
99
|
+
already run instead, set `INTEGRATION_DATABASE_URL` (a database whose name ends in `_test`) and
|
|
100
|
+
`INTEGRATION_REDIS_URL` (a Redis database 1-15): the suite empties both first. Details and how to write new tests:
|
|
101
|
+
`server/docs/testing.md`.
|
|
102
|
+
|
|
103
|
+
New projects ship with GitHub workflows in `.github/`:
|
|
104
|
+
- `ci.yml`, on every push and pull request: typecheck, lint, unit tests with coverage, the server build, the
|
|
105
|
+
integration tests (Testcontainers on GitHub's runners) and the client build. It never deploys.
|
|
106
|
+
- `audit.yml`, weekly: `npm audit` of what production installs, red on a critical advisory. It does not block merges.
|
|
107
|
+
- `dependabot.yml`: security-update pull requests for npm packages and Actions (turn them on once in the
|
|
108
|
+
repository's Settings → Advanced Security → Dependabot security updates), and a monthly pull request that
|
|
109
|
+
refreshes the pinned `node:24-alpine` base image of both Dockerfiles (merge the two together).
|
|
110
|
+
|
|
111
|
+
## Deploying to Coolify
|
|
112
|
+
|
|
113
|
+
Server and client deploy as two separate Coolify applications, each from its own Dockerfile (`server/Dockerfile`, `client/Dockerfile`).
|
|
114
|
+
|
|
115
|
+
**Coolify checklist.** One Coolify project with two applications (from the same Git repository), a MySQL and a Redis:
|
|
116
|
+
|
|
117
|
+
| Setting | Server application | Client application |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| Build Pack | Dockerfile | Dockerfile |
|
|
120
|
+
| Base Directory | `/server` | `/client` |
|
|
121
|
+
| Ports Exposes | `8000` | `3000` |
|
|
122
|
+
| Domain | your API domain, e.g. `https://api.example.com` | your site, e.g. `https://example.com` |
|
|
123
|
+
| Health check | nothing to set: Coolify uses the Dockerfile's (`/api/v1/live`) | nothing to set: the Dockerfile's (`/healthz`) |
|
|
124
|
+
| Environment variables | from `server/.env.example.production`, runtime only: never tick "Available at Buildtime" | `NEXT_PUBLIC_API_BASE_URL` and `NEXT_PUBLIC_APP_NAME` with "Available at Buildtime" ticked: the build stops without the API address |
|
|
125
|
+
| Storage | a volume at `/app/uploads` (below) | none |
|
|
126
|
+
|
|
127
|
+
How the domains map to the variables:
|
|
128
|
+
- `NEXT_PUBLIC_API_BASE_URL` (client) = the API domain + `/api/v1`, e.g. `https://api.example.com/api/v1`.
|
|
129
|
+
- `CORS_ORIGIN` (server) = the site's origin exactly, e.g. `https://example.com` (no path, no trailing slash).
|
|
130
|
+
- `CLIENT_URL` (server) = the site's address, used in the links of emails.
|
|
131
|
+
- `COOKIE_DOMAIN` (server) = `.example.com` when site and API are sibling subdomains; unset when they share one host.
|
|
132
|
+
- `DATABASE_URL` and `REDIS_URL` (server) = the internal URLs shown on the MySQL and Redis pages in Coolify, with
|
|
133
|
+
`?connection_limit=5` on the database URL. A wrong database URL fails the deploy at its migration step, and
|
|
134
|
+
production refuses to start when it cannot reach Redis within 10 s.
|
|
135
|
+
|
|
136
|
+
Deploy the server first (it applies the migrations), then the client. Afterwards sign in as an admin and open
|
|
137
|
+
`/api/v1/admin/health`: every check should be up. Coolify switches traffic to a new container only once its Dockerfile
|
|
138
|
+
health check passes, so a container that cannot start keeps the old one serving. Migrations run while the old
|
|
139
|
+
container still serves; before one that drops or renames anything, read `server/docs/deployment.md` (in this repo:
|
|
140
|
+
[template/server/docs/deployment.md](template/server/docs/deployment.md)), which also explains why a build without
|
|
141
|
+
Docker's cache takes about 6 to 7 minutes longer (it compiles libvips).
|
|
142
|
+
|
|
143
|
+
**The server needs a persistent volume for uploads.** Avatars (and any other uploaded files) are written to `/app/uploads` inside the container, and every deploy starts a fresh container. Without a volume, all uploaded files are lost on each redeploy. In the server application: **Storages → Add Volume Mount**, leave *Source Path* empty (Coolify manages the volume), *Destination Path* `/app/uploads`. The server warns at boot (`[STORAGE] … is not on a mounted volume`) when it runs in production without one. Details: `server/.env.example.production`, section FILE UPLOAD.
|
|
144
|
+
|
|
145
|
+
**First admin.** Sign up in the app with the account that should be the admin (your own password; verify the email if the email module is on). Then open the server application's **Terminal** in Coolify and run `node dist/scripts/make-admin.js you@example.com`. It only changes that account's role and marks its email verified: no password is asked for or printed. Locally: `cd server && npm run make-admin -- you@example.com`. The same command recovers a project whose last admin was demoted or banned by mistake.
|
|
146
|
+
|
|
147
|
+
**Background jobs** run inside the server process, so no extra Coolify service is needed. Each first runs about a minute after the server starts, then on its own schedule:
|
|
148
|
+
- expired sessions and tokens: hourly;
|
|
149
|
+
- deleted accounts past their 30 days: daily;
|
|
150
|
+
- Cloudflare's IP list: daily.
|
|
151
|
+
|
|
152
|
+
A deploy never postpones them. With more than one server replica, each runs them too, which is safe.
|
|
153
|
+
|
|
87
154
|
## Security and Migration Notes
|
|
88
155
|
|
|
89
156
|
- [Account deactivation login reactivation: issue, fix, and existing-project migration](docs/account-deactivation-login-reactivation.md)
|
|
157
|
+
- [Client IP behind proxies and Cloudflare: how the visitor address is verified, and existing-project porting](docs/client-ip-behind-proxies.md)
|
|
158
|
+
- [Rate limits, login lockout, email cap and IP blocks: every limit, ENV overrides, Redis-down behaviour, and existing-project porting](template/server/docs/rate-limits.md)
|
|
90
159
|
|
|
91
160
|
## License
|
|
92
161
|
|