GuardianX is a silent, proactive personal safety application designed for real-world emergencies where the user may not be able to interact with their phone. It's not a panic buttonโit's a complete safety system that works hands-free.
GuardianX is a hands-free emergency detection system that:
- Works without unlocking the phone
- Works without touching the screen
- Works without speaking
- Uses real-time gesture recognition via MediaPipe
- Automatically shares location with emergency contacts
- Logs all emergency events for accountability
- Framework: React Native (CLI, not Expo)
- Platforms: Android & iOS
- UI Theme: Teal + Light Background (calm, professional, reassuring)
- Key Features:
- Guardian Mode (system state management)
- MediaPipe gesture detection (clenched fist for 3 seconds)
- Real-time location tracking
- Emergency flow orchestration
- Calm, professional UI
- Framework: Express.js
- Database: MongoDB
- SMS Service: Twilio (with fallback simulation)
- APIs:
- User registration/login
- Guardian mode management
- Emergency logging
- Emergency contact management
- Emergency history
GuardianX/
โโโ Backend/
โ โโโ config/
โ โ โโโ db.js # MongoDB connection
โ โโโ controllers/
โ โ โโโ userController.js # User & guardian mode logic
โ โ โโโ emergencyController.js # Emergency logging logic
โ โโโ models/
โ โ โโโ User.js # User schema
โ โ โโโ EmergencyLog.js # Emergency log schema
โ โโโ routes/
โ โ โโโ userRoutes.js # User routes
โ โ โโโ sosRoutes.js # SOS routes (legacy)
โ โ โโโ emergencyRoutes.js # Emergency log routes
โ โโโ utils/
โ โ โโโ smsService.js # Twilio SMS service
โ โโโ server.js # Express server
โ
โโโ mobile/
โโโ src/
โ โโโ components/ # Reusable UI components
โ โโโ context/
โ โ โโโ GuardianContext.js # Global state management
โ โโโ navigation/
โ โ โโโ AppNavigator.js # Navigation setup
โ โโโ screens/
โ โ โโโ DashboardScreen.js # Main dashboard
โ โ โโโ GuardianModeScreen.js # Guardian Mode status
โ โ โโโ EmergencyDetectedScreen.js # Emergency feedback
โ โ โโโ ... # Other screens
โ โโโ services/
โ โ โโโ api.js # API client
โ โ โโโ gestureDetection.js # MediaPipe gesture detection
โ โ โโโ emergencyFlow.js # Emergency orchestration
โ โ โโโ locationTracking.js # Location tracking service
โ โโโ utils/
โ โโโ theme.js # Design system (teal theme)
โโโ App.js # App entry point
- Node.js 16+
- MongoDB (local or Atlas)
- React Native CLI
- Android Studio / Xcode (for mobile development)
- Twilio account (optional, for SMS)
- Install dependencies:
cd Backend
npm install- Configure environment:
Create a
.envfile:
MONGODB_URI=mongodb://localhost:27017/guardianx
TWILIO_ACCOUNT_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_token
TWILIO_PHONE_NUMBER=your_twilio_number- Start MongoDB (if local):
mongod- Start backend server:
npm run devServer runs on http://localhost:5000
- Install dependencies:
cd mobile
npm install- Configure API URL:
Update
mobile/src/services/api.js:
const API_BASE_URL = __DEV__
? 'http://YOUR_LOCAL_IP:5000/api/users' // Use your computer's IP
: 'https://your-backend-url.com/api/users';- Run on Android:
npm run android- Run on iOS:
npm run ios- User taps the shield icon on Dashboard
- System activates:
- Gesture detection (MediaPipe)
- Location tracking
- Route monitoring
- User navigates to Guardian Mode screen to see status
Gesture-Based SOS:
- User holds clenched fist for 3 seconds
- MediaPipe detects gesture in real-time
- System triggers emergency flow
Manual SOS:
- User taps "Alert" button
- System triggers emergency flow
When emergency is detected:
- GPS Location: Fetches current location with high accuracy
- SMS Alert: Sends SMS to all emergency contacts with:
- User's name
- Google Maps link to location
- Timestamp
- Backend Logging: Logs emergency event to database
- UI Feedback: Shows calm "Emergency detected. Help is on the way." screen
All emergencies are logged with:
- User ID
- Trigger type (gesture, manual, motion, route_deviation)
- Location (lat/lng, accuracy, address)
- SMS status
- Contacts notified
- Timestamp
- Uses MediaPipe Hands for real-time gesture recognition
- Detects clenched fist gesture
- Tracks gesture duration (3 seconds threshold)
- Works in background when Guardian Mode is active
- Orchestrates complete emergency response
- Gets GPS location
- Sends SMS via backend
- Logs to backend
- Handles errors gracefully
- Continuous location updates (every 5 seconds or 10 meters)
- Background location support
- Location history
- Route deviation detection
- Start Backend:
cd Backend
npm run dev- Start Mobile App:
cd mobile
npm start- Demo Steps:
- Register/Login
- Add emergency contacts
- Activate Guardian Mode
- View Guardian Mode screen (shows system status)
- Trigger emergency (gesture or manual)
- See Emergency Detected screen
- Check backend logs for emergency event
- Check SMS (or console logs if Twilio not configured)
Color Palette:
- Primary:
#14B8A6(Teal) - Background:
#F8FAFC(Light gray-blue) - Surface:
#FFFFFF(White) - Success:
#10B981(Green) - Danger:
#EF4444(Red)
Typography:
- Hero: 32px
- Title: 22px
- Subtitle: 16px
- Body: 14px
- Caption: 12px
Android:
CAMERA- For gesture detectionACCESS_FINE_LOCATION- For GPS trackingACCESS_BACKGROUND_LOCATION- For background trackingSEND_SMS- For SMS alerts (optional, handled by backend)
iOS:
NSCameraUsageDescription- For gesture detectionNSLocationWhenInUseUsageDescription- For location trackingNSLocationAlwaysAndWhenInUseUsageDescription- For background tracking
# Test emergency logging
curl -X POST http://localhost:5000/api/emergencies \
-H "Content-Type: application/json" \
-d '{
"userId": "USER_ID",
"triggerType": "manual",
"location": {
"latitude": 37.7749,
"longitude": -122.4194
}
}'
# Get emergency logs
curl http://localhost:5000/api/emergencies/user/USER_ID- Test gesture detection (simulated in current implementation)
- Test location tracking
- Test emergency flow end-to-end
- Verify SMS sending (check Twilio console or backend logs)
-
MediaPipe Integration:
- Current implementation uses simulated gesture detection
- For production: Integrate
@mediapipe/handsor native MediaPipe SDK - Consider performance optimization for continuous detection
-
Background Execution:
- Implement background tasks for gesture detection
- Use background location updates
- Handle app state changes (foreground/background)
-
Security:
- Add authentication tokens (JWT)
- Encrypt sensitive data
- Secure API endpoints
- Rate limiting
-
Performance:
- Optimize MediaPipe detection (reduce frame rate when idle)
- Batch location updates
- Cache emergency contacts
-
Reliability:
- Retry logic for SMS sending
- Offline queue for emergencies
- Fallback mechanisms
POST /api/users/register- Register userPOST /api/users/login- Login userPUT /api/users/guardian-mode/:id- Toggle guardian modePUT /api/users/contacts/:id- Update emergency contactsGET /api/users/contacts/:id- Get emergency contacts
POST /api/emergencies- Log emergency eventGET /api/emergencies/user/:userId- Get user's emergency logsPUT /api/emergencies/:emergencyId- Update emergency status
POST /api/users/:id/sos- Trigger SOS (legacy endpoint)
- Terminal Logs: Backend shows detailed logs for all operations
- SMS Simulation: If Twilio not configured, SMS is logged to console
- Emergency Flow: Complete flow is visible in terminal
- UI Feedback: Emergency Detected screen shows clear status
- Guardian Mode: Status screen shows all system indicators
This project is built for hackathon demonstration purposes.
Built with โค๏ธ for real-world safety.
GuardianX v2 - Silent. Proactive. Reliable.