- Add /setup-admin page for first-time admin account creation
- Add /api/admin/setup route (only works when no admin exists)
- Update login to redirect admins to /admin instead of /dashboard
- Setup page creates auth user + profile with is_admin=true
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
- /admin page with secret-key authentication
- List all candidatures with details (expandable cards)
- Approve: updates status + generates Stripe checkout URL + sends email
- Reject: updates status
- Checkout URL displayed on screen for manual copy if Resend not configured
- Protected by ADMIN_SECRET env var
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
- Add auth options (autoRefreshToken: false, persistSession: false) to
createAdminClient so service role key works correctly with supabase-js
- Return actual Supabase error message in candidature API for debugging
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
@supabase/ssr uses __dirname internally which crashes in Vercel's Edge
runtime, causing MIDDLEWARE_INVOCATION_FAILED even without a middleware
file. Replaced with @supabase/supabase-js directly:
- Server client: manual cookie-based session restoration
- Browser client: direct createClient from supabase-js
- Admin client: already using supabase-js
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
- Add serverExternalPackages for @supabase/ssr in next.config.ts
- Add export const runtime = 'nodejs' to all pages/routes using Supabase
- Replace createAdminClient to use @supabase/supabase-js directly (no SSR)
- Prevents @supabase/ssr from running in Edge runtime on Vercel
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
Next.js 16.1.6 is not yet fully supported by Vercel's build system,
causing 404 on all routes. Downgraded to Next.js 15.5.12 + React 18,
fixed ESLint config, TypeScript config, and lint errors.
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
- Remove middleware.ts entirely (caused __dirname ReferenceError in Edge)
- Auth protection handled by dashboard layout.tsx (server-side redirect)
- Move pages out of (marketing) and (auth) route groups to fix 404 on /
- Keep (protected) route group for dashboard/formations/profil shared layout
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
- Check if Supabase env vars are configured before using them
- Wrap Supabase auth call in try/catch to prevent 500 crashes
- Graceful fallback: pass through on error instead of crashing
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y
The @/ path alias was not resolved in Vercel's Edge Function bundler,
causing "unsupported modules" error. Inlined the middleware logic
directly to avoid the import.
https://claude.ai/code/session_01H2aRGDaKgarPvhay2HxN6Y