Skip to content

siddhart3000/SafeNest-App

Repository files navigation


React Native TypeScript Firebase EAS Build


Know where your family is. Always. SafeNest delivers live location tracking, device health monitoring, and weather-based safety alerts — all in a dark-cyber UI built for real families.


GitHub Repo Expo Project


✦ What Is SafeNest?

SafeNest is a production-ready mobile application that gives families real-time visibility into each other's location, device status, and local safety conditions — with zero compromise on architecture quality.

Built end-to-end in TypeScript with a React Native (Expo) frontend and Firebase backend, it's engineered for scale: clean service layers, background task handling, and Firestore subscriptions that update live across all family members simultaneously.


⚡ Core Features

📍 Realtime Location Tracking

  • Live family map with Firestore realtime subscriptions
  • Background location sync via Expo Location + Task Manager
  • Online/offline detection using 30-second freshness logic
  • Custom neon-animated map markers per family member

🔋 Device Health Monitoring

  • Live battery percentage sync to Firestore
  • Foreground/background presence tracking
  • Last-seen timestamps logged automatically
  • Status updates triggered without user interaction

🌦️ Weather-Based Safety Engine

Powered by OpenWeatherMap API with a rule-based alert system:

Condition Threshold Action
🌡️ Temperature > 35°C Heat Alert
🧊 Temperature < 10°C Cold Alert
🌧️ Rain Probability > 60% Carry Umbrella
💨 Wind Speed > 40 km/h Stay Cautious
✅ Normal Conditions Safe

👤 Profile & Role Management

  • Avatar upload to Firebase Storage (profiles/{uid}.jpg)
  • Editable display name and role: Parent / Child / Guardian
  • Live battery level + online status visible across all members
  • Realtime profile sync via Firestore listeners

🌙 Dark Cyber UI

  • Global theme system with CSS-like design tokens
  • Custom Google Maps dark styling
  • Neon pulsing marker animations
  • Interactive bottom sheet with member details

🏗️ Tech Stack

Layer Technology
📱 Frontend React Native (Expo SDK 55)
🔤 Language TypeScript
🔐 Auth Firebase Authentication
🗄️ Database Cloud Firestore (Realtime)
🗃️ Storage Firebase Storage
🗺️ Maps react-native-maps
🌤️ Weather OpenWeatherMap API
📦 Build EAS CLI

🔄 Application Flow

App Launch
    │
    ▼
Firebase Auth resolves session
    │
    ▼
Fetch familyId from user document
    │
    ├──► Background tracking service starts
    │         └── Battery + GPS synced to Firestore
    │
    └──► Presence listener attaches
              ├── Foreground → mark online
              └── Background → mark offline
                       └── Sync: currentLocation, lastLocation, lastOnline

Map Screen subscribes to families/{familyId}/members and renders:

  • Animated markers for each member
  • Bottom sheet: Profile · Battery · Weather · Safety Recommendation

📁 Project Structure

SafeNest-App/
├── src/
│   ├── screens/          # App screens (Map, Profile, Auth)
│   ├── components/       # Reusable UI components
│   ├── services/         # All Firebase & API logic (isolated)
│   ├── hooks/            # Custom React hooks
│   ├── theme/            # Global colors, fonts, spacing
│   ├── utils/            # Helpers & formatters
│   └── config/           # Firebase init, env config
├── assets/
├── App.tsx
├── app.json
├── eas.json
├── firestore.rules
└── storage.rules

Design principle: All Firebase logic lives exclusively in /services. Screens and components stay pure and presentation-focused.


🚀 Getting Started

Prerequisites

  • Node.js ≥ 18
  • Expo CLI
  • Firebase project (see setup below)
  • OpenWeatherMap API key

1. Clone & Install

git clone https://github.com/siddhart3000/SafeNest-App.git
cd SafeNest-App
npm install

2. Firebase Setup

  1. Create a Firebase project at console.firebase.google.com
  2. Enable Email/Password Authentication
  3. Enable Firestore (Production Mode)
  4. Enable Firebase Storage
  5. Add your config to src/config/firebase.ts
  6. Deploy rules:
# Apply Firestore + Storage security rules
firebase deploy --only firestore:rules,storage

3. Weather API

# Create .env in root
echo "EXPO_PUBLIC_WEATHER_API_KEY=your_key_here" > .env

Restart the Expo dev server after adding environment variables.

4. Run

npm start

# Then press:
# a  →  Android Emulator
# w  →  Web Browser

📦 Production Build (EAS)

npm install -g eas-cli
eas login

# Preview APK (for testing)
eas build -p android --profile preview

# Production AAB (for Play Store)
eas build -p android --profile production

🎯 Why SafeNest Stands Out

This isn't a tutorial clone. SafeNest solves real engineering problems:

  • Realtime at scale — Firestore subscriptions keep all family members in sync without polling
  • Background reliability — Expo Task Manager keeps location alive even when the app is minimized
  • Presence system — Accurate online/offline state without a WebSocket server
  • Safety intelligence — API data transformed into human-readable, actionable alerts
  • Deployment-ready — EAS builds, security rules, and env config all production-configured
  • Maintainable architecture — Service layer pattern keeps business logic decoupled from UI

Skills demonstrated: Realtime systems · Mobile device APIs · BaaS integration · Deployment pipelines · TypeScript architecture · Clean code


🔮 Roadmap

  • Push notifications (FCM)
  • Geofencing — Home / School zones with entry/exit alerts
  • Web dashboard for Parents
  • Admin analytics panel
  • Location history timeline
  • Granular privacy controls per member

👨‍💻 Author

Siddharth Singh

GitHub

Building things that actually work.


Contributors