feat(auth): phase 3 — replace Supabase GoTrue with bcryptjs+jose

Custom auth stack: bcryptjs password hashing (cost 10, GoTrue-compatible),
jose JWT session cookies (edge-safe, 8hr TTL), new API routes for
login/logout/reset/change-password, middleware rewritten to JWT-only
verification with no DB access. All 38 protected pages and API routes
migrated from supabase.auth.getUser() to getSession(). Supabase .from()
queries retained for Phase 4. lib/db/index.ts refactored to lazy Proxy
singleton to avoid module-level throw during Next.js build.

tsc: clean, build: clean, tests: 4/4 passed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 16:20:04 +08:00
co-authored by Claude Sonnet 4.6
parent a95273b182
commit d18d29168a
67 changed files with 966 additions and 591 deletions
+3
View File
@@ -15,9 +15,11 @@
"@anthropic-ai/sdk": "^0.111.0",
"@supabase/ssr": "^0.12.0",
"@supabase/supabase-js": "^2.110.2",
"bcryptjs": "^3.0.3",
"drizzle-orm": "^0.45.2",
"file-type": "^22.0.1",
"idb": "^8.0.3",
"jose": "^6.2.4",
"next": "^15.5.20",
"openai": "^6.46.0",
"pdf-lib": "^1.17.1",
@@ -30,6 +32,7 @@
"@tailwindcss/postcss": "^4",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/bcryptjs": "^2.4.6",
"@types/node": "^20",
"@types/pg": "^8.20.0",
"@types/qrcode": "^1.5.6",