Date: 2026-01-20Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Purpose: Understanding and managing users in the database, including test users and Lovable integration
Current User Status
User Statistics
Total Users: 1,223Test Users: 1,191 (97% of all users)
Recent Users: All 1,223 created in last 7 days
User Breakdown by Type
| User Type | Count | Source | Purpose |
|---|---|---|---|
| E2E Tests | ~500+ | Automated test suites | End-to-end testing |
| RLS Tests | ~200+ | RLS test scenarios | Row-level security testing |
| Debug/Test | ~300+ | Manual testing | Development debugging |
| Seed Data | ~100+ | Seed files | Staging test data |
| Other | ~32 | Production/real users | Actual application users |
User Sources
1. E2E Test Users
Pattern:e2e-{test-name}-{timestamp}@test.com
Examples:
e2e-auth-<timestamp>@test.come2e-financial-<timestamp>@test.come2e-leave-<timestamp>@test.com
Location:
tests/e2e/ directoryPurpose: Testing complete user flows Cleanup: These are created during test runs and can be safely cleaned up if not needed.
2. RLS Test Users
Pattern:rls-{scenario}-{test-number}-{timestamp}@example.com
Examples:
rls-scenario-testN-<timestamp>@example.comrls-close-testN-<timestamp>@example.com
Location:
tests/rls/ directoryPurpose: Testing multi-tenant data isolation Cleanup: These are created during RLS test runs and can be safely cleaned up.
3. Debug/Test Users
Pattern:{role}-{purpose}-{timestamp}@test.com
Examples:
admin-debug-<timestamp>@test.comregular-debug-<timestamp>@test.comtest-user-a-fw-logs-<timestamp>@test.com
Purpose: Development and troubleshooting Cleanup: These can be cleaned up if no longer needed for debugging.
4. Seed Data Users
Pattern:{role}@test-org-{name}.example or test.{name}.{num}@org{num}.staging.encoreos.io
Examples:
admin@test-org-alpha.examplemanager@test-org-beta.exampletest.admin.N@orgN.staging.encoreos.io
supabase/seeds/Location:
supabase/seeds/base/02_users.sqlPurpose: Staging environment test data Cleanup: These should remain in staging but should NOT be in production.
5. Lovable Integration
Status: Lovable is connected to the project What Lovable Does:- Auto-generates
src/integrations/supabase/client.ts - Auto-generates
src/integrations/supabase/types.ts - Manages
.envfile (when configured) - Deploys edge functions automatically
- Does NOT create users directly
- Lovable does NOT create test users in the database
- Any users you see are from:
- Automated test suites (E2E, RLS)
- Manual testing/debugging
- Seed data (staging only)
- Real user signups
- Lovable may deploy to
.lovable.appdomains - If you use Lovable deployment URLs, add them to Supabase redirect URLs
- See
docs/development/SUPABASE_VERCEL_SETUP_FIX.mdfor configuration
User Cleanup Options
Option 1: Clean Up Test Users (Recommended - Use Script)
⚠️ WARNING: Only run this in production if you’re sure you want to remove test users. ✅ RECOMMENDED: Use the automated cleanup script:- ✅ Verify you’re in the correct environment (production vs staging)
- ✅ Run the SELECT query first to see what will be deleted
- ✅ Consider backing up first
- ✅ Check if any test users have important data
docs/development/TEST_USER_CLEANUP_GUIDE.md for complete cleanup guide.
Option 2: Archive Test Users (Safer)
⚠️ IMPORTANT: You cannot directly modify theauth.users table schema as it’s managed by Supabase. Use one of these safe alternatives:
Alternative A: Use raw_user_meta_data JSONB
Mark users as archived using their existing metadata field:Alternative B: Use Application-Level Table (Recommended)
Create a separate table to track archived user status:Option 3: Clean Up by Date
Remove users created during a specific time period (e.g., test run):Preventing Test User Accumulation
1. Use Test Isolation
For E2E Tests:- Use unique test user emails with timestamps
- Clean up test users after test runs
- Use test database or staging environment
- Use deterministic test user IDs
- Clean up after test suite completes
- Consider using test fixtures that clean up automatically
2. Environment Separation
Production:- ✅ No test users should exist
- ✅ Only real user signups
- ✅ Regular cleanup of any accidental test users
- ✅ Test users are expected
- ✅ Seed data users are normal
- ✅ Can have test users for UAT
3. Automated Cleanup
Consider adding cleanup scripts:Lovable Integration Notes
Lovable Connection
What Lovable Manages:- ✅ Supabase client configuration
- ✅ TypeScript types generation
- ✅ Environment variables (when configured)
- ✅ Edge function deployment
- ❌ Does NOT create users
Lovable Deployment URLs
If you deploy via Lovable to.lovable.app domains:
-
Add to Supabase Redirect URLs:
-
Sync Config:
Verification Queries
Check User Distribution
Check Recent User Creation
Find Test Users
Recommendations
For Production
- Immediate: Review and clean up test users if they shouldn’t be there
- Ongoing: Set up automated cleanup for test users
- Monitoring: Add alerts for unexpected user creation spikes
- Documentation: Document which users are legitimate
For Staging
- Expected: Test users are normal in staging
- Seed Data: Keep seed data users for UAT
- Cleanup: Periodically clean up old test users (30+ days old)
For Development
- Local: Use local Supabase instance for testing
- Isolation: Use separate test databases when possible
- Cleanup: Clean up test users after development sessions
Related Documentation
- Test User Cleanup Guide:
docs/development/TEST_USER_CLEANUP_GUIDE.md- Complete cleanup procedures - Setup Fix Guide:
docs/development/SUPABASE_VERCEL_SETUP_FIX.md - Testing Guide:
docs/development/VERIFICATION_TESTING_GUIDE.md - Lovable Integration:
AGENTS.md - Environment Config: ENVIRONMENT_CONFIG.md