@amirulabu/create-recurring-rabbit-app 0.0.0-alpha
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/bin/index.js +2 -0
- package/dist/index.js +592 -0
- package/package.json +43 -0
- package/templates/default/.editorconfig +21 -0
- package/templates/default/.env.example +15 -0
- package/templates/default/.eslintrc.json +35 -0
- package/templates/default/.prettierrc.json +7 -0
- package/templates/default/README.md +346 -0
- package/templates/default/app.config.ts +20 -0
- package/templates/default/docs/adding-features.md +439 -0
- package/templates/default/docs/adr/001-use-sqlite-for-development-database.md +22 -0
- package/templates/default/docs/adr/002-use-tanstack-start-over-nextjs.md +22 -0
- package/templates/default/docs/adr/003-use-better-auth-over-nextauth.md +22 -0
- package/templates/default/docs/adr/004-use-drizzle-over-prisma.md +22 -0
- package/templates/default/docs/adr/005-use-trpc-for-api-layer.md +22 -0
- package/templates/default/docs/adr/006-use-tailwind-css-v4-with-shadcn-ui.md +22 -0
- package/templates/default/docs/architecture.md +241 -0
- package/templates/default/docs/database.md +376 -0
- package/templates/default/docs/deployment.md +435 -0
- package/templates/default/docs/troubleshooting.md +668 -0
- package/templates/default/drizzle/migrations/0001_initial_schema.sql +39 -0
- package/templates/default/drizzle/migrations/meta/0001_snapshot.json +225 -0
- package/templates/default/drizzle/migrations/meta/_journal.json +12 -0
- package/templates/default/drizzle.config.ts +10 -0
- package/templates/default/lighthouserc.json +78 -0
- package/templates/default/src/app/__root.tsx +32 -0
- package/templates/default/src/app/api/auth/$.ts +15 -0
- package/templates/default/src/app/api/trpc.server.ts +12 -0
- package/templates/default/src/app/auth/forgot-password.tsx +107 -0
- package/templates/default/src/app/auth/login.tsx +34 -0
- package/templates/default/src/app/auth/register.tsx +34 -0
- package/templates/default/src/app/auth/reset-password.tsx +171 -0
- package/templates/default/src/app/auth/verify-email.tsx +111 -0
- package/templates/default/src/app/dashboard/index.tsx +122 -0
- package/templates/default/src/app/dashboard/settings.tsx +161 -0
- package/templates/default/src/app/globals.css +55 -0
- package/templates/default/src/app/index.tsx +83 -0
- package/templates/default/src/components/features/auth/login-form.tsx +172 -0
- package/templates/default/src/components/features/auth/register-form.tsx +202 -0
- package/templates/default/src/components/layout/dashboard-layout.tsx +27 -0
- package/templates/default/src/components/layout/header.tsx +29 -0
- package/templates/default/src/components/layout/sidebar.tsx +38 -0
- package/templates/default/src/components/ui/button.tsx +57 -0
- package/templates/default/src/components/ui/card.tsx +79 -0
- package/templates/default/src/components/ui/input.tsx +24 -0
- package/templates/default/src/lib/api.ts +42 -0
- package/templates/default/src/lib/auth.ts +292 -0
- package/templates/default/src/lib/email.ts +221 -0
- package/templates/default/src/lib/env.ts +119 -0
- package/templates/default/src/lib/hydration-timing.ts +289 -0
- package/templates/default/src/lib/monitoring.ts +336 -0
- package/templates/default/src/lib/utils.ts +6 -0
- package/templates/default/src/server/api/root.ts +10 -0
- package/templates/default/src/server/api/routers/dashboard.ts +37 -0
- package/templates/default/src/server/api/routers/user.ts +31 -0
- package/templates/default/src/server/api/trpc.ts +132 -0
- package/templates/default/src/server/auth/config.ts +241 -0
- package/templates/default/src/server/db/index.ts +153 -0
- package/templates/default/src/server/db/migrate.ts +125 -0
- package/templates/default/src/server/db/schema.ts +170 -0
- package/templates/default/src/server/db/seed.ts +130 -0
- package/templates/default/src/types/global.d.ts +25 -0
- package/templates/default/tailwind.config.js +46 -0
- package/templates/default/tsconfig.json +36 -0
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
## Development Issues
|
|
4
|
+
|
|
5
|
+
### pnpm Native Module Build Issues
|
|
6
|
+
|
|
7
|
+
**Error:** `Error: Cannot find module 'better-sqlite3'`
|
|
8
|
+
|
|
9
|
+
**Cause:** pnpm blocks build scripts for native modules by default
|
|
10
|
+
|
|
11
|
+
**Solution 1:** Rebuild native module
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm rebuild better-sqlite3
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Solution 2:** Use npm/yarn instead
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install
|
|
21
|
+
# or
|
|
22
|
+
yarn install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Drizzle-kit Migrate Issues with SQLite
|
|
26
|
+
|
|
27
|
+
**Error:** `Error: cannot start a transaction within a transaction`
|
|
28
|
+
|
|
29
|
+
**Cause:** Multi-statement SQL files don't work well with better-sqlite3
|
|
30
|
+
|
|
31
|
+
**Solution:** Use `drizzle-kit push` instead of `migrate`
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Instead of:
|
|
35
|
+
npm run db:migrate
|
|
36
|
+
|
|
37
|
+
# Use:
|
|
38
|
+
npx drizzle-kit push
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Database Locked (SQLite)
|
|
42
|
+
|
|
43
|
+
**Error:** `Error: database is locked`
|
|
44
|
+
|
|
45
|
+
**Cause:** WAL (Write-Ahead Logging) file still open from previous session
|
|
46
|
+
|
|
47
|
+
**Solution:** Clean build artifacts
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run clean
|
|
51
|
+
# This removes data/*.db-shm and data/*.db-wal files
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Port Already in Use
|
|
55
|
+
|
|
56
|
+
**Error:** `Error: Port 3000 is already in use`
|
|
57
|
+
|
|
58
|
+
**Solution 1:** Kill process on port 3000
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Linux/Mac
|
|
62
|
+
lsof -ti:3000 | xargs kill -9
|
|
63
|
+
|
|
64
|
+
# Windows
|
|
65
|
+
netstat -ano | findstr :3000
|
|
66
|
+
# Then kill the process
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Solution 2:** Change port
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# In app.config.ts or pass environment variable
|
|
73
|
+
PORT=3001 npm run dev
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Installation Issues
|
|
77
|
+
|
|
78
|
+
### Dependencies Not Installing
|
|
79
|
+
|
|
80
|
+
**Error:** `Error: Cannot resolve dependency`
|
|
81
|
+
|
|
82
|
+
**Cause:** npm registry issues or network problems
|
|
83
|
+
|
|
84
|
+
**Solution 1:** Clear cache and reinstall
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
rm -rf node_modules package-lock.json
|
|
88
|
+
npm install
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Solution 2:** Use different registry
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm install --registry=https://registry.npmjs.org
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### TypeScript Errors After Install
|
|
98
|
+
|
|
99
|
+
**Error:** Type errors in VS Code but not in terminal
|
|
100
|
+
|
|
101
|
+
**Cause:** VS Code not using workspace TypeScript version
|
|
102
|
+
|
|
103
|
+
**Solution:** Reload TypeScript server
|
|
104
|
+
|
|
105
|
+
1. Command Palette (Ctrl/Cmd + Shift + P)
|
|
106
|
+
2. Type: "TypeScript: Restart TS Server"
|
|
107
|
+
3. Select option
|
|
108
|
+
|
|
109
|
+
### Module Not Found Errors
|
|
110
|
+
|
|
111
|
+
**Error:** `Error: Cannot find module '@/lib/auth'`
|
|
112
|
+
|
|
113
|
+
**Cause:** Path alias not configured or incorrect import path
|
|
114
|
+
|
|
115
|
+
**Solution:**
|
|
116
|
+
|
|
117
|
+
1. Check `tsconfig.json` has path alias:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"compilerOptions": {
|
|
122
|
+
"paths": {
|
|
123
|
+
"@/*": ["./src/*"]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
2. Restart TypeScript server
|
|
130
|
+
3. Verify file exists at `src/lib/auth.ts`
|
|
131
|
+
|
|
132
|
+
## Authentication Issues
|
|
133
|
+
|
|
134
|
+
### Email Not Sending
|
|
135
|
+
|
|
136
|
+
**Error:** User registers but doesn't receive verification email
|
|
137
|
+
|
|
138
|
+
**Cause 1:** RESEND_API_KEY not set
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Check .env.local
|
|
142
|
+
cat .env.local | grep RESEND_API_KEY
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Cause 2:** RESEND_API_KEY is test key
|
|
146
|
+
|
|
147
|
+
- Test keys only send to verified email addresses
|
|
148
|
+
- Production key required for all emails
|
|
149
|
+
|
|
150
|
+
**Cause 3:** Domain not verified in Resend
|
|
151
|
+
|
|
152
|
+
1. Go to [Resend Dashboard](https://resend.com/domains)
|
|
153
|
+
2. Verify your domain
|
|
154
|
+
3. Configure SPF/DKIM records
|
|
155
|
+
|
|
156
|
+
### Session Not Persisting
|
|
157
|
+
|
|
158
|
+
**Error:** User logs in but is immediately logged out
|
|
159
|
+
|
|
160
|
+
**Cause:** Cookie not set correctly or browser blocking cookies
|
|
161
|
+
|
|
162
|
+
**Solution 1:** Check browser cookie settings
|
|
163
|
+
|
|
164
|
+
1. Open DevTools → Application → Cookies
|
|
165
|
+
2. Verify `better-auth.session_token` cookie exists
|
|
166
|
+
3. Check cookie domain matches current domain
|
|
167
|
+
|
|
168
|
+
**Solution 2:** Clear cookies and try again
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# In DevTools → Application → Storage → Clear site data
|
|
172
|
+
# Or manually delete all cookies for localhost:3000
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### CSRF Token Errors
|
|
176
|
+
|
|
177
|
+
**Error:** `Error: Invalid CSRF token`
|
|
178
|
+
|
|
179
|
+
**Cause:** CSRF protection enabled but cookies not set correctly
|
|
180
|
+
|
|
181
|
+
**Solution:** Check authentication configuration
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// src/server/auth/config.ts
|
|
185
|
+
export const auth = betterAuth({
|
|
186
|
+
csrf: {
|
|
187
|
+
enabled: true, // Should be true
|
|
188
|
+
// Check cookie settings
|
|
189
|
+
},
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Build Issues
|
|
194
|
+
|
|
195
|
+
### Build Fails with TypeScript Errors
|
|
196
|
+
|
|
197
|
+
**Error:** Type errors during `npm run build`
|
|
198
|
+
|
|
199
|
+
**Solution 1:** Run typecheck first
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npm run typecheck
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Solution 2:** Check for `any` types
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Check if any types are used
|
|
209
|
+
grep -r "any" src/ --include="*.ts" --include="*.tsx"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Solution 3:** Fix specific errors
|
|
213
|
+
|
|
214
|
+
- Follow VS Code TypeScript errors
|
|
215
|
+
- Check IMPLEMENTATION_PLAN.md for known issues
|
|
216
|
+
|
|
217
|
+
### Production Build is Slow
|
|
218
|
+
|
|
219
|
+
**Issue:** Build takes more than 30 seconds
|
|
220
|
+
|
|
221
|
+
**Cause 1:** Large dependencies
|
|
222
|
+
|
|
223
|
+
- Check bundle size
|
|
224
|
+
- Remove unused dependencies
|
|
225
|
+
|
|
226
|
+
**Cause 2:** Source maps enabled in production
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// tsconfig.json
|
|
230
|
+
{
|
|
231
|
+
"compilerOptions": {
|
|
232
|
+
"sourceMap": false // Set to false for production builds
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Production Issues
|
|
238
|
+
|
|
239
|
+
### Environment Variables Not Found
|
|
240
|
+
|
|
241
|
+
**Error:** `Error: BETTER_AUTH_SECRET is required`
|
|
242
|
+
|
|
243
|
+
**Cause:** Environment variables not set in deployment platform
|
|
244
|
+
|
|
245
|
+
**Vercel:**
|
|
246
|
+
|
|
247
|
+
1. Go to project settings → Environment Variables
|
|
248
|
+
2. Add `BETTER_AUTH_SECRET`
|
|
249
|
+
3. Add `DATABASE_URL`
|
|
250
|
+
4. Add `RESEND_API_KEY`
|
|
251
|
+
|
|
252
|
+
**Railway:**
|
|
253
|
+
|
|
254
|
+
1. Go to project → Variables
|
|
255
|
+
2. Add all required variables
|
|
256
|
+
3. Redeploy
|
|
257
|
+
|
|
258
|
+
**Docker:**
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
docker run -e BETTER_AUTH_SECRET="..." -e DATABASE_URL="..." my-app
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Database Connection Failed
|
|
265
|
+
|
|
266
|
+
**Error:** `Error: connect ECONNREFUSED` or `Error: invalid input syntax`
|
|
267
|
+
|
|
268
|
+
**Cause 1:** Wrong DATABASE_URL format
|
|
269
|
+
|
|
270
|
+
**Solution:** Verify connection string format
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
# PostgreSQL format:
|
|
274
|
+
postgres://user:password@host:port/database
|
|
275
|
+
|
|
276
|
+
# SQLite (dev):
|
|
277
|
+
file:data/app.db
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
**Cause 2:** Database not accessible from production server
|
|
281
|
+
|
|
282
|
+
- Check database firewall settings
|
|
283
|
+
- Verify VPC/network configuration
|
|
284
|
+
- Check database is running
|
|
285
|
+
|
|
286
|
+
### Page Not Found (404)
|
|
287
|
+
|
|
288
|
+
**Cause:** Route not configured or incorrect path
|
|
289
|
+
|
|
290
|
+
**Solution 1:** Check route file exists
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Verify file exists
|
|
294
|
+
ls src/app/dashboard/index.tsx
|
|
295
|
+
|
|
296
|
+
# Verify correct naming (not index.ts)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Solution 2:** Check TanStack Start router
|
|
300
|
+
|
|
301
|
+
1. Open DevTools Console
|
|
302
|
+
2. Check for route registration errors
|
|
303
|
+
3. Restart dev server
|
|
304
|
+
|
|
305
|
+
## Performance Issues
|
|
306
|
+
|
|
307
|
+
### Hot Reload Slow
|
|
308
|
+
|
|
309
|
+
**Issue:** Changes take > 1 second to reflect
|
|
310
|
+
|
|
311
|
+
**Cause 1:** Large files being rebuilt
|
|
312
|
+
|
|
313
|
+
**Solution 1:** Split large components into smaller files
|
|
314
|
+
**Solution 2:** Use code splitting for routes
|
|
315
|
+
|
|
316
|
+
**Cause 2:** File watchers not working
|
|
317
|
+
|
|
318
|
+
**Solution:** Restart dev server
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Stop (Ctrl+C) and restart
|
|
322
|
+
npm run dev
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Page Load Slow
|
|
326
|
+
|
|
327
|
+
**Issue:** First Contentful Paint (FCP) > 2 seconds
|
|
328
|
+
|
|
329
|
+
**Cause 1:** Large bundle size
|
|
330
|
+
|
|
331
|
+
**Solution 1:** Check bundle size
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# Run bundle analyzer
|
|
335
|
+
npm run build:analyze
|
|
336
|
+
|
|
337
|
+
# This will build and generate stats.html
|
|
338
|
+
# Open the file in your browser to visualize bundle size
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Solution 2:** Optimize images
|
|
342
|
+
|
|
343
|
+
- Use WebP format
|
|
344
|
+
- Compress images before uploading
|
|
345
|
+
|
|
346
|
+
**Cause 2:** Database queries slow
|
|
347
|
+
|
|
348
|
+
**Solution:** Add indexes and optimize queries (see docs/database.md)
|
|
349
|
+
|
|
350
|
+
## Bundle Analyzer Issues
|
|
351
|
+
|
|
352
|
+
### Bundle Analyzer Not Opening
|
|
353
|
+
|
|
354
|
+
**Issue:** `stats.html` file not opening automatically
|
|
355
|
+
|
|
356
|
+
**Cause:** `ANALYZE_BUNDLE` environment variable not set or auto-open disabled
|
|
357
|
+
|
|
358
|
+
**Solution 1:** Use the build:analyze script
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
npm run build:analyze
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
This script automatically sets `ANALYZE_BUNDLE=true` and opens the visualization.
|
|
365
|
+
|
|
366
|
+
**Solution 2:** Manually open stats.html
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
# Build with analyzer
|
|
370
|
+
ANALYZE_BUNDLE=true npm run build
|
|
371
|
+
|
|
372
|
+
# Then manually open the file
|
|
373
|
+
# Find stats.html in .vinxi or build output directory
|
|
374
|
+
open .vinxi/stats.html # macOS
|
|
375
|
+
xdg-open .vinxi/stats.html # Linux
|
|
376
|
+
start .vinxi/stats.html # Windows
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Bundle Size Too Large
|
|
380
|
+
|
|
381
|
+
**Issue:** JavaScript bundle > 150KB
|
|
382
|
+
|
|
383
|
+
**Common causes:**
|
|
384
|
+
|
|
385
|
+
1. **Large dependencies included in bundle**
|
|
386
|
+
- Check if libraries are being imported properly
|
|
387
|
+
- Use dynamic imports for code splitting
|
|
388
|
+
|
|
389
|
+
2. **Duplicate dependencies**
|
|
390
|
+
- Check bundle analyzer for duplicates
|
|
391
|
+
- Deduplicate using package.json resolutions
|
|
392
|
+
|
|
393
|
+
3. **Unused code not tree-shaken**
|
|
394
|
+
- Use ES modules (import/export)
|
|
395
|
+
- Avoid CommonJS imports
|
|
396
|
+
|
|
397
|
+
**Solutions:**
|
|
398
|
+
|
|
399
|
+
1. **Check bundle analyzer for largest modules**
|
|
400
|
+
- Open `stats.html`
|
|
401
|
+
- Look for large rectangles (bigger = larger size)
|
|
402
|
+
- Identify which dependencies are taking space
|
|
403
|
+
|
|
404
|
+
2. **Replace large dependencies**
|
|
405
|
+
- Use lighter alternatives when possible
|
|
406
|
+
- Example: Replace moment.js with date-fns
|
|
407
|
+
|
|
408
|
+
3. **Use dynamic imports**
|
|
409
|
+
|
|
410
|
+
```typescript
|
|
411
|
+
// Instead of:
|
|
412
|
+
import { Chart } from 'chart.js'
|
|
413
|
+
|
|
414
|
+
// Use:
|
|
415
|
+
const Chart = await import('chart.js')
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
4. **Optimize images**
|
|
419
|
+
- Compress images before adding to project
|
|
420
|
+
- Use WebP format
|
|
421
|
+
- Lazy load images below the fold
|
|
422
|
+
|
|
423
|
+
### stats.html File Not Found
|
|
424
|
+
|
|
425
|
+
**Issue:** Cannot locate `stats.html` after running build analyzer
|
|
426
|
+
|
|
427
|
+
**Cause:** Build output directory different than expected
|
|
428
|
+
|
|
429
|
+
**Solution 1:** Check common locations
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
# Build output locations to check:
|
|
433
|
+
ls -la .vinxi/stats.html
|
|
434
|
+
ls -la .output/stats.html
|
|
435
|
+
ls -la dist/stats.html
|
|
436
|
+
ls -la build/stats.html
|
|
437
|
+
|
|
438
|
+
# Or search for it:
|
|
439
|
+
find . -name "stats.html" -type f
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
**Solution 2:** Verify bundle analyzer configuration
|
|
443
|
+
|
|
444
|
+
Check `app.config.ts`:
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
// Ensure visualizer plugin is configured
|
|
448
|
+
export default defineConfig({
|
|
449
|
+
vite: {
|
|
450
|
+
plugins: [
|
|
451
|
+
visualizer({
|
|
452
|
+
filename: 'stats.html', // Note this filename
|
|
453
|
+
open: true,
|
|
454
|
+
}),
|
|
455
|
+
],
|
|
456
|
+
},
|
|
457
|
+
})
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Bundle Analyzer Shows Empty Results
|
|
461
|
+
|
|
462
|
+
**Issue:** `stats.html` loads but shows no modules or data
|
|
463
|
+
|
|
464
|
+
**Cause 1:** Build failed but analyzer still ran
|
|
465
|
+
|
|
466
|
+
**Solution:** Check build logs for errors
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
# Check terminal output for build errors
|
|
470
|
+
npm run build:analyze
|
|
471
|
+
|
|
472
|
+
# If there are errors, fix them first
|
|
473
|
+
npm run typecheck
|
|
474
|
+
npm run lint
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
**Cause 2:** No code or empty routes
|
|
478
|
+
|
|
479
|
+
**Solution:** Verify your application has code
|
|
480
|
+
|
|
481
|
+
- Check that `src/app/` has route files
|
|
482
|
+
- Ensure components have actual code
|
|
483
|
+
- Verify dependencies are installed
|
|
484
|
+
|
|
485
|
+
**Cause 3:** Incorrect bundler configuration
|
|
486
|
+
|
|
487
|
+
**Solution:** Verify TanStack Start config
|
|
488
|
+
|
|
489
|
+
```typescript
|
|
490
|
+
// app.config.ts
|
|
491
|
+
import { defineConfig } from '@tanstack/start/config'
|
|
492
|
+
|
|
493
|
+
export default defineConfig({
|
|
494
|
+
tsr: {
|
|
495
|
+
appDirectory: 'src/app',
|
|
496
|
+
routesDirectory: 'src/app',
|
|
497
|
+
},
|
|
498
|
+
// ... rest of config
|
|
499
|
+
})
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
## Email Delivery Issues
|
|
503
|
+
|
|
504
|
+
### Emails Going to Spam
|
|
505
|
+
|
|
506
|
+
**Cause 1:** SPF record not configured
|
|
507
|
+
|
|
508
|
+
**Solution:** Add SPF record to DNS
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
@ IN TXT "v=spf1 include:resend.com ~all"
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Cause 2:** DKIM record not configured
|
|
515
|
+
|
|
516
|
+
**Solution:** Add DKIM record
|
|
517
|
+
|
|
518
|
+
1. Go to Resend → Domains → Your domain → DKIM
|
|
519
|
+
2. Copy the TXT record
|
|
520
|
+
3. Add to DNS
|
|
521
|
+
|
|
522
|
+
**Cause 3:** Domain reputation is new
|
|
523
|
+
|
|
524
|
+
**Solution:**
|
|
525
|
+
|
|
526
|
+
- Send emails to verified email addresses first
|
|
527
|
+
- Start with small volume
|
|
528
|
+
- Gradually increase over time
|
|
529
|
+
|
|
530
|
+
## Deployment Issues
|
|
531
|
+
|
|
532
|
+
### Deployment Fails
|
|
533
|
+
|
|
534
|
+
**Error:** Build failed in Vercel/Railway
|
|
535
|
+
|
|
536
|
+
**Cause 1:** Build errors not caught locally
|
|
537
|
+
|
|
538
|
+
**Solution:** Run production build locally
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
npm run build
|
|
542
|
+
# Check for errors
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
**Cause 2:** Environment variables missing
|
|
546
|
+
|
|
547
|
+
**Solution:** Check deployment logs for missing variables
|
|
548
|
+
|
|
549
|
+
- Add all required variables
|
|
550
|
+
- Redeploy
|
|
551
|
+
|
|
552
|
+
### Deployment succeeds but app doesn't work
|
|
553
|
+
|
|
554
|
+
**Cause 1:** Wrong environment for DATABASE_URL
|
|
555
|
+
|
|
556
|
+
**Solution:** Ensure DATABASE_URL points to production database, not SQLite
|
|
557
|
+
|
|
558
|
+
**Cause 2:** Node version mismatch
|
|
559
|
+
|
|
560
|
+
**Solution:** Check Node.js version in platform
|
|
561
|
+
|
|
562
|
+
```bash
|
|
563
|
+
# Should match package.json engines field
|
|
564
|
+
node -v
|
|
565
|
+
# Should be >= 18
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
## Getting Help
|
|
569
|
+
|
|
570
|
+
### Check Logs
|
|
571
|
+
|
|
572
|
+
**Development:**
|
|
573
|
+
|
|
574
|
+
- Terminal output from `npm run dev`
|
|
575
|
+
- Browser console (DevTools)
|
|
576
|
+
- tRPC DevTools
|
|
577
|
+
- React DevTools
|
|
578
|
+
|
|
579
|
+
**Production:**
|
|
580
|
+
|
|
581
|
+
- Vercel: Build logs and function logs
|
|
582
|
+
- Railway: Service logs
|
|
583
|
+
- Application monitoring (Sentry, LogRocket if configured)
|
|
584
|
+
|
|
585
|
+
### Common Debugging Steps
|
|
586
|
+
|
|
587
|
+
1. **Restart everything**
|
|
588
|
+
- Stop dev server
|
|
589
|
+
- Clear node_modules (if needed)
|
|
590
|
+
- Reinstall dependencies
|
|
591
|
+
- Restart dev server
|
|
592
|
+
|
|
593
|
+
2. **Check environment variables**
|
|
594
|
+
- Verify `.env.local` exists
|
|
595
|
+
- Verify all required variables set
|
|
596
|
+
- Restart server after changes
|
|
597
|
+
|
|
598
|
+
3. **Check database**
|
|
599
|
+
- Run `npm run db:studio` to browse database
|
|
600
|
+
- Verify data exists
|
|
601
|
+
- Check for corrupted data
|
|
602
|
+
|
|
603
|
+
4. **Check logs**
|
|
604
|
+
- Dev server logs
|
|
605
|
+
- Browser console
|
|
606
|
+
- Network tab for API calls
|
|
607
|
+
|
|
608
|
+
### Community Resources
|
|
609
|
+
|
|
610
|
+
- **GitHub Issues:** Check [project issues page](../../issues)
|
|
611
|
+
- **Documentation:** See [README.md](../README.md)
|
|
612
|
+
- **TanStack Start:** https://tanstack.com/start/latest/docs
|
|
613
|
+
- **tRPC:** https://trpc.io/docs
|
|
614
|
+
- **Drizzle:** https://orm.drizzle.team/docs
|
|
615
|
+
- **Better-auth:** https://www.better-auth.com/docs
|
|
616
|
+
|
|
617
|
+
## Known Limitations
|
|
618
|
+
|
|
619
|
+
### Current Limitations
|
|
620
|
+
|
|
621
|
+
1. **No OAuth providers** configured yet (only email/password)
|
|
622
|
+
2. **No multi-tenancy** support (single-organization)
|
|
623
|
+
3. **No background jobs** queue system
|
|
624
|
+
4. **No admin dashboard** for managing users
|
|
625
|
+
|
|
626
|
+
### Workarounds
|
|
627
|
+
|
|
628
|
+
**OAuth Providers:**
|
|
629
|
+
|
|
630
|
+
- Use accounts table (already in schema)
|
|
631
|
+
- Configure Better-auth with Google/GitHub providers
|
|
632
|
+
- See Better-auth documentation for setup
|
|
633
|
+
|
|
634
|
+
**Multi-tenancy:**
|
|
635
|
+
|
|
636
|
+
- Add `organizationId` to user tables
|
|
637
|
+
- Filter queries by organization
|
|
638
|
+
- Update auth context to include organization
|
|
639
|
+
|
|
640
|
+
## Reporting Issues
|
|
641
|
+
|
|
642
|
+
When reporting issues, include:
|
|
643
|
+
|
|
644
|
+
1. **Node.js version:** `node -v`
|
|
645
|
+
2. **Package manager:** `npm -v` or `pnpm -v`
|
|
646
|
+
3. **Operating system:** Mac/Linux/Windows
|
|
647
|
+
4. **Error message:** Full error from console
|
|
648
|
+
5. **Steps to reproduce:** What you did before error
|
|
649
|
+
6. **Expected vs actual:** What you expected vs what happened
|
|
650
|
+
|
|
651
|
+
**Example issue report:**
|
|
652
|
+
|
|
653
|
+
```
|
|
654
|
+
Node: v20.11.0
|
|
655
|
+
pnpm: 8.15.0
|
|
656
|
+
OS: macOS 14.2
|
|
657
|
+
|
|
658
|
+
Error: Cannot find module '@/lib/auth'
|
|
659
|
+
|
|
660
|
+
Steps:
|
|
661
|
+
1. Cloned repo
|
|
662
|
+
2. Ran `pnpm install`
|
|
663
|
+
3. Started `pnpm dev`
|
|
664
|
+
4. Got error in terminal
|
|
665
|
+
|
|
666
|
+
Expected: Dev server starts
|
|
667
|
+
Actual: Module not found error
|
|
668
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
CREATE TABLE `accounts` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`account_id` text NOT NULL,
|
|
5
|
+
`provider_id` text NOT NULL,
|
|
6
|
+
`access_token` text,
|
|
7
|
+
`refresh_token` text,
|
|
8
|
+
`expires_at` integer,
|
|
9
|
+
`created_at` integer DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
10
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
CREATE TABLE `sessions` (
|
|
14
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
15
|
+
`user_id` text NOT NULL,
|
|
16
|
+
`expires_at` integer NOT NULL,
|
|
17
|
+
`created_at` integer DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
18
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
CREATE TABLE `users` (
|
|
22
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
23
|
+
`email` text NOT NULL,
|
|
24
|
+
`name` text NOT NULL,
|
|
25
|
+
`email_verified` integer DEFAULT false,
|
|
26
|
+
`image` text,
|
|
27
|
+
`created_at` integer DEFAULT (strftime('%s', 'now')) NOT NULL,
|
|
28
|
+
`updated_at` integer
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
CREATE TABLE `verifications` (
|
|
32
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
33
|
+
`identifier` text NOT NULL,
|
|
34
|
+
`value` text NOT NULL,
|
|
35
|
+
`expires_at` integer NOT NULL,
|
|
36
|
+
`created_at` integer DEFAULT (strftime('%s', 'now')) NOT NULL
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);
|