How villavito/my-app-hazard works
Hazard is an incident-reporting and response app: users authenticate, submit incident details (including location and video), and review their reports; administrators triage incidents, manage agencies/users, and inspect reports and trends. Firebase Auth and Firestore provide identity and incident data, while a companion backend handles video uploads and agency email notifications. The graph preserves the documented app areas, but several routes and service connections are unsampled; only evidenced calls or README-described relationships are drawn.
Main entry points: firestoreService.ts Incident records · AuthContext.tsx Session and roles · capture-incident.tsx Capture incident · server.js App backend
Components 24
Identity and access
- Sign-in and signup
app/signup.tsx - Session and roles
contexts/AuthContext.tsx - Authentication service
services/authService.ts - Admin access
app/admin/_layout.tsx
Incident reporting
- User home
app/(tabs)/index.tsx - Capture incident
app/capture-incident.tsx - My reports
app/my-reports.tsx - Agency and categories
constants/agencies.ts
Response operations
- Notifications
app/(tabs)/notifications.tsx - Incident triage
app/admin/incidents.tsx - Incident detail
app/admin/incident-detail.tsx - Super-admin dashboard
app/admin/super-admin.tsx - Incident charts
components/IncidentStatusChart.tsx - Admin reports
app/admin/reports.tsx
Data and integrations
- Incident records
services/firestoreService.ts - Firebase client
config/firebase.ts - Backend API client
config/api.ts - App backend
backend/server.js - Backend Firebase
backend/config/firebase.js - SMS integration
backend/config/sms.js - Video upload and playback
utils/incidentVideo.ts
Other components
- App user
- Agency email recipient
- Email transport
Connections 31
- App user → Sign-in and signup: signs in
app/signup.tsx - Sign-in and signup → Authentication service: authenticates
services/authService.ts - Session and roles → Authentication service: loads roles
contexts/AuthContext.tsx - Authentication service → Firebase client: uses auth
services/authService.ts - Authentication service → Incident records: writes user data
services/authService.ts - App user → User home: views status
- User home → Session and roles: reads session
app/(tabs)/index.tsx - User home → Incident records: loads incidents
app/(tabs)/index.tsx - App user → Capture incident: reports incident
- Capture incident → Session and roles: reads session
app/capture-incident.tsx - Capture incident → Incident records: creates report
app/capture-incident.tsx - Capture incident → Backend API client: posts requests
app/capture-incident.tsx - Backend API client → App backend: sends HTTP
- Capture incident → Agency and categories: uses categories
app/capture-incident.tsx - App user → My reports: reviews reports
- Admin access → Session and roles: checks roles
- Incident triage → Session and roles: reads session
app/admin/incidents.tsx - Incident triage → Incident records: loads incidents
app/admin/incidents.tsx - Incident triage → Agency and categories: uses agency data
app/admin/incidents.tsx - Incident detail → Incident records: loads incident
app/admin/incident-detail.tsx - Incident detail → Video upload and playback: renders video
app/admin/incident-detail.tsx - Super-admin dashboard → Session and roles: reads session
app/admin/super-admin.tsx - Super-admin dashboard → Incident records: loads users and incidents
app/admin/super-admin.tsx - Super-admin dashboard → Incident charts: renders metrics
app/admin/super-admin.tsx - Admin reports → Incident records: reads reports
- Notifications → Incident records: loads notifications
app/(tabs)/notifications.tsx - Incident records → Firebase client: uses Firestore
services/firestoreService.ts - App backend → Backend Firebase: uses Firebase
backend/server.js - App backend → SMS integration: uses SMS
backend/server.js - App backend → Agency email recipient: emails alerts
backend/server.js - App backend → Email transport: sends email