create-tigra 3.0.3 → 3.1.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 +8 -2
- package/bin/create-tigra.js +5 -19
- package/modules/email-verification/client/hooks/useVerification.ts +3 -3
- package/package.json +1 -1
- package/template/.agents/skills/security-audit/AI-AND-LLM.md +83 -0
- package/template/.agents/skills/security-audit/ATTACK-CLASSES.md +130 -0
- package/template/.agents/skills/security-audit/CLIENT-SIDE.md +83 -0
- package/template/.agents/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
- package/template/.agents/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
- package/template/.agents/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
- package/template/.agents/skills/security-audit/HUNTING.md +251 -0
- package/template/.agents/skills/security-audit/LICENSE +21 -0
- package/template/.agents/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
- package/template/.agents/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
- package/template/.agents/skills/security-audit/RECONNAISSANCE.md +156 -0
- package/template/.agents/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
- package/template/.agents/skills/security-audit/SKILL.md +192 -0
- package/template/.agents/skills/security-audit/SOURCE.md +5 -0
- package/template/.agents/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
- package/template/.agents/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
- package/template/.agents/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
- package/template/.agents/skills/security-audit/report-schema.json +461 -0
- package/template/.agents/skills/security-audit/validate-coverage-ledger.cjs +872 -0
- package/template/.agents/skills/security-audit/validate-coverage-ledger.test.cjs +740 -0
- package/template/.agents/skills/security-audit/validate-findings.cjs +773 -0
- package/template/.agents/skills/security-audit/validate-findings.test.cjs +652 -0
- package/template/AGENTS.md +45 -0
- package/template/client/AGENTS.md +22 -0
- package/template/client/Dockerfile +11 -1
- package/template/client/package-lock.json +410 -324
- package/template/client/package.json +4 -4
- package/template/client/scripts/next-dev.cjs +47 -0
- package/template/client/src/app/(auth)/layout.tsx +9 -0
- package/template/client/src/app/(auth)/loading.tsx +7 -0
- package/template/client/src/app/(main)/layout.tsx +11 -0
- package/template/client/src/app/(main)/loading.tsx +7 -0
- package/template/client/src/app/globals.css +4 -0
- package/template/client/src/app/loading.tsx +2 -6
- package/template/client/src/app/not-found.tsx +2 -3
- package/template/client/src/app/providers.tsx +6 -3
- package/template/client/src/components/common/AppLink.tsx +84 -0
- package/template/client/src/components/common/EmptyState.tsx +2 -2
- package/template/client/src/components/common/Pagination.tsx +3 -2
- package/template/client/src/components/common/RouteLoadingShell.tsx +21 -0
- package/template/client/src/components/common/SmoothNavigationProvider.tsx +151 -0
- package/template/client/src/components/layout/Header.tsx +12 -12
- package/template/client/src/features/admin/hooks/useAdminSessions.ts +2 -2
- package/template/client/src/features/admin/hooks/useAdminUsers.ts +3 -3
- package/template/client/src/features/auth/components/AuthInitializer.tsx +3 -2
- package/template/client/src/features/auth/components/LoginForm.tsx +3 -3
- package/template/client/src/features/auth/components/RegisterForm.tsx +3 -3
- package/template/client/src/features/auth/hooks/useAuth.ts +2 -2
- package/template/client/src/features/auth/hooks/usePasswordReset.ts +2 -2
- package/template/client/src/hooks/useAppRouter.ts +40 -0
- package/template/client/src/instrumentation-client.ts +29 -21
- package/template/client/src/instrumentation.ts +21 -17
- package/template/client/src/styles/themes/default.css +1 -1
- package/template/gitignore +0 -6
- package/template/server/AGENTS.md +28 -0
- package/template/server/Dockerfile +9 -3
- package/template/server/package-lock.json +671 -522
- package/template/server/package.json +8 -8
- package/template/server/src/modules/auth/__tests__/auth.service.test.ts +25 -41
- package/template/server/src/modules/auth/auth.repo.ts +0 -12
- package/template/server/src/modules/auth/auth.service.ts +29 -57
- package/template/_claude/QUICK_REFERENCE.md +0 -193
- package/template/_claude/README.md +0 -53
- package/template/_claude/commands/create-client.md +0 -878
- package/template/_claude/commands/create-server.md +0 -388
- package/template/_claude/hooks/restrict-paths.sh +0 -51
- package/template/_claude/rules/client/01-project-structure.md +0 -147
- package/template/_claude/rules/client/02-components-and-types.md +0 -146
- package/template/_claude/rules/client/03-data-and-state.md +0 -195
- package/template/_claude/rules/client/04-design-system.md +0 -408
- package/template/_claude/rules/client/05-security.md +0 -55
- package/template/_claude/rules/client/06-ux-checklist.md +0 -111
- package/template/_claude/rules/client/07-deployment.md +0 -99
- package/template/_claude/rules/client/08-lockfile-cross-platform.md +0 -79
- package/template/_claude/rules/client/core.md +0 -46
- package/template/_claude/rules/global/completion-reports.md +0 -178
- package/template/_claude/rules/global/core.md +0 -104
- package/template/_claude/rules/global/investigation-before-conclusions.md +0 -57
- package/template/_claude/rules/server/core.md +0 -52
- package/template/_claude/rules/server/database.md +0 -124
- package/template/_claude/rules/server/deployment.md +0 -78
- package/template/_claude/rules/server/project-conventions.md +0 -254
- package/template/_claude/rules/server/response-handling.md +0 -144
- package/template/_claude/settings.json +0 -15
- package/template/_claude/skills/clean-ui/SKILL.md +0 -63
- package/template/_claude/skills/role/SKILL.md +0 -39
- package/template/_claude/skills/theme/SKILL.md +0 -109
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply specifically to the **client** directory (Next.js App Router).
|
|
2
|
-
|
|
3
|
-
# Lockfile — Cross-Platform Regeneration
|
|
4
|
-
|
|
5
|
-
`client/package-lock.json` has burned us — and bots — multiple times in projects scaffolded from this template. Read this before touching it.
|
|
6
|
-
|
|
7
|
-
## The trap
|
|
8
|
-
|
|
9
|
-
`client/package-lock.json` is consumed by **three different environments**:
|
|
10
|
-
|
|
11
|
-
| Environment | OS / libc | npm |
|
|
12
|
-
|---|---|---|
|
|
13
|
-
| Local dev (most contributors) | Windows / macOS | npm 11.x |
|
|
14
|
-
| GitHub Actions CI (`server-ci.yml`, `client-ci.yml`) | `ubuntu-latest` (Debian glibc) | npm 10.x (ships with Node 20) |
|
|
15
|
-
| Coolify / production deploy (`client/Dockerfile`) | `node:20-alpine` (musl) | npm 10.x |
|
|
16
|
-
|
|
17
|
-
`npm ci` is **strict** — it refuses to install if the lockfile is even slightly out of sync with `package.json`, AND it only installs the platform-specific `optionalDependencies` whose top-level `node_modules/<pkg>` entries exist in the lockfile. If you regenerate on Windows with `npm install`, you get a Windows-leaning lockfile that:
|
|
18
|
-
|
|
19
|
-
1. May be missing entries the newer npm 10 (CI) considers required (`Missing: @swc/helpers@0.5.21 from lock file` — common failure mode).
|
|
20
|
-
2. Lacks `*-linux-x64-gnu` / `*-linuxmusl-x64` entries → CI's `next build` fails with `Cannot find module '../lightningcss.linux-x64-gnu.node'` or `No prebuild or local build of @parcel/watcher found.`
|
|
21
|
-
|
|
22
|
-
Affected native packages (Next 16 + Tailwind v4 dep tree): `@parcel/watcher`, `lightningcss`, `@img/sharp`, `@next/swc`, `@swc/core`, `@tailwindcss/oxide`, `@unrs/resolver-binding`, `@rolldown/binding`.
|
|
23
|
-
|
|
24
|
-
## Canonical fix (use this exactly)
|
|
25
|
-
|
|
26
|
-
Whenever you regenerate `client/package-lock.json` — even just because `package.json` changed by one dep — run **all three** steps. They are additive (`--package-lock-only` doesn't touch `node_modules`).
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
cd client
|
|
30
|
-
|
|
31
|
-
# 0. (Optional) Start fresh if the existing lockfile is already broken:
|
|
32
|
-
rm -rf node_modules package-lock.json
|
|
33
|
-
|
|
34
|
-
# 1. Sync the lockfile against package.json (fixes the "Missing: foo from lock file" class).
|
|
35
|
-
npx -y npm@10 install --package-lock-only
|
|
36
|
-
|
|
37
|
-
# 2. Add Linux/glibc native variants (GitHub Actions Ubuntu).
|
|
38
|
-
npx -y npm@10 install --os=linux --cpu=x64 --libc=glibc --package-lock-only
|
|
39
|
-
|
|
40
|
-
# 3. Add Linux/musl native variants (Coolify Alpine deploy).
|
|
41
|
-
npx -y npm@10 install --os=linux --cpu=x64 --libc=musl --package-lock-only
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Required choices
|
|
45
|
-
|
|
46
|
-
- **`npx -y npm@10` explicitly.** Local default npm 11.x resolves a tree npm 10 strict-checks reject. Match CI's npm version or you'll push a lockfile that fails immediately.
|
|
47
|
-
- **`--package-lock-only`** keeps each command at ~1 sec (no install, no audit).
|
|
48
|
-
- **Three platforms.** Even if you only intend to fix CI, do the musl pass too — Coolify deploy will fail otherwise.
|
|
49
|
-
- **Skip darwin** unless a team member dev's on macOS and reports `npm ci` failing. Not worth the lockfile churn pre-emptively.
|
|
50
|
-
|
|
51
|
-
## Verify before committing
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
cd client
|
|
55
|
-
|
|
56
|
-
# A. Strict install passes with CI's npm version (this is the exact check CI runs):
|
|
57
|
-
npx -y npm@10 ci --include=optional --no-audit --no-fund 2>&1 | tail -3
|
|
58
|
-
# Expect: "added N packages in Xs". Any "EUSAGE" / "Missing:" means step 1 didn't take.
|
|
59
|
-
|
|
60
|
-
# B. All native deps have glibc + musl entries:
|
|
61
|
-
for pkg in '@next/swc' '@swc/core' '@parcel/watcher' '@rolldown/binding' \
|
|
62
|
-
'@tailwindcss/oxide' '@unrs/resolver-binding' 'lightningcss'; do
|
|
63
|
-
g=$(grep -cE "node_modules/${pkg}.*-linux-x64-(gnu|glibc)\"" package-lock.json)
|
|
64
|
-
m=$(grep -cE "node_modules/${pkg}-linux-x64-musl\"" package-lock.json)
|
|
65
|
-
echo "$pkg glibc=$g musl=$m"
|
|
66
|
-
done
|
|
67
|
-
# Expect every line: glibc=1 musl=1. (sharp uses different naming — check separately:
|
|
68
|
-
# grep -oE 'node_modules/@img/sharp[-a-z0-9]*' package-lock.json | sort -u)
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
If either check fails, the lockfile is not ready — do not commit.
|
|
72
|
-
|
|
73
|
-
## Anti-patterns (don't do these — every one has burned us)
|
|
74
|
-
|
|
75
|
-
1. **Plain `npm install` on Windows/macOS.** Uses local npm 11; produces lockfiles CI rejects.
|
|
76
|
-
2. **Whack-a-mole pinning** in `package.json` `optionalDependencies` (e.g., adding only `@parcel/watcher-linux-x64-glibc` and hoping it fixes everything). It doesn't — there are 7+ such native deps and you'll bounce through them one CI failure at a time.
|
|
77
|
-
3. **Disabling `npm ci` in CI** by switching to `npm install` to "fix" the symptom. That makes builds non-reproducible.
|
|
78
|
-
4. **Bypassing the husky pre-commit hook** with `--no-verify` to push a broken lockfile fast.
|
|
79
|
-
5. **Generating inside Docker on a hung Docker daemon** without verifying the daemon is healthy first — the run silently buffers and you wait 10+ minutes. (The non-Docker `npx npm@10 install --package-lock-only` chain above is faster and equally correct.)
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply specifically to the **client** directory (Next.js App Router).
|
|
2
|
-
|
|
3
|
-
# Client Rules — Core Index
|
|
4
|
-
|
|
5
|
-
**Read only the file relevant to your current task.**
|
|
6
|
-
|
|
7
|
-
| You are doing... | Read this |
|
|
8
|
-
|---|---|
|
|
9
|
-
| Creating files, folders, feature modules | `01-project-structure.md` |
|
|
10
|
-
| Building components, writing types/interfaces | `02-components-and-types.md` |
|
|
11
|
-
| Fetching data, managing state, calling APIs, forms | `03-data-and-state.md` |
|
|
12
|
-
| Choosing colors, styling, typography, spacing, motion, **theme colors**, **font presets** | `04-design-system.md` |
|
|
13
|
-
| Auth tokens, env vars, security headers | `05-security.md` |
|
|
14
|
-
| UX psychology, cognitive load, a11y, performance | `06-ux-checklist.md` |
|
|
15
|
-
| Regenerating `client/package-lock.json`, fixing CI `npm ci` failures, cross-platform native binaries (`@parcel/watcher`, `lightningcss`, `@img/sharp`, etc.) | `08-lockfile-cross-platform.md` |
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Architecture
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
Page (Server Component — fetches data)
|
|
23
|
-
→ Feature Components (Server or Client)
|
|
24
|
-
→ UI (shadcn/ui + Tailwind)
|
|
25
|
-
|
|
26
|
-
State: Server data (SSR) → Server Components
|
|
27
|
-
Server data (client) → React Query
|
|
28
|
-
Global client state → Redux (auth only)
|
|
29
|
-
Local state → useState / useReducer
|
|
30
|
-
URL state → useSearchParams
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Non-negotiable rules
|
|
36
|
-
|
|
37
|
-
1. **Mobile-first**: All Tailwind classes start at mobile. Desktop is the enhancement (`md:`, `lg:`). Touch targets min 44x44px. No functionality behind hover-only states.
|
|
38
|
-
2. **Server Components by default.** Only add `'use client'` when you need hooks, state, or event handlers.
|
|
39
|
-
3. **Component limits**: Max 250 lines, max 5 props, max 3 JSX nesting levels.
|
|
40
|
-
4. **No hardcoded colors**: Use Tailwind semantic tokens (`bg-primary`, `text-foreground`). Never hardcode hex/rgb in components. **All color variables live in `src/styles/themes/default.css` using HEX values, NOT in `globals.css` or components.** Only edit the HEX values in `default.css` to customize the palette — never rename variables, change the file structure, or move color definitions elsewhere. The smooth transition system in `globals.css` and the variable naming are locked. Read `04-design-system.md` → "Theme System" for details.
|
|
41
|
-
5. **No hardcoded fonts**: Use Tailwind font classes (`font-sans`, `font-heading`, `font-mono`). Never hardcode `font-family` in components. **Font families are defined in font preset files (`src/styles/fonts/*.css`).** To change fonts, update the `next/font/google` imports in `layout.tsx` and the font preset file. Read `04-design-system.md` → "Font Preset System" for details.
|
|
42
|
-
6. **No inline styles**: Tailwind only. Use `cn()` for conditional classes.
|
|
43
|
-
7. **Import order**: React/Next → third-party → UI → local → hooks → services → types → utils.
|
|
44
|
-
8. **Forms**: Validate with Zod. Always validate client-side AND server-side.
|
|
45
|
-
9. **Security**: Never inject raw HTML without sanitization. Never prefix secrets with `NEXT_PUBLIC_`.
|
|
46
|
-
10. **Deployment**: Never remove `output: "standalone"` from `next.config.ts`. When adding `NEXT_PUBLIC_*` env vars, also add them as `ARG` + `ENV` in the Dockerfile builder stage. Read `07-deployment.md` for details.
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply to the **entire workspace** (server + client). Always active.
|
|
2
|
-
|
|
3
|
-
# Task Completion Reports
|
|
4
|
-
|
|
5
|
-
When you finish a task, phase, or multi-step implementation, you MUST provide a structured completion report. Freeform paragraphs like "Fixed issues and completed remaining tasks" are not acceptable. The report must give the user a clear, scannable picture of everything that changed, why, and what to do next.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## When to Report
|
|
10
|
-
|
|
11
|
-
| Situation | Report required? |
|
|
12
|
-
|-----------|-----------------|
|
|
13
|
-
| Completed a full task or feature | **Yes — Full Report** |
|
|
14
|
-
| Completed a phase in a multi-phase plan | **Yes — Phase Report** (subset of Full Report) |
|
|
15
|
-
| Fixed a bug | **Yes — Bug Fix Report** |
|
|
16
|
-
| Small config change, typo fix, single-file edit | **No** — a 1-2 sentence explanation is fine |
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Full Report Template
|
|
21
|
-
|
|
22
|
-
Use this structure after completing a feature or multi-phase task. Omit sections that don't apply (e.g., skip "Database Changes" if no migrations were created), but never omit "Files Changed" or "How to Test".
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
## Summary
|
|
26
|
-
[1-3 sentences: what was built/changed and why]
|
|
27
|
-
|
|
28
|
-
## Files Changed
|
|
29
|
-
|
|
30
|
-
### Created
|
|
31
|
-
- `path/to/file.ts` — [purpose: what this file does]
|
|
32
|
-
|
|
33
|
-
### Modified
|
|
34
|
-
- `path/to/file.ts` — [what changed and why]
|
|
35
|
-
|
|
36
|
-
### Deleted
|
|
37
|
-
- `path/to/file.ts` — [why it was removed]
|
|
38
|
-
|
|
39
|
-
## New API Endpoints (if applicable)
|
|
40
|
-
| Method | Path | Auth | Description |
|
|
41
|
-
|--------|------|------|-------------|
|
|
42
|
-
|
|
43
|
-
## Database Changes (if applicable)
|
|
44
|
-
- Migration: `YYYYMMDD_name` — [what it does]
|
|
45
|
-
- New tables: [list]
|
|
46
|
-
- Modified tables: [what changed]
|
|
47
|
-
- Indexes added: [list]
|
|
48
|
-
|
|
49
|
-
## Environment Variables (if applicable)
|
|
50
|
-
| Variable | Required | Where | Description |
|
|
51
|
-
|----------|----------|-------|-------------|
|
|
52
|
-
[Where = .env / .env.example / Dockerfile ARG / Coolify]
|
|
53
|
-
|
|
54
|
-
## Dependencies Added (if applicable)
|
|
55
|
-
| Package | Purpose |
|
|
56
|
-
|---------|---------|
|
|
57
|
-
- Note if any require system-level installs (apk add)
|
|
58
|
-
|
|
59
|
-
## Key Decisions & Trade-offs
|
|
60
|
-
[Explain non-obvious choices. Why was approach A chosen over B? What assumptions were made? What are the limitations?]
|
|
61
|
-
|
|
62
|
-
## Deployment & Production Impact (if applicable)
|
|
63
|
-
[This section is REQUIRED whenever changes affect deployment, infrastructure, or production behavior. Include ALL that apply:]
|
|
64
|
-
|
|
65
|
-
### Dockerfile Changes
|
|
66
|
-
- [New ARG/ENV added, new COPY lines, new apk packages, port changes, etc.]
|
|
67
|
-
|
|
68
|
-
### Environment / Coolify Configuration
|
|
69
|
-
- [New env vars that must be set in Coolify/hosting platform]
|
|
70
|
-
- [Build arguments that must be added]
|
|
71
|
-
- [Volume mounts needed]
|
|
72
|
-
|
|
73
|
-
### Database Migration Required
|
|
74
|
-
- [Migration name and what it does]
|
|
75
|
-
- [Must run `prisma migrate deploy` before/after deploying]
|
|
76
|
-
- [Any data migration or backfill needed]
|
|
77
|
-
|
|
78
|
-
### Infrastructure Changes
|
|
79
|
-
- [New external services required (Redis, S3, third-party APIs)]
|
|
80
|
-
- [DNS/domain changes needed]
|
|
81
|
-
- [SSL/certificate changes]
|
|
82
|
-
- [New cron jobs or background workers]
|
|
83
|
-
|
|
84
|
-
### Deployment Order
|
|
85
|
-
- [If server and client must be deployed in a specific order, state it]
|
|
86
|
-
- [If a migration must run before the new code deploys, state it]
|
|
87
|
-
|
|
88
|
-
### Rollback Plan
|
|
89
|
-
- [What happens if this deployment fails — is it safe to roll back?]
|
|
90
|
-
- [Are the database changes backwards-compatible with the previous code version?]
|
|
91
|
-
|
|
92
|
-
## Breaking Changes (if any)
|
|
93
|
-
- [What breaks, what to update, and how]
|
|
94
|
-
|
|
95
|
-
## Manual Steps Required
|
|
96
|
-
1. [Ordered list of things the user must do before this works]
|
|
97
|
-
- e.g., "Add GEMINI_API_KEY to .env"
|
|
98
|
-
- e.g., "Run npm run prisma:migrate dev"
|
|
99
|
-
|
|
100
|
-
## How to Test
|
|
101
|
-
1. [Step-by-step verification the user can follow]
|
|
102
|
-
- Be specific: exact commands, exact Postman steps, exact URLs
|
|
103
|
-
- Include expected responses where helpful
|
|
104
|
-
|
|
105
|
-
## Known Limitations / TODOs (if any)
|
|
106
|
-
- [Things not yet implemented, edge cases not handled, future improvements needed]
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Phase Report Template
|
|
112
|
-
|
|
113
|
-
Use this when completing one phase of a multi-phase plan. Shorter than a Full Report but still structured.
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
## Phase N Complete: [Phase Title]
|
|
117
|
-
|
|
118
|
-
### What was done
|
|
119
|
-
- [Bullet list of concrete changes]
|
|
120
|
-
|
|
121
|
-
### Files Changed
|
|
122
|
-
- `path/to/file.ts` — [what and why]
|
|
123
|
-
|
|
124
|
-
### Key Decisions
|
|
125
|
-
- [Any non-obvious choices made during this phase]
|
|
126
|
-
|
|
127
|
-
### Blockers or Concerns
|
|
128
|
-
- [Anything that might affect subsequent phases]
|
|
129
|
-
|
|
130
|
-
### Phase Status
|
|
131
|
-
- [x] Phase N complete
|
|
132
|
-
- [ ] Phase N+1: [title] — next
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Bug Fix Report Template
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
## Bug Fix: [Short description]
|
|
141
|
-
|
|
142
|
-
### Root Cause
|
|
143
|
-
[What was actually wrong — not just the symptom, but the underlying cause]
|
|
144
|
-
|
|
145
|
-
### Fix Applied
|
|
146
|
-
- `path/to/file.ts` — [what changed]
|
|
147
|
-
|
|
148
|
-
### Why This Fix
|
|
149
|
-
[Why this approach was chosen. What other approaches were considered and rejected.]
|
|
150
|
-
|
|
151
|
-
### How to Verify
|
|
152
|
-
1. [Steps to confirm the fix works]
|
|
153
|
-
|
|
154
|
-
### Regression Risk
|
|
155
|
-
- [Could this fix break anything else? What was checked?]
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Rules
|
|
161
|
-
|
|
162
|
-
1. **Structure over prose.** Use the templates above. Tables, bullet points, and headers — not paragraphs.
|
|
163
|
-
2. **Every file gets a "why".** Don't just list `file.ts` — explain what changed and why. "Added creditBalance: 0 to mocks" → "Added `creditBalance: 0` to user mocks in `setup.ts` because the new credits module added this required field to the User model, and existing test fixtures would fail validation without it."
|
|
164
|
-
3. **Be specific in "How to Test".** Not "use Postman to test." Instead: "1. POST `{{baseUrl}}/auth/login` with test credentials. 2. POST `{{baseUrl}}/generations` with body `{ templateId: '...', image: <file> }`. 3. Expected: 201 with `{ success: true, data: { id, status: 'pending' } }`."
|
|
165
|
-
4. **Explain decisions, not just actions.** "Used upsert for seed data" → "Used `upsert` instead of `create` for seed data so the seed script is idempotent — running it twice won't throw duplicate key errors."
|
|
166
|
-
5. **Surface what the user needs to do.** If the user must add an env var, run a migration, install something, or restart a service — put it in "Manual Steps Required" prominently. Don't bury it in a paragraph.
|
|
167
|
-
6. **Honest about limitations.** If something is incomplete, has edge cases, or needs future work — say so in "Known Limitations." Don't pretend everything is perfect.
|
|
168
|
-
7. **Scale to the task.** A 5-phase feature gets a full report with every section. A single service method gets a shorter report. Use judgment, but always use the structured format.
|
|
169
|
-
8. **Deployment impact is never optional.** If ANY of the following changed, the "Deployment & Production Impact" section is REQUIRED — no exceptions:
|
|
170
|
-
- New or modified environment variables
|
|
171
|
-
- New npm packages with native dependencies
|
|
172
|
-
- Database schema changes (new tables, columns, indexes)
|
|
173
|
-
- Dockerfile modifications needed
|
|
174
|
-
- New external service dependencies (APIs, Redis, S3, etc.)
|
|
175
|
-
- Port, entry point, or health check changes
|
|
176
|
-
- File upload/storage changes requiring volume mounts
|
|
177
|
-
- Changes to build process or build arguments
|
|
178
|
-
If none of these apply, explicitly state: "No deployment impact — no infrastructure, env, or database changes."
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply to the **entire workspace** (server + client). Always active.
|
|
2
|
-
|
|
3
|
-
# Global Rules
|
|
4
|
-
|
|
5
|
-
These rules are always in effect regardless of which directory you are working in.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## New Project Setup
|
|
10
|
-
|
|
11
|
-
When the user asks to create, scaffold, or start a new server or client project, **always run `/create-server` or `/create-client` first** before writing any code. These commands contain the full scaffolding templates, dependency lists, and boilerplate that match our architecture. Do not attempt to scaffold a project from memory.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Safe Editing
|
|
16
|
-
|
|
17
|
-
1. **Small, focused changes**: Only modify what's necessary. Don't restructure code unless asked.
|
|
18
|
-
2. **Preserve signatures**: Don't change existing function signatures, exports, or imports unless explicitly requested.
|
|
19
|
-
3. **Extend, don't rewrite**: Add to existing modules. Don't gut and rebuild.
|
|
20
|
-
4. **Protect critical flows**: Never break existing auth, core business flows, or payment logic.
|
|
21
|
-
5. **No half-done work**: If something is incomplete, add a `// TODO:` with explanation.
|
|
22
|
-
6. **No noisy logs**: No debug logs in production code. Mark temporary ones with `// TODO: remove debug log`.
|
|
23
|
-
7. **Call out breaking changes**: If a breaking change is unavoidable, state it clearly in your explanation.
|
|
24
|
-
8. **Assume production**: Treat this as a real production project. Avoid destructive or experimental changes.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## TypeScript
|
|
29
|
-
|
|
30
|
-
- **Strict mode ON** in both client and server. No exceptions.
|
|
31
|
-
- **No `any`** — use `unknown` if the type is truly unknown.
|
|
32
|
-
- **Explicit return types** on all functions.
|
|
33
|
-
- **Always `import type`** for type-only imports.
|
|
34
|
-
- **Validate all inputs with Zod** — client-side for UX, server-side for security.
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Git & Branching
|
|
39
|
-
|
|
40
|
-
- **Branch naming**: `feature/<name>`, `fix/<name>`, `chore/<name>`, `hotfix/<name>`.
|
|
41
|
-
- **Commit messages**: Use conventional commits — `feat:`, `fix:`, `chore:`, `refactor:`, `docs:`, `test:`.
|
|
42
|
-
- Keep the subject line under 72 characters.
|
|
43
|
-
- Use imperative mood: "Add search filter" not "Added search filter".
|
|
44
|
-
- **Never commit**: `.env` files, secrets, `node_modules`, build artifacts, OS files (`.DS_Store`, `Thumbs.db`).
|
|
45
|
-
- **One logical change per commit**. Don't mix unrelated changes.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## Environment & Configuration
|
|
50
|
-
|
|
51
|
-
- **`.env` files are never committed.** Use `.env.example` as the template with placeholder values.
|
|
52
|
-
- **Adding a new env var**: Add it to `.env.example` with a comment, and document where it's used.
|
|
53
|
-
- **Keep `.env` and `.env.example` in sync**: Any change to `.env` (adding, removing, or renaming a variable) must be reflected in `.env.example`, and vice versa. They must always have the same set of variables.
|
|
54
|
-
- **Keep `.env.example.production` in sync**: Every time `.env` or `.env.example` changes (variable added, removed, or renamed), also update `.env.example.production` in the same directory. If the file does not exist, create it. This file uses the same variable names but with **production-appropriate placeholder values** and comments (e.g., secure passwords, real domain URLs, SSL-enabled connection strings, stricter timeouts). See the server's `.env.example.production` for the expected style. This applies to both `server/` and `client/` directories.
|
|
55
|
-
- **Secrets** (DB URLs, JWT secrets, API keys) must never be prefixed with `NEXT_PUBLIC_` and must never appear in client-side code.
|
|
56
|
-
- **Public values only** (API base URL, app name) get the `NEXT_PUBLIC_` prefix.
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## Testing
|
|
61
|
-
|
|
62
|
-
- **New features and bug fixes should include tests** unless the change is trivial (copy, config, styling).
|
|
63
|
-
- **Test naming**: `describe('<ModuleName>')` → `it('should <expected behavior>')`.
|
|
64
|
-
- **Tests must be deterministic**: No reliance on real time, network, or random values. Mock external dependencies.
|
|
65
|
-
- **Don't test implementation details** — test behavior and outputs.
|
|
66
|
-
- **No "mock-echo" tests**: Don't mock a dependency (Prisma/ORM, HTTP client) and then only assert it was called with the same arguments the code passes straight through — that restates the implementation and verifies no behavior. A "was-called-with" assertion is valid only when the layer *transformed* the input first (filtering, pagination math, conditional queries) or when you ALSO assert on the returned value / observable result.
|
|
67
|
-
- **Don't test logic-free layers**: If a unit only forwards to a dependency with no logic of its own (a thin repository/passthrough), don't test it — put the test on the service/behavior layer, where the branches and bugs are.
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## Deployment Awareness
|
|
72
|
-
|
|
73
|
-
Both server and client are deployed via **Docker on Coolify**. The `Dockerfile` in each directory is the production deployment contract. Code changes must never silently break the Docker build.
|
|
74
|
-
|
|
75
|
-
**Always check deployment impact when you:**
|
|
76
|
-
- Add a native/system npm dependency (needs `apk add` in Dockerfile)
|
|
77
|
-
- Add, remove, or rename a `NEXT_PUBLIC_*` env var (needs `ARG` + `ENV` in client Dockerfile)
|
|
78
|
-
- Change the build output directory, entry point file, or default port
|
|
79
|
-
- Add runtime file dependencies (templates, static assets not in `public/`)
|
|
80
|
-
- Change or remove a health check endpoint
|
|
81
|
-
|
|
82
|
-
**See the deployment rules** in `server/deployment.md` and `client/07-deployment.md` for full details.
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## Task Completion Reports
|
|
87
|
-
|
|
88
|
-
After completing any task, phase, or bug fix, you MUST provide a structured completion report — not freeform paragraphs. **Read `completion-reports.md`** for the required templates and rules. This includes deployment/production impact analysis whenever infrastructure, env vars, database, or Docker changes are involved.
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Code Review Checklist
|
|
93
|
-
|
|
94
|
-
Before considering work done, verify:
|
|
95
|
-
|
|
96
|
-
- [ ] No `any` types.
|
|
97
|
-
- [ ] No hardcoded values (URLs, colors, magic numbers) — use constants and tokens.
|
|
98
|
-
- [ ] No `console.log` left in code.
|
|
99
|
-
- [ ] No commented-out code without a `// TODO:` explaining why.
|
|
100
|
-
- [ ] Inputs validated with Zod.
|
|
101
|
-
- [ ] Error cases handled (not just the happy path).
|
|
102
|
-
- [ ] Existing tests still pass.
|
|
103
|
-
- [ ] No "mock-echo" tests (asserting only that a mock was called, without asserting behavior/output or testing a real transform).
|
|
104
|
-
- [ ] Dockerfile still compatible with changes (see Deployment Awareness above).
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply to the **entire workspace** (server + client). Always active.
|
|
2
|
-
|
|
3
|
-
# Investigation Before Conclusions
|
|
4
|
-
|
|
5
|
-
This project (create-tigra) generates starter templates for developers who may not have deep coding experience. They trust AI output without questioning it. **A wrong suggestion that "fixes" a non-existent problem can introduce real problems.** Every recommendation must be grounded in verified understanding of how the code actually works.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## The Rule
|
|
10
|
-
|
|
11
|
-
**Never suggest fixes, changes, or improvements until you have fully traced how the relevant system works in this codebase.** Seeing a file, a config, or a pattern is not enough. You must follow the code path end-to-end before making any claim.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Before Answering "Is This a Bug?" or "Does This Need Fixing?"
|
|
16
|
-
|
|
17
|
-
1. **Trace the actual workflow.** If the question is about uploads, go read the upload service, follow where files are saved, how they're served, how they're deleted. If it's about auth, trace the full auth flow. Don't stop at the first file you find.
|
|
18
|
-
|
|
19
|
-
2. **Understand the runtime environment.** Ask yourself: does this code run in Docker or locally? Is this a dev tool or a production path? Does docker-compose run the server or just infrastructure services (MySQL, Redis)? Don't assume — verify.
|
|
20
|
-
|
|
21
|
-
3. **Verify the problem exists in the real workflow.** Not in theory, not in a hypothetical scenario — in the actual way developers use this project. If no one would ever hit the issue in normal usage, it's not a problem worth fixing.
|
|
22
|
-
|
|
23
|
-
4. **Don't pattern-match to conclusions.** "Uploads + Docker + no volume = must fix" is pattern-matching, not investigation. The server runs locally with `npm run dev`, not inside Docker. The `docker-compose.yml` is for MySQL and Redis only. A volume for uploads in docker-compose would solve nothing.
|
|
24
|
-
|
|
25
|
-
5. **If you're unsure, say so.** "I need to check how this works before I can answer" is always better than a confident wrong answer.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## What NOT to Do
|
|
30
|
-
|
|
31
|
-
| Bad behavior | Why it's dangerous |
|
|
32
|
-
|---|---|
|
|
33
|
-
| See a Dockerfile, immediately suggest `VOLUME` | The server may not run in Docker locally |
|
|
34
|
-
| See docker-compose.yml, suggest adding volumes | docker-compose may only run infrastructure, not the app |
|
|
35
|
-
| Find a missing config and assume it's a bug | It may be intentionally absent because it's not needed |
|
|
36
|
-
| Suggest "best practice" improvements unprompted | Unnecessary changes confuse beginners and can introduce real bugs |
|
|
37
|
-
| Stop researching after finding the first related file | The first file is not the full picture — trace the complete flow |
|
|
38
|
-
| Offer a fix before confirming the problem is real | Fixing non-existent problems wastes time and creates new problems |
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## The Standard
|
|
43
|
-
|
|
44
|
-
Before every suggestion, ask yourself:
|
|
45
|
-
|
|
46
|
-
1. **Did I trace the full code path?** Not just one file — the whole flow.
|
|
47
|
-
2. **Do I understand the runtime environment?** Where does this code actually run?
|
|
48
|
-
3. **Would a real developer actually hit this problem?** In normal usage, not edge cases.
|
|
49
|
-
4. **Am I solving a real problem or a theoretical one?**
|
|
50
|
-
|
|
51
|
-
If the answer to any of these is "no" — keep investigating before responding.
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
## Why This Matters
|
|
56
|
-
|
|
57
|
-
create-tigra exists to help developers who are learning to code with AI assistance. These developers will trust your suggestions without pushback. A confident but wrong suggestion — like adding a Docker volume for a service that doesn't run in Docker — will send them down a rabbit hole debugging something that was never broken. **Your job is to understand what actually works and why, not to guess based on patterns.**
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply specifically to the **server** directory (Fastify backend).
|
|
2
|
-
|
|
3
|
-
# Server Rules — Core Index
|
|
4
|
-
|
|
5
|
-
**Do NOT read every rule file upfront.** Use this index to find the right rules for your current task.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## When to read which file
|
|
10
|
-
|
|
11
|
-
| You are doing... | Read this |
|
|
12
|
-
|------------------|-----------|
|
|
13
|
-
| Setting up a module, organizing code, understanding the stack | `project-conventions.md` |
|
|
14
|
-
| Creating or modifying a route / controller | `project-conventions.md` + `response-handling.md` |
|
|
15
|
-
| Returning data (success, error, or paginated) | `response-handling.md` |
|
|
16
|
-
| Handling or throwing errors | `response-handling.md` |
|
|
17
|
-
| Writing service or business logic | `project-conventions.md` (Layer Responsibilities) |
|
|
18
|
-
| Changing DB schema, migrations, indexes | `database.md` |
|
|
19
|
-
| Adding or changing API endpoints | `project-conventions.md` (Postman Collection) |
|
|
20
|
-
| Adding dependencies, changing ports, entry points, or env vars | `deployment.md` |
|
|
21
|
-
| Unsure where to start | This file |
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Architecture at a glance
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
Request
|
|
29
|
-
-> Route (Fastify plugin, defines HTTP method + path)
|
|
30
|
-
-> Controller (validates input with Zod, calls service, returns response)
|
|
31
|
-
-> Service (business logic, throws typed errors)
|
|
32
|
-
-> Repository (Prisma queries, returns raw data)
|
|
33
|
-
-> Database
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Three strict boundaries:**
|
|
37
|
-
1. **Controllers** — parse input, call services, format responses. No business logic. No direct DB access.
|
|
38
|
-
2. **Services** — all business logic. No Fastify concepts (request, reply). Throw typed `AppError` instances.
|
|
39
|
-
3. **Repositories** — Prisma queries only. No business logic. No error formatting.
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Non-negotiable rules (always apply)
|
|
44
|
-
|
|
45
|
-
1. **Response format**: All controllers use `successResponse()` / `paginatedResponse()`. No custom shapes.
|
|
46
|
-
2. **Error handling**: Only throw `AppError` subclasses. Never raw `Error` or strings. Global error handler formats all errors.
|
|
47
|
-
3. **Validation**: All input validated with Zod schemas before reaching services.
|
|
48
|
-
4. **Database changes**: Always via Prisma migrations. Never raw DDL.
|
|
49
|
-
5. **Logging**: Use `logger` from `src/libs/logger`. Never `console.log`.
|
|
50
|
-
6. **Routes**: All prefixed with `/api/v1`. Registered as Fastify plugins.
|
|
51
|
-
7. **Postman**: Every new or modified endpoint must be reflected in `postman/collection.json`. Create the collection if it doesn't exist.
|
|
52
|
-
8. **Deployment**: Every change must remain compatible with the Dockerfile. Read `deployment.md` when adding system dependencies, changing ports, renaming entry points, or adding env vars.
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
> **SCOPE**: These rules apply specifically to the **server** directory.
|
|
2
|
-
|
|
3
|
-
# Database & Migrations
|
|
4
|
-
|
|
5
|
-
## Principles
|
|
6
|
-
|
|
7
|
-
- **Database**: MySQL 8.0+
|
|
8
|
-
- **ORM**: Prisma 6.x (do NOT upgrade to 7.x without testing)
|
|
9
|
-
- **Schema source of truth**: `prisma/schema.prisma`
|
|
10
|
-
- **Dev**: Fast iteration with resets. **Prod**: Safe, forward-only migrations.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Critical Rules
|
|
15
|
-
|
|
16
|
-
| Rule | Detail |
|
|
17
|
-
|------|--------|
|
|
18
|
-
| Schema changes | Prisma migrations ONLY. Never raw DDL. Data changes (INSERT/UPDATE/DELETE) can be raw SQL. |
|
|
19
|
-
| Dev conflicts | Don't fix migration files manually. Run `prisma:reset` then `prisma:seed`. |
|
|
20
|
-
| `db push` | Prototyping only. NEVER in production. |
|
|
21
|
-
| `prisma:reset` | Freely in dev. NEVER in production. |
|
|
22
|
-
| Production deploys | ONLY `prisma:migrate deploy`. Never reset, never manual edits. |
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Naming Conventions
|
|
27
|
-
|
|
28
|
-
| Entity | Format | Example |
|
|
29
|
-
|--------|--------|---------|
|
|
30
|
-
| Tables | `snake_case` plural | `users`, `order_items` |
|
|
31
|
-
| Columns | `snake_case` | `user_id`, `created_at` |
|
|
32
|
-
| Foreign keys | `<table_singular>_id` | `user_id`, `category_id` |
|
|
33
|
-
| Prisma models | `PascalCase` singular | `User`, `OrderItem` |
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## Required Fields
|
|
38
|
-
|
|
39
|
-
Every main entity table MUST have:
|
|
40
|
-
```prisma
|
|
41
|
-
model EntityName {
|
|
42
|
-
id String @id @default(uuid())
|
|
43
|
-
createdAt DateTime @default(now())
|
|
44
|
-
updatedAt DateTime @updatedAt
|
|
45
|
-
// Optional:
|
|
46
|
-
deletedAt DateTime? // Soft deletes (prefer for user content)
|
|
47
|
-
isActive Boolean @default(true) // Disable without deleting
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Relationships
|
|
54
|
-
|
|
55
|
-
- Use proper foreign keys with `onDelete: Cascade` for dependent data
|
|
56
|
-
- Explicit junction tables for many-to-many (not implicit)
|
|
57
|
-
- Normalize shared lookup data into own tables (no duplicated strings)
|
|
58
|
-
- Polymorphic attachments: use `entityType` + `entityId` with `@@index([entityType, entityId])`
|
|
59
|
-
- **Column renames**: Two-step migration — add new column, migrate data, then drop old column. Renaming directly DROPS data.
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Indexing
|
|
64
|
-
|
|
65
|
-
**Always index:** foreign keys, filter columns (WHERE clauses), composite filters, unique constraints.
|
|
66
|
-
|
|
67
|
-
**Never index:** low-cardinality booleans alone, text/blob columns, fields not used in WHERE/ORDER BY.
|
|
68
|
-
|
|
69
|
-
```prisma
|
|
70
|
-
@@index([userId]) // Foreign key
|
|
71
|
-
@@index([categoryId, isActive]) // Composite filter
|
|
72
|
-
@@unique([email]) // Unique constraint
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Migration Workflow
|
|
78
|
-
|
|
79
|
-
1. Edit `prisma/schema.prisma`
|
|
80
|
-
2. Run: `npm run prisma:migrate dev --name descriptive_name`
|
|
81
|
-
3. If conflict: `npm run prisma:reset` then `npm run prisma:seed`
|
|
82
|
-
4. Verify generated SQL and use `prisma:studio` to inspect
|
|
83
|
-
|
|
84
|
-
**Adding NOT NULL column**: Must provide a default value or make it optional, otherwise Prisma will error.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## Production Deployment
|
|
89
|
-
|
|
90
|
-
**Pre-deploy**: All migrations tested locally, seed runs, migration files committed to git.
|
|
91
|
-
|
|
92
|
-
```bash
|
|
93
|
-
npm run prisma:migrate deploy # Apply pending migrations (safe)
|
|
94
|
-
npm run prisma:generate # Regenerate client
|
|
95
|
-
npm start # Restart application
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Troubleshooting
|
|
101
|
-
|
|
102
|
-
| Symptom | Fix |
|
|
103
|
-
|---------|-----|
|
|
104
|
-
| `DATABASE_URL` not found | Verify `.env` exists with valid `DATABASE_URL`. If Prisma 7 issue, downgrade to v6. |
|
|
105
|
-
| "Table already exists" | `npm run prisma:reset` (dev only) |
|
|
106
|
-
| "Prisma Client is not generated" | `npm run prisma:generate` |
|
|
107
|
-
| Slow queries | Add missing indexes via schema, use `EXPLAIN`, use `select` to limit fields |
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Commands Reference
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
# Development
|
|
115
|
-
npm run prisma:studio # Visual DB browser
|
|
116
|
-
npm run prisma:migrate dev # Create migration
|
|
117
|
-
npm run prisma:reset # Drop all, rerun migrations
|
|
118
|
-
npm run prisma:seed # Repopulate test data
|
|
119
|
-
npm run prisma:generate # Regenerate client
|
|
120
|
-
|
|
121
|
-
# Production
|
|
122
|
-
npm run prisma:migrate deploy # Apply migrations (safe)
|
|
123
|
-
npm run prisma:generate # Regenerate client
|
|
124
|
-
```
|