Skip to content

pufferfish3e/fallback

Repository files navigation

FallBack

FallBack is privacy-first fall detection for seniors living alone.

Instead of forcing families to choose between invasive cameras and unreliable wearables, FallBack pairs a wall-mounted mmWave radar + ESP32 sensor with a family-facing dashboard, instant Telegram alerts, and weekly wellbeing insights.

One-line pitch

No camera. No wearable. No dignity-surveillance tradeoff.

If a senior falls, FallBack detects it, stores it, alerts family on Telegram, and opens a live dashboard with enough context to act fast.

Problem

Falls are high-frequency, high-consequence events for older adults, especially when they live alone.

Current options break down fast:

  • Cameras give visibility, but most families do not want them in bedrooms or bathrooms.
  • Wearables can work, but only when they are actually worn.
  • That creates a bad binary: privacy or reliability.
  • For seniors over 80, annual fall risk can reach 1 in 2.
  • In Singapore, falls account for more than 85% of elderly trauma cases.
  • Every delay between incident and response increases harm.

Solution

FallBack removes that tradeoff.

  • Passive sensing: a wall-mounted mmWave radar watches for falls without capturing camera footage.
  • On-device relay: an ESP32 publishes fall telemetry.
  • Immediate alerting: emergency contact gets a Telegram alert instantly.
  • Family dashboard: dashboard shows fall details, history, movement patterns, and wellbeing signals.
  • Pattern awareness: weekly summaries flag changes in stillness, activity, and fall risk patterns.

Result: families get signal fast, seniors keep privacy and dignity.

What this repo contains

This repo holds hackathon web app for FallBack:

  • Landing page for product story and sign-in
  • Onboarding flow for resident name, address, and sensor link code
  • Family dashboard at /dashboard
  • Persistent fall alert pipeline backed by Supabase
  • Telegram bot linking + notifications
  • BLE test surface at /test for live sensor pairing or manual fall simulation
  • Weekly AI digest for caregiver-friendly summaries

Demo flow

Fastest judge demo:

  1. Open /dashboard in one tab.
  2. Open /test in another tab.
  3. Trigger manual fall event or pair BLE sensor named FallDetector.
  4. Watch alert persist, overlay appear on dashboard, and event land in recent history.
  5. Show Telegram alert flow and wellbeing summary.

If hardware is unavailable, /test still supports full-path manual alert simulation.

Product features

1. Fall alerts that do not disappear

  • Fall alerts are stored in public.fall_alerts
  • Dashboard loads pending alerts on render
  • Alerts stay visible in recent history after acknowledgement or resolution

2. Family-facing monitoring surface

Dashboard is not generic admin UI. It is built for family caregivers:

  • last fall event
  • wellbeing score
  • weekly trend chart
  • risk flags
  • sensor status
  • recent fall history

3. Telegram escalation

When a fall is created, FallBack can:

  • notify linked Telegram contact
  • deep-link back into dashboard
  • support one-time Telegram account linking

4. Live sensor testing

/test supports two paths:

  • real BLE telemetry from ESP32 sensor
  • manual queued alert for demos and fallback testing

BLE/browser path is built for Chrome or Edge with Web Bluetooth support.

5. Weekly digest AI

Weekly caregiver summary is generated from activity and fall data, then cached. If OpenAI config is absent, app degrades safely without blocking dashboard.

Architecture

mmWave radar -> ESP32 -> BLE/Web app test surface
                         -> POST /api/fall-alerts
                         -> Supabase public.fall_alerts
                         -> Dashboard overlay + history
                         -> Telegram notification
                         -> Weekly insight pipeline

Tech stack

  • Next.js 16
  • React 19
  • TypeScript
  • Tailwind CSS v4
  • framer-motion
  • Clerk for auth
  • Supabase for app data
  • Telegram Bot API for caregiver alerts
  • OpenAI Responses API for weekly digest generation

Key routes

  • / - landing page
  • /login - auth entry
  • /onboarding - resident setup
  • /dashboard - caregiver dashboard
  • /test - BLE + manual alert testing
  • /telegram/connect - Telegram linking flow
  • /api/fall-alerts - persist fall alerts
  • /api/telegram/bot - Telegram bot webhook
  • /api/webhooks/clerk - Clerk user sync webhook
  • /api/dashboard/weekly-summary - AI digest generation

Local setup

1. Install deps

npm install

2. Create env file

Create .env.local with these variables:

NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
SUPABASE_SERVICE_ROLE_KEY=

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
CLERK_WEBHOOK_SIGNING_SECRET=

NEXT_PUBLIC_TELEGRAM_BOT_USERNAME=
TELEGRAM_BOT_TOKEN=

OPENAI_API_KEY=
OPENAI_MODEL=

Notes:

  • OPENAI_API_KEY and OPENAI_MODEL are optional if you only want core dashboard flow.
  • Telegram bot features need a public URL for webhook delivery.
  • Clerk webhook sync also needs a reachable public endpoint when testing full signup sync.

3. Set up database

Apply SQL migrations in supabase/migrations.

Important tables/features:

  • public.users
  • public.fall_alerts
  • public.telegram_link_tokens
  • weekly digest cache tables from latest migrations

4. Run app

npm run dev

Open http://localhost:3000.

Sensor contract for live demo

Current BLE integration expects:

  • device name: FallDetector
  • service UUID: 12345678-1234-1234-1234-123456789012
  • characteristic UUID: 87654321-4321-4321-4321-210987654321

Telemetry payload shape:

{
  "presence": 1,
  "motion": 2,
  "movement": 18.4,
  "fallen": false
}

Early demand signal

From team survey data:

  • survey size: 32 caregivers
  • preferred monitoring method: passive radar
  • preference rate: 81%
  • top needs: privacy and peace of mind

Built for hackathon, shaped for real deployment

Current prototype already demonstrates:

  • privacy-preserving fall detection UX
  • persistent incident storage
  • caregiver notification loop
  • cross-tab live dashboard alerts
  • BLE-based sensor relay
  • AI-generated weekly summaries

Next Steps

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors