mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 20:28:04 +01:00
- Bump version to 0.1.1 for tracking - Add webpack-bundle-optimizer script for Next.js config - Simplify ESLint configuration to resolve missing dependencies - Prepare for production deployment with proper version control This deployment includes: - Profile update fixes with banner_url support - LN address validation - Auth cookie fixes for profile updates - Various documentation and testing improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.3 KiB
2.3 KiB
Supabase Connectivity
Environment
- Required (all environments):
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
- Optional (server-side admin only):
SUPABASE_SERVICE_ROLE_KEY(do not expose publicly)
Runtime Clients
- Browser:
src/services/supabase/client.ts(uses anon key, lazy validates env). - Server:
src/services/supabase/server.ts(SSR client using anon key + cookies for session handling). - Admin:
src/services/supabase/admin.ts(service-role client; falls back to a dummy that throws if missing to avoid unsafe usage).
Health Check
GET /api/healthchecks Supabase availability:- Tries admin client if
SUPABASE_SERVICE_ROLE_KEYis present. - Falls back to SSR anon client if admin is absent.
- Performs a minimal
profilesquery withhead: true.
- Tries admin client if
CLI-Free Local Diagnostics
- Run
npm run diag:supabaseto verify env + connectivity and head-only selects on key tables (profiles,organizations,funding_pages). - Uses
.env.local(if present) and prefersSUPABASE_SERVICE_ROLE_KEYwhen available.
Write Test (optional)
- Run
npm run diag:supabase:writeto perform a safe end-to-end write test:- Creates a temporary auth user via Admin API (service-role required)
- Ensures a profile exists (trigger or fallback insert)
- Inserts a temporary
funding_pagesrow (if owner column detected), then deletes it - Cleans up by deleting the temporary auth user (cascades to profile)
- No existing data is modified; temporary records are removed at the end.
Local Development
- Start Supabase locally (Supabase CLI) or use hosted project.
- Set
.env.localwith the required keys (see.env.example). - Run
npm run dev(ornpm run fresh:start). - Verify via
curl http://localhost:3000/api/health.
Production
- Configure envs in Vercel Project settings (Production/Preview):
NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_ANON_KEY(required)SUPABASE_SERVICE_ROLE_KEY(optional; only if admin operations are required at runtime)
- CI workflow uses GitHub Secrets for Vercel credentials only.
Troubleshooting
- Missing envs cause a runtime error on first Supabase client usage;
/api/healthwill showsupabaseasdown. - Verify the domain in
NEXT_PUBLIC_SUPABASE_URLand that keys match the target environment (dev/staging/prod).