Sanctiv Supabase Deployment Guide
Status: Ready for deployment Date: November 18, 2025 Prerequisites: Supabase project createdStep 1: Deploy Database Schema
1.1 Run Complete Schema Migration
- Open your Supabase Dashboard
- Navigate to SQL Editor
- Copy the contents of
/supabase/migrations/001_complete_schema.sql - Paste into SQL Editor
- Click Run
- Verify output shows: “Statements executed successfully”
1.2 Seed Organizations
- In SQL Editor, create a new query
- Copy the contents of
/supabase/seed.sql - Click Run
- Verify you see 2 organizations:
- Sanctiv (slug: sanctiv)
- Crossroads Church (slug: crossroads)
1.3 Verify Tables Created
Run this query to confirm all tables exist:Step 2: Configure Environment Variables
2.1 Get Supabase Credentials
- In Supabase Dashboard, go to Project Settings → API
- Copy these values:
- Project URL (e.g.,
https://xxx.supabase.co) - Publishable Key (starts with
sb_publishable_oreyJhb...)
- Project URL (e.g.,
2.2 Update Local .env
Update/home/user/workspace/.env:
2.3 Configure EAS Secrets (For Builds)
Step 3: Test Authentication Flow
3.1 Create Test User
- Start the app:
bun start - Navigate to Sign Up screen
- Fill in:
- Full Name: “Test User”
- Email: “[email protected]”
- Organization: Select “Sanctiv”
- Password: “test1234”
- Confirm Password: “test1234”
- Click Create Account
- Check email for verification link
- Click verification link
3.2 Verify User in Database
Run in Supabase SQL Editor:3.3 Test Sign In
- In app, navigate to Login screen
- Enter:
- Email: “[email protected]”
- Password: “test1234”
- Click Sign In
- Should navigate to main app
Step 4: Test Multi-Tenancy
4.1 Create Users in Different Orgs
Create 2 test accounts:[email protected]→ Organization: Sanctiv[email protected]→ Organization: Crossroads
4.2 Verify Data Isolation
- Sign in as
[email protected] - Create a journal entry
- Sign out
- Sign in as
[email protected] - Verify you cannot see the Sanctiv user’s journal entry
- Create a journal entry for Crossroads user
- Sign out
- Sign in as
[email protected] - Verify you cannot see the Crossroads user’s entry
4.3 Verify in Database
Step 5: Verify RLS Policies
5.1 Test RLS with SQL
5.2 Attempt Cross-Org Access (Should Fail)
Step 6: Production Deployment Checklist
Before Going Live:
- All tables created successfully
- Seed data loaded (Sanctiv + Crossroads orgs)
- RLS policies tested and verified
- Multi-tenancy tested (users cannot see other org’s data)
- Email verification working
- Sign up flow creates both auth user AND public.users profile
- Environment variables configured in EAS
- Test builds created and working
- Sentry error tracking configured
Troubleshooting
Issue: “Missing Supabase environment variables”
Solution: Verify.env file has correct values and restart dev server
Issue: “No organization found” error
Solution:- Check user profile has
org_id:SELECT * FROM users WHERE id = '<user-id>' - Verify org exists:
SELECT * FROM organizations WHERE id = '<org-id>' - Re-create user if needed
Issue: Sign up succeeds but user profile not created
Solution: Check Supabase logs for errors. May need to manually create profile:Issue: Cannot see journal entries after creating them
Solution:- Check RLS policies are enabled
- Verify user’s org_id matches entry’s org_id
- Check for deleted_at timestamp (soft deletes)
Next Steps
Phase 1: MVP Launch (December 2025)
- Deploy to TestFlight/Google Play Internal Testing
- Onboard 10 pilot churches
- Monitor error rates in Sentry
- Collect user feedback
Phase 2: Post-Launch
- Add real-time subscriptions for live updates
- Implement offline queue for journal entries
- Add edge functions for AI analysis
- Create pastor dashboard for insights
Support
Database Issues: Check Supabase logs in Dashboard → Logs Auth Issues: Check Supabase Dashboard → Authentication → Users App Errors: Check Sentry dashboardLast Updated: November 18, 2025 Schema Version: 001_complete_schema.sql