How musthafaak56/nahdimandi works
1. This is a single-page React app built with Vite and deployed on Firebase Hosting. The runtime is browser-based, with Firebase services providing auth, database, messaging, and hosting integration.
2. The application has two major user paths: a public customer flow and a protected admin flow. Public pages include the landing/join experience and live status tracking; admin pages are behind authentication and expose operational controls, queue history, analytics, and support/contact tooling.
3. Routing is organized by page-level components under src/pages. The key routes are / and /join for check-in, /status?id={queueId} for customer tracking, /admin/login for authentication, and /admin for the dashboard. ProtectedRoute is the main boundary that keeps admin-only views gated.
4. Queue state is stored in Firestore using a date-scoped model. The primary customer record lives under customers_per_day/{dateKey}/entries/{queueId}, while queue_counters/{dateKey} ensures sequential numbering per day. This makes daily operational resets a first-class part of the data model.
5. There is a deliberate privacy boundary between internal queue data and customer-visible state. queue_public/{queueId} mirrors only non-sensitive queue/order fields so customers can see status and position without access to personal details like phone number or location.
6. Live queue behavior is driven by Firebase Auth and Firestore realtime reads/writes. Anonymous auth is used for customer sessions, while admin users use email/password. AuthProvider likely centralizes user/session state, and Firestore updates drive UI refreshes across both customer and admin screens.
7. Notifications and mobile-style “table ready” behavior are handled with Firebase Cloud Messaging. The repo includes a service worker at public/firebase-messaging-sw.js, and src/lib/notifications.js plus src/lib/sound.js indicate the app can combine push notifications with in-browser alerts for queue readiness.
8. Location-aware logic is a separate support subsystem. src/lib/geofence.js, src/lib/phone.js, src/lib/time.js, and shared/storeLocations.js suggest reusable domain logic for validating check-in location, formatting/normalizing local phone numbers, and handling date/time queue behavior consistently across views.
9. The admin dashboard is not just CRUD; it includes operational history and analytics. AdminDashboardPage, AdminHistoryView, SummaryBar, and StatusBadge imply a dashboard that summarizes active queues, paginates historical records, and computes business metrics like peak hours/days/dates from stored queue history.
10. Support and escalation are modeled explicitly. Firestore contains support_tickets/{ticketId}, and the dashboard has an Admin Contact tab with ticket creation plus shared contact information. The README notes a super-admin inbox restriction, so this is a privileged support workflow layered on top of the main queue system.
11. There is a separate demo/pitch/video subsystem under src/remotion. That code is for generating presentation videos or demo content, not core queue operations. It is architecturally distinct from the live app UI, even though it reuses project theme/UI concepts.
12. Testing and operational automation are split out cleanly. tests/e2e with Playwright covers queue flows end to end, while scripts/seed-admins.mjs seeds privileged admin records in Firestore. This indicates the app depends on both authenticated setup and realistic browser flow verification.
13. Firebase configuration is an important external boundary. The app depends on Auth providers, Firestore rules and indexes, and FCM/VAPID setup; firebase.json, firestore.rules, and firestore.indexes.json are core infrastructure artifacts, not incidental config.
14. Overall, the architecture centers on a realtime queueing domain: customer check-in creates a dated queue entry, queue counters assign the next number, a public mirror exposes safe status updates, and admin tooling updates queue state while tracking history, analytics, and support. The main diagram should emphasize the split between public customer surfaces, admin-only operations, and Firestore as the shared source of truth.
Main entry points: App.jsx App router · AdminDashboardPage.jsx Dashboard · queue.js Queue logic · JoinPage.jsx Join page
Components 21
App shell
Browser entry, routing, and cross-cutting providers
- Main entry · Starts the browser app and mounts the UI
src/main.jsx - App router · Top-level routing and application composition
src/App.jsx - Auth provider · Centralizes Firebase auth/session state for the app
src/components/AuthProvider.jsx - Protected route · Guards admin-only views behind authentication
src/components/ProtectedRoute.jsx
Customer flow
Public check-in and live status experience
- Join page · Public check-in and queue creation flow
src/pages/JoinPage.jsx - Status page · Public live queue status and position view
src/pages/StatusPage.jsx - Queue card · Displays customer queue details and status
src/components/QueueCard.jsx
Admin ops
Authenticated dashboard, history, and support tooling
- Admin login · Email/password login for admin users
src/pages/AdminLoginPage.jsx - Dashboard · Primary operational dashboard for live queue control
src/pages/AdminDashboardPage.jsx - History view · Paginated queue history and business metrics
src/components/AdminHistoryView.jsx - Contact view · Admin support tickets and shared contact actions
src/components/AdminContactView.jsx - Summary bar · Shows active queue summaries and operational metrics
src/components/SummaryBar.jsx - Status badge · Small status/priority indicator used across queue views
src/components/StatusBadge.jsx
Domain logic
Shared queue, time, location, and support helpers
- Queue logic · Queue reads, writes, counters, and public/private state mapping
src/lib/queue.js - Support logic · Support ticket and escalation helpers
src/lib/support.js - Location utils · Geofence, phone normalization, and time/date helpers
src/lib/geofence.js - Store locations · Reusable store/location data for geofence and check-in rules
shared/storeLocations.js
Firebase + automation
Hosting, data model, messaging, and setup scripts
- Notifications · Push notifications and in-browser readiness alerts
src/lib/notifications.js - Firebase client · Firebase Auth, Firestore, and messaging integration
src/lib/firebase.js - Messaging SW · Firebase Cloud Messaging service worker for background delivery
public/firebase-messaging-sw.js
Demo media
Remotion-based pitch/demo video subsystem
- Pitch video · Remotion scene graph for pitch/demo video generation
src/remotion/PitchVideo.jsx
Connections 24
- Main entry → App router: boots · Browser entry mounts the routed app
- App router → Auth provider: wraps · App composition provides session state
- App router → Join page: routes · Public check-in route
- App router → Status page: routes · Public status route
- App router → Admin login: routes · Admin authentication route
- App router → Protected route: guards · Admin area is behind auth gate
- Protected route → Dashboard: unlocks · Authenticated access to dashboard
- Join page → Queue logic: creates · Check-in creates dated queue entries
- Status page → Queue card: renders · Status page displays queue state
- Status page → Queue logic: reads · Customer view subscribes to queue state
- Dashboard → Summary bar: shows · Dashboard includes live operational metrics
- Dashboard → History view: reviews · Dashboard exposes historical queue records
- Dashboard → Contact view: supports · Dashboard exposes support/contact tooling
- Dashboard → Status badge: uses · Shared status visualization across ops screens
- History view → Queue logic: queries · History view reads queue history and analytics inputs
- Contact view → Support logic: opens · Support workflow creates and manages tickets
- Queue logic → Firebase client: persists · Queue state is stored and observed in Firestore
- Support logic → Firebase client: persists · Support tickets use Firebase data services
- Location utils → Store locations: uses · Location validation depends on shared store data
- Join page → Location utils: validates · Customer intake checks location, phone, and time rules
- Queue logic → Notifications: triggers · Queue readiness can send push or local alerts
- Notifications → Messaging SW: delivers · Background FCM delivery via service worker
- Notifications → Firebase client: configures · Messaging uses Firebase SDK setup
- Pitch video → App router: shares theme · Demo media reuses project UI/theme concepts