How srithineshs/unitedlocal works
UnitedLocal is a civic emergency-response and municipal-management platform serving citizens, responders, administrators, and volunteers. Its central workflow is a citizen SOS: capture location, create an incident, find and assign a nearby responder, notify the citizen, and track status. Separate capabilities cover evidence-backed complaint resolution, broadcasts, verified emergency contacts, volunteer tasks, and WhatsApp interaction. The graph combines documented product flows with source-visible calls; several API-to-service relationships and unsampled subsystem internals are not established by the excerpts and are therefore omitted.
Main entry points: sos-service.ts Incident dispatch · repository.ts Data repository · page.tsx Citizen portal · complaint-service.ts Complaint handling
Components 31
User portals
- Citizen portal
app/citizen/page.tsx - Responder consoles
app/police/page.tsx - Municipal console
app/municipal/page.tsx - Volunteer portal
app/volunteer/page.tsx - Admin console
app/admin/page.tsx
Emergency response
- SOS capture
components/emergency/SOSTriggerButton.tsx - SOS API
app/api/sos/trigger/route.ts - Incident dispatch
lib/emergency/sos-service.ts - Nearest responder
lib/geo/nearest-responder.ts - Distance calculation
lib/geo/haversine.ts - Reverse geocoding
lib/geo/reverse-geocode.ts - Incident tracking
app/citizen/track/page.tsx
Civic services
- Complaint filing
components/complaints/ComplaintForm.tsx - Complaint handling
lib/complaints/complaint-service.ts - Complaint API
app/api/complaints/route.ts - Emergency directory
components/emergency/EmergencyContactsGrid.tsx - Alert broadcasts
app/api/broadcasts/route.ts - Volunteer tasks
app/api/volunteers/tasks/route.ts
Communications
- WhatsApp webhook
app/api/whatsapp/webhook/route.ts - WhatsApp chatbot
lib/whatsapp/chatbot.ts - WhatsApp notifications
lib/whatsapp/index.ts - Provider adapters
lib/whatsapp/meta-cloud.ts
Shared platform
- Session and roles
lib/auth/session.ts - Role authorization
lib/auth/roles.ts - Data repository
lib/db/repository.ts - Audit logging
lib/audit/audit-logger.ts - GIS map
components/maps/CivicMap.tsx
Other components
- Citizen
- Responders
- WhatsApp Business
- Supabase
Connections 34
- Citizen → Citizen portal: uses
README.md - Citizen portal → SOS capture: opens SOS
README.md - SOS capture → SOS API: triggers
- SOS API → Incident dispatch: handles
- Incident dispatch → Data repository: persists incident
lib/emergency/sos-service.ts - Incident dispatch → Nearest responder: finds unit
lib/emergency/sos-service.ts - Incident dispatch → Reverse geocoding: resolves address
lib/emergency/sos-service.ts - Nearest responder → Distance calculation: measures distance
lib/geo/nearest-responder.ts - Incident dispatch → WhatsApp notifications: notifies citizen
lib/emergency/sos-service.ts - Incident dispatch → Audit logging: records event
lib/emergency/sos-service.ts - Responders → Responder consoles: uses
README.md - Responder consoles → GIS map: shows operations map
app/police/page.tsx - Citizen portal → Incident tracking: tracks incident
README.md - Citizen portal → Complaint filing: files complaint
README.md - Complaint filing → Complaint API: submits
- Complaint API → Complaint handling: handles complaint
- Municipal console → Complaint handling: resolves with evidence
README.md - Complaint handling → Data repository: stores complaint
lib/complaints/complaint-service.ts - Complaint handling → Audit logging: records resolution
lib/complaints/complaint-service.ts - Complaint handling → WhatsApp notifications: sends updates
lib/complaints/complaint-service.ts - Citizen portal → Emergency directory: views directory
README.md - Admin console → Alert broadcasts: issues alerts
README.md - Alert broadcasts → Data repository: saves and fans out
app/api/broadcasts/route.ts - Alert broadcasts → Audit logging: records broadcast
app/api/broadcasts/route.ts - Volunteer portal → Volunteer tasks: claims tasks
README.md - WhatsApp Business → WhatsApp webhook: sends messages
README.md - WhatsApp webhook → WhatsApp chatbot: processes messages
- WhatsApp chatbot → Data repository: stores sessions
- WhatsApp notifications → Provider adapters: selects provider
lib/whatsapp/index.ts - WhatsApp notifications → Audit logging: records delivery
lib/whatsapp/index.ts - Provider adapters → WhatsApp Business: sends messages
- Session and roles → Data repository: loads profiles
lib/auth/session.ts - Session and roles → Role authorization: validates roles
- Data repository → Supabase: stores platform data
README.md