Rakshya is a personal safety application for urgent situations: one-tap SOS, optional voice-triggered alerts, live location context, ride monitoring, scheduled check-ins, evidence capture, and encrypted delivery of sensitive payloads to trusted contacts. The product pairs a native mobile app with a public marketing site hosted on GitHub Pages.
| Artifact | Repository / host |
|---|---|
| Mobile app (Expo / React Native) | This Repo - proobker/rakshya_app |
| Landing page & APK distribution links | rakshyaapp/rakshyaapp.github.io (or your fork) |
- Smart SOS — Orchestrates profile + latest GPS fix, optionally encrypts per contact, and queues dispatches to Firebase Firestore (
sos_dispatches). - Voice activation — @react-native-voice/voice listens for a configurable phrase (see
constants.ts: default phrase and fuzzy threshold). On match, the app triggers the same SOS pipeline as a manual alert. - End-to-end encryption — TweetNaCl X25519 / XSalsa20-Poly1305 (
nacl.box); private keys live in Expo SecureStore and are not exported. - Live & background location — expo-location with expo-task-manager defining
TASK_NAMES.BACKGROUND_LOCATIONfor updates while the app is backgrounded (when permitted). - Evidence — expo-camera / expo-av style capture with chunked timing (
EVIDENCE_CHUNK_DURATION_MS); upload path integrates with Firebase Storage via@react-native-firebase/storage. - Ride monitoring —
rideServicelogs GPS on an interval and evaluates route deviation againstRIDE_CONFIG.ROUTE_DEVIATION_THRESHOLD_METERS. - Safe places —
safePlacesServicesurfaces nearby hospital / police / fire_station style POIs within a search radius. - Check-ins —
checkinServicesupports scheduled check-ins with grace periods and geofence radius (CHECKIN_CONFIG). - Fake call —
fakeCallService+app/fake-call.tsxfor a decoy incoming-call style escape aid. - Contacts & profile —
contactsServiceand Zustand stores manage emergency contacts (including optionalpublicKeyfor encryption). - Legal help —
app/legal-help.tsxfor in-app legal / resource content.
| Layer | Technology |
|---|---|
| Framework | Expo SDK ~55 with React Native 0.83 and React 19 |
| Language | TypeScript |
| Navigation | expo-router (file-based routes under app/) |
| State | Zustand (src/stores/useAppStore.ts) |
| Backend | Firebase via @react-native-firebase — Auth, Firestore, Storage |
| Crypto | tweetnacl + tweetnacl-util |
| Maps | react-native-maps |
| Animations | react-native-reanimated, react-native-worklets |
| Voice | @react-native-voice/voice (with patch-package patch under patches/) |
| IDs | uuid |
| Secure storage | expo-secure-store |
| Notifications | expo-notifications (custom sound: assets/ringtone.mp3) |
Native configuration for Android expects google-services.json at the path declared in app.json (android.googleServicesFile). iOS uses the standard GoogleService-Info.plist workflow described in src/services/firebase.ts.
-
Bootstrap —
index.jsregisters the Expo root and wires Expo Router to theapp/directory.react-native-get-random-valuesis imported first so libraries like TweetNaCl have a secure RNG. -
Root layout (
app/_layout.tsx) on launch:- Ensures
getOrCreateKeyPair()has run so encryption keys exist in SecureStore. - Requests location permissions via
locationService. - Registers a background location task with
expo-task-manager(module scope). - When voice activation is enabled and a profile exists, starts
voiceService; the phrase callback loads SOS recipients and callstriggerSOS(profile, contacts, 'voice').
- Ensures
-
Manual SOS — UI components (e.g.
SOSButton) ultimately calltriggerSOSwithtriggerMethodsuch as'voice'or implied manual flow. The service:- Reads GPS via
getCurrentLocation(). - Builds an
SOSAlertobject (id, profile snapshot, location, timestamp, recipients). - For each contact: if
contact.publicKeyis set, encrypts the JSON payload withencryptionService.encrypt; otherwise sends plaintext (implementation choice — production systems often require keys for all recipients). - Writes rows to Firestore
sos_dispatcheswith channels (notifyViaSMS,notifyViaPush, etc.).
- Reads GPS via
-
Cancellation —
cancelSOS(alertId)queries dispatches byalertIdand batch-updates status tocancelled. -
Encryption —
encryptionServicegenerates an X25519 keypair, stores secret and public keys in SecureStore, and usesnacl.boxfor encrypt/decrypt andencryptBinaryfor media-style blobs. -
State — Multiple Zustand slices isolate profile, contacts, SOS, check-ins, rides, safe places, fake call, settings for predictable UI updates.
| File | Purpose |
|---|---|
package.json |
Scripts: expo start, expo run:android / ios, web; postinstall: patch-package for dependency patches. |
app.json |
Expo app name Rakshya, slug, deep link scheme rakshya, icons, splash, iOS Info.plist usage strings, Android permissions (location, camera, mic, foreground services), expo-router, expo-secure-store, expo-location, expo-camera, expo-notifications plugins. |
tsconfig.json |
TypeScript compiler options for the project. |
metro.config.js |
Metro bundler configuration for React Native. |
index.js |
Application entry: Expo Router root registration. |
App.tsx |
Legacy / placeholder root component (Expo template-style); expo-router is the real UI host. |
constants.ts |
Global design tokens (Colors, Spacing, FontSize), SOS / check-in / ride / safe-places / encryption tuning constants, TASK_NAMES, and a FIREBASE_CONFIG placeholder object (native apps rely on google-services.json / plist — see src/services/firebase.ts). |
| Path | Role |
|---|---|
_layout.tsx |
Root Stack layout: encryption init, permissions, background task registration, voice listener lifecycle. |
(tabs)/_layout.tsx |
Tabs navigator — primary shell (home, safety, contacts, profile). |
(tabs)/index.tsx |
Main / home tab. |
(tabs)/safety.tsx |
Safety hub (SOS, monitoring, related controls). |
(tabs)/contacts.tsx |
Emergency contacts management. |
(tabs)/profile.tsx |
User profile and medical / identity fields for alerts. |
evidence.tsx |
Evidence viewing / session flow. |
fake-call.tsx |
Fake incoming call experience. |
legal-help.tsx |
Legal / help resources screen. |
| File | Role |
|---|---|
SOSButton.tsx |
Primary SOS control UI / interaction. |
SafetyCard.tsx |
Reusable card for safety-related dashboard items. |
| File | Role |
|---|---|
index.ts |
Shared constants export (may mirror or extend root constants.ts patterns). |
| Path | Role |
|---|---|
firebase.ts |
Side-effect imports for @react-native-firebase modules; isFirebaseInitialized() helper; setup documented in comments. |
encryption/encryptionService.ts |
Key generation, SecureStore persistence, encrypt / decrypt / encryptBinary. |
sos/sosService.ts |
triggerSOS, cancelSOS, Firestore sos_dispatches writes. |
location/locationService.ts |
Permissions, current position, background updates integration. |
voice/voiceService.ts |
Start/stop speech recognition; phrase matching against SOS_CONFIG. |
contacts/contactsService.ts |
Load SOS recipients and contact persistence helpers. |
evidence/evidenceService.ts |
Recording chunks, local files, upload hooks. |
checkin/checkinService.ts |
Scheduled check-in and geofence logic. |
ride/rideService.ts |
Active ride logging and deviation detection. |
safeplaces/safePlacesService.ts |
Nearby safety POIs. |
fakecall/fakeCallService.ts |
Fake call timing and state driving fake-call screen. |
| File | Role |
|---|---|
useAppStore.ts |
Zustand stores: profile, contacts, SOS, check-ins, rides, safe places, fake call, settings toggles (voice, background location, auto evidence). |
| File | Role |
|---|---|
index.ts |
Shared domain types (UserProfile, EmergencyContact, SOSAlert, EncryptedPayload, etc.). |
App icon, adaptive Android icon layers, splash image, favicon, and ringtone.mp3 for notification plugin configuration.
| File | Role |
|---|---|
@react-native-voice+voice+3.1.5.patch |
patch-package fix for the voice library under your Expo / RN versions. |
JetBrains IDE project metadata (optional in open-source checkouts; many teams gitignore this).
Prerequisites: Node.js (LTS), Expo CLI workflow, Xcode (iOS, macOS), Android Studio / SDK (Android). Install Java and Android tooling as required by Expo prebuild / dev client.
git clone https://github.com/proobker/rakshya_app.git
cd rakshya_app
npm install # runs patch-package via postinstall- Add Firebase Android
google-services.json(path must matchapp.json). - For iOS, add
GoogleService-Info.plistvia Xcode afterexpo prebuildor EAS workflow. - Enable Authentication, Cloud Firestore, and Storage in the Firebase console; define security rules appropriate for production (the app writes
sos_dispatchesand evidence paths per your rules).
npm run start # Expo dev server
npm run android # Native Android run (dev client / prebuild as applicable)
npm run ios # Native iOS runEnvironment / secrets: Replace placeholder FIREBASE_CONFIG in constants.ts if you use the JS SDK anywhere; @react-native-firebase reads native config files at runtime. Never commit real API keys in public repos — use EAS secrets or local untracked config where appropriate.
Static GitHub Pages landing: no build step required.
| File | Purpose |
|---|---|
index.html |
Semantic sections: hero, story timeline, features, security copy, demo video, download CTAs (APK + iOS placeholder), footer with social links. Uses Inter from Google Fonts and demo.mp4 / favicon.png. |
styles.css |
Design system (CSS variables), layout grids, sticky story section driven by --story-progress, responsive breakpoints, reduced-motion media query, footer / CTA polish. |
script.js |
Smooth in-page anchors, IntersectionObserver reveal animations, parallax-style hero phone tilt (pointer + requestAnimationFrame), scroll-synced story slides, navbar scroll state, footer load transition. |
.gitignore |
Ignores *.apk (optional — keeps built binaries out of git if present locally). |
Rakshya is not a substitute for emergency services (police / ambulance). Use it as a supplement with clear user expectations and jurisdiction-appropriate disclaimers on store listings and in-app.
See LICENSE
- Mobile source: github.com/proobker/rakshya_app
- Expo: docs.expo.dev
- React Native Firebase: rnfirebase.io