Community Connect
Civic Engagement Platform with Firebase Auth & Supabase RLS
// 01. THE PROBLEM
Citizens struggle to report ward-level civic issues directly to local representatives with transparent status tracking.
// 02. SYSTEM ARCHITECTURE & PIPELINE FLOW
Firebase Phone OTP Authentication
Authenticates citizen phone numbers securely.
Geographic Grievance Submission
Captures location coordinates, photo proof, and grievance classification.
Supabase PostgreSQL RLS Verification
Passes auth JWT to Supabase RLS policies to restrict editing to report creators.
Real-Time Status Synchronization
Broadcasts resolution state updates to citizen dashboard.
// 03. TECHNICAL APPROACH & DECISION MATRIX
01Firebase Auth + Supabase RLS Bridge
Firebase Phone Auth JWT passed to Supabase SQL RLS Policies
Leveraged Firebase phone auth while utilizing Supabase declarative SQL authorization rules.
Custom Authentication Server
Increased operational burden without providing additional security benefits.
// 04. CORE ARCHITECTURAL LOGIC
Passing Firebase Auth JWT token to Supabase client for Row Level Security.
123456789101112131415import { createClient } from '@supabase/supabase-js'; export function getAuthenticatedSupabaseClient(firebaseIdToken: string) { return createClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { global: { headers: { Authorization: `Bearer ${firebaseIdToken}`, }, }, } ); }
// 05. TRADE-OFFS & HONEST REFLECTION
Dual-backend integration required syncing JWT tokens between Firebase and Supabase, but provided robust security for citizen reports.