How mahakagarwal7/volunteer_ai works
Purpose and Entry Points
GenZenith is an AI-assisted volunteer coordination MVP: intake needs, enrich/classify them, find suitable volunteers, notify them, and track responses/status. The user-facing application is a Next.js frontend rooted at ai-volunteer-mvp/frontend/app/page.tsx; operational entry points include need submission, volunteer views, and admin ingestion. Production backend execution is Supabase Edge Functions, while legacy/supporting Node services remain under functions.
Frontend Application
Next.js App Router provides public, volunteer, admin, diagnostic, and monitoring surfaces:
• Need intake/status: ai-volunteer-mvp/frontend/app/submit/page.tsx, ai-volunteer-mvp/frontend/app/status/[need_id]/page.tsx
• Volunteer discovery/detail: ai-volunteer-mvp/frontend/app/volunteers/page.tsx, ai-volunteer-mvp/frontend/app/volunteer/[id]/page.tsx
• Operations/admin: ai-volunteer-mvp/frontend/app/admin/ingest/page.tsx, ai-volunteer-mvp/frontend/app/monitor/page.tsx
Feature components own primary UI workflows, while API and Supabase clients establish the browser-to-backend boundary: ai-volunteer-mvp/frontend/features/need/SubmissionForm.tsx, ai-volunteer-mvp/frontend/lib/api/client.ts, ai-volunteer-mvp/frontend/lib/supabase/client.ts.
Supabase Data and Authorization Layer
Supabase is the system of record for needs, volunteers, predictions, matching, and response state. Migrations encode matching database logic, RLS, tenancy, reputation, and schema evolution:
• ai-volunteer-mvp/supabase/migrations/20260422000001_firestore_to_supabase.sql
• ai-volunteer-mvp/supabase/migrations/20260423000005_match_volunteers_rpc.sql
• ai-volunteer-mvp/supabase/migrations/20260501000000_multitenancy_rls.sql
Authentication callback handling is in ai-volunteer-mvp/frontend/app/auth/callback/route.ts. RLS and database RPCs are the critical trust boundary; edge functions use shared Supabase access code in ai-volunteer-mvp/supabase/functions/_shared/supabase.ts.
Event-Driven Intake and Matching
Supabase Edge Functions are the primary deployed backend, in Deno. Incoming WhatsApp traffic is accepted by ai-volunteer-mvp/supabase/functions/whatsapp-webhook/index.ts; volunteer acceptance/decline events flow through ai-volunteer-mvp/supabase/functions/volunteer-response/index.ts. Creation of a need invokes the orchestration path in ai-volunteer-mvp/supabase/functions/need-created/index.ts.
The need-created stage is the main control boundary: it can validate/enrich an intake, invoke AI support, persist results, call database matching logic, and initiate outreach. Shared HTTP, AI, Google auth, and image validation utilities sit behind these handlers in ai-volunteer-mvp/supabase/functions/_shared/.
AI, Enrichment, and Prediction Services
AI capabilities classify inbound messages and support OCR/need processing. Equivalent or supporting Node 20 implementations exist in:
• ai-volunteer-mvp/functions/src/ai/messageClassifier.ts
• ai-volunteer-mvp/functions/src/ai/processOCR.ts
• ai-volunteer-mvp/functions/src/triggers/needProcessor.ts
A separate Python prediction service produces need predictions, with its main entry at ai-volunteer-mvp/prediction-service/needPredictionService.py. This is a distinct Python runtime/service boundary from Deno Edge Functions and the frontend.
Matching, Notification, and Feedback Loop
Matching combines volunteer attributes, location/region, availability or response signals, and database-level scores. The Node-side matching model is represented by ai-volunteer-mvp/functions/src/matching/intelligentMatchingService.ts, with geocoding in ai-volunteer-mvp/functions/src/location/geocodeService.ts. Notifications are dispatched by ai-volunteer-mvp/functions/src/notifications/notifyVolunteer.ts; responses return through the webhook path and update state used by volunteer/status screens.
Runtimes and Deployment
The frontend is TypeScript/Next.js and is configured for Vercel (ai-volunteer-mvp/vercel.json). Supabase supplies Postgres, Auth, Storage, RLS, and Deno Edge Function hosting (ai-volunteer-mvp/supabase/config.toml). Node 20 remains required for the functions project (ai-volunteer-mvp/functions/.nvmrc), and Python/pytest supports prediction processing. Containerization is available through ai-volunteer-mvp/Dockerfile.
Main entry points: index.ts Need orchestration · 20260422000001_firestore_to_supabase.sql Supabase system of record · page.tsx App surfaces · SubmissionForm.tsx Need submission
Components 17
Next.js frontend
- App surfaces · Public, volunteer, admin, status, and monitoring views.
ai-volunteer-mvp/frontend/app/page.tsx - Need submission
ai-volunteer-mvp/frontend/features/need/SubmissionForm.tsx - Backend API client
ai-volunteer-mvp/frontend/lib/api/client.ts - Auth callback
ai-volunteer-mvp/frontend/app/auth/callback/route.ts - Supabase browser client
ai-volunteer-mvp/frontend/lib/supabase/client.ts
Supabase platform
- WhatsApp webhook
ai-volunteer-mvp/supabase/functions/whatsapp-webhook/index.ts - Need orchestration · Validates, enriches, matches, and initiates outreach.
ai-volunteer-mvp/supabase/functions/need-created/index.ts - Volunteer response
ai-volunteer-mvp/supabase/functions/volunteer-response/index.ts - Edge shared services · Shared Supabase, AI, HTTP, Google auth, and image validation access.
ai-volunteer-mvp/supabase/functions/_shared/supabase.ts - Supabase system of record · Stores needs, volunteers, predictions, matches, and response state.
ai-volunteer-mvp/supabase/migrations/20260422000001_firestore_to_supabase.sql - Matching RPC · Database-level candidate scoring and selection.
ai-volunteer-mvp/supabase/migrations/20260423000005_match_volunteers_rpc.sql - RLS and tenancy · Critical data trust boundary.
ai-volunteer-mvp/supabase/migrations/20260501000000_multitenancy_rls.sql
Supporting services
- Need prediction service · Produces need predictions outside the Edge runtime.
ai-volunteer-mvp/prediction-service/needPredictionService.py - Legacy need processor · Supporting AI/OCR trigger implementation.
ai-volunteer-mvp/functions/src/triggers/needProcessor.ts - Legacy matching service · Supporting intelligent matching and geocoding.
ai-volunteer-mvp/functions/src/matching/intelligentMatchingService.ts - Volunteer notifier
ai-volunteer-mvp/functions/src/notifications/notifyVolunteer.ts
Other components
- WhatsApp · Inbound intake and outbound volunteer outreach.
Connections 20
- App surfaces → Need submission: hosts
- Need submission → Backend API client: submits need
- App surfaces → Supabase browser client: reads auth and state
- Auth callback → Supabase system of record: completes authentication
- Supabase browser client → Supabase system of record: authenticated data access
- Backend API client → Need orchestration: creates need
- WhatsApp → WhatsApp webhook: inbound messages
- WhatsApp webhook → Need orchestration: normalizes intake
- Need orchestration → Edge shared services: uses
- Need orchestration → Need prediction service: requests prediction
- Need orchestration → Supabase system of record: persists enriched need
- Need orchestration → Matching RPC: finds candidates
- Matching RPC → Supabase system of record: scores volunteer data
- Supabase system of record → RLS and tenancy: enforced by
- Need orchestration → Volunteer notifier: initiates outreach
- Volunteer notifier → WhatsApp: sends notifications
- WhatsApp → Volunteer response: accept or decline
- Volunteer response → Supabase system of record: updates response state
- Legacy need processor → Need prediction service: supporting AI/OCR path
- Legacy matching service → Supabase system of record: uses volunteer data