ResQ is a real-time emergency coordination platform for heaalth facility teams. It is built to reduce the "third delay" by improving how staff detect, broadcast, assign, and resolve emergencies after a patient reaches a facility.
- Real-time emergency alerts with severity and workflow status tracking.
- Role-aware dashboards for operations and administration.
- Patient registration flow tied to triage context and room assignment.
- Duty assignment management for shifts.
- Firebase Authentication with Google sign-in.
- Firestore-backed live updates and offline-friendly behavior.
- AI voice alert generation (Gemini TTS) for broadcast workflows.
- Lightweight health endpoint at
/api/health.
- Next.js 15 (App Router)
- React 19
- TypeScript
- Tailwind CSS 4
- Firebase Auth + Firestore
- Sonner (toasts), Lucide (icons), Motion (animation)
- Google GenAI SDK (
@google/genai) for voice alerts
- Node.js 20+ recommended
- npm 10+
- A Firebase project with Auth and Firestore enabled
- A Gemini API key if you want text-to-speech voice alerts
- Install dependencies:
npm install- Create
.env.localand add:
NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key- Start the dev server:
npm run dev- Open:
http://localhost:3000
npm run dev- start development servernpm run build- build for productionnpm run start- run production servernpm run lint- run TypeScript type check (tsc --noEmit)
The app currently imports Firebase config from firebase-applet-config.json directly in src/firebase.ts.
- If you use a different Firebase project, replace values in
firebase-applet-config.json. - Make sure Firestore rules in
firestore.rulesare deployed to your target project. - This app depends on these collections:
usersusers_publicuser_invitationsalertspatientsduty_assignments
- Sign-in is Google-based.
- Invites are created by admins in
user_invitationsusing normalized email as doc ID. - On first login, invited users claim their profile and create
users/{uid}. - Roles include:
ADMIN,DOCTOR,NURSE,DISPATCHER,ANESTHETIST,MID_WIFER,NEONATAL_TEAM.
- Firestore multi-tab IndexedDB persistence is enabled in the browser.
- Offline mutations are queued in local storage and replayed when connectivity returns.
- Cached user profile and queued actions are managed by
src/services/offlineService.ts.
GET /api/health- Returns
{ status, timestamp, version, environment }
- Returns
-
Voice alerts fail with missing key:
- Ensure
NEXT_PUBLIC_GEMINI_API_KEYexists in.env.local.
- Ensure
-
Firestore permission errors after login:
- Verify your user has a valid role/profile document in
users. - Confirm rules are deployed and match your active Firebase project.
- Verify your user has a valid role/profile document in
-
Service worker caching issues in local dev:
- Service worker registration is production-only (
NODE_ENV === "production").
- Service worker registration is production-only (