Smart Memory & Reminder Intervention for Therapeutic Independence
Offline-first cognitive care for elderly dementia patients in India's North Eastern Region —
clinically-grounded games, daily reminders, and a live caregiver dashboard, in the patient's own language.
Built for SIH26003 (Smart India Hackathon) · Issued by MDoNER · Clinical guidance from LGBRIMH Tezpur + ARDSI Guwahati
Overview · Why SMRITI · Features · Architecture · Cognitive Game Suite · Offline-First Sync · Privacy and Security · Data Model · Tech Stack · Project Structure · Getting Started · Environment Variables · Testing · Documentation · Completed Milestones · Contributing · Disclaimer · License · Acknowledgments
SMRITI is an offline-first Progressive Web App that turns a caregiver's phone into a cognitive-care kit for an elderly relative living with dementia or mild cognitive impairment (MCI). One device, two modes:
- Patient Mode — audio-first cognitive games, daily medication/hydration/activity reminders, and an AI companion, usable by someone who has never touched a smartphone.
- Caregiver Mode — a dashboard that turns gameplay into a traffic-light health signal, tracks reminder adherence, flags sudden cognitive decline, and keeps family notified — all without requiring the patient to be online, literate, or fluent in English.
Everything works with the screen off the internet. When connectivity returns, it syncs silently in the background.
| SMRITI | BrainHQ / Lumosity | |
|---|---|---|
| Works fully offline | Yes | No — online-dependent |
| Audio-first UI in Assamese, Hindi, Bengali, Nepali, Bodo, Manipuri + English | Yes | No — English-only |
| Designed for caregiver-mediated sessions | Yes | No — solo play |
| Games mapped to validated clinical assessments (CANTAB, MoCA, TMT) | Yes | Partial |
| Built for low-literacy, low-vision rural users | Yes | No — Western-normed UX |
| Patient data encrypted on the device and in the cloud backup | Yes | No |
| Monthly running cost | $0 (free tiers) | Subscription |
Note
Supervised, computerized cognitive training shows Hedges' g = 0.57 on global cognition in MCI (2025 meta-analysis, 19 RCTs) — and triples in effect when caregiver-supervised rather than solo. SMRITI is built around that finding, not around solo play.
|
Patient Mode (on caregiver's device)
|
Caregiver Dashboard
|
flowchart TB
subgraph Device["Patient Device — Offline-First PWA"]
direction TB
UI["Games · Reminders · Companion UI"]
Store["Zustand State"]
IDB[("IndexedDB via Dexie.js")]
SW["Service Worker (Workbox)"]
UI --> Store --> IDB
IDB <--> SW
end
subgraph Edge["Vercel — Next.js API Routes"]
direction TB
Push["push (subscribe + tick)"]
Sync["sync"]
Auth["auth"]
Patients["patients"]
Alerts["alerts"]
AICompanion["ai"]
end
subgraph Cloud["Supabase"]
direction TB
PG[("PostgreSQL + Row Level Security")]
SBAuth["Auth — Magic Link + Google"]
RT["Realtime Channels"]
end
subgraph Models["LLM Providers"]
direction TB
Groq["Groq — llama-3.1-8b-instant"]
OR["OpenRouter — fallback"]
end
Caregiver["Caregiver Dashboard"]
SW -->|"sync when online"| Sync
Push -.->|"Web Push: closed-app reminders + caregiver alerts"| SW
Sync --> PG
Auth --> SBAuth
Patients --> PG
Alerts --> PG
AICompanion --> Groq
AICompanion -.->|"if rate-limited"| OR
PG -.->|"push"| RT
RT -.->|"live alerts"| Caregiver
Caregiver --> Patients
Caregiver --> Alerts
Patient-side state never depends on the network: every game write lands in IndexedDB first, and the UI reacts to that local write immediately. The service worker is the only thing that talks to the server.
Every game maps to a validated neuropsychological assessment — this isn't a generic brain-training app with a dementia label stapled on.
| Game | Clinical basis | What it measures |
|---|---|---|
| Object Hunt (Kotha Khoj) | CANTAB Paired Associates Learning | Episodic memory — 81% accuracy classifying normal/MCI/Alzheimer's |
| Word Stream (Xobdo Xuwori) | MoCA Delayed Recall | Verbal memory — 90% sensitivity for MCI detection |
| Quick Tap (Beg Beg) | CANTAB Rapid Visual Processing + BrainHQ Double Decision | Processing speed & inhibitory control |
| Path Match (Baat Milao) | Trail Making Test | Executive function & visual scanning |
Plus 11 more games extending the same four domains — Memory Match, Memory Span, Memory Blocks, N-Back, Routine Recall (memory & recall); Double Decision, Counting Boxes, Larger Number (speed & attention); Frog Leap, Fish Trace (executive function); Reminiscence Quiz (personal, photo-based recall).
flowchart LR
subgraph Episodic["Episodic Memory"]
G1["Object Hunt"]
G2["Memory Match"]
G3["Reminiscence Quiz"]
end
subgraph Recall["Verbal & Working Memory"]
G4["Word Stream"]
G5["Memory Span"]
G6["Memory Blocks"]
G7["N-Back"]
G8["Routine Recall"]
end
subgraph Speed["Processing Speed & Attention"]
G9["Quick Tap"]
G10["Double Decision"]
G11["Counting Boxes"]
G12["Larger Number"]
end
subgraph Executive["Executive Function"]
G13["Path Match"]
G14["Frog Leap"]
G15["Fish Trace"]
end
Episodic -.-> Engine["Adaptive Difficulty Engine"]
Recall -.-> Engine
Speed -.-> Engine
Executive -.-> Engine
Engine -.-> Dashboard["Caregiver Dashboard"]
Object Hunt · Word Stream · Quick Tap · Path Match · Memory Match · Memory Span · Memory Blocks · N-Back · Double Decision · Counting Boxes · Larger Number · Frog Leap · Fish Trace · Family & Life Quiz · Routine Recall
Medication · Hydration · Activity · Appointment
Ask Smriti · Caregiver access · Family message · Seen / done · Could not connect
Two Web Push paths use one service worker and one push_subscriptions table:
| Path | Who receives it | Trigger |
|---|---|---|
| Patient reminders | The patient's installed phone | A scheduler calls GET /api/push/tick every 5 minutes; the server sends due medicine, water, activity and appointment reminders |
| Caregiver alerts | The caregiver's own phone | Sent right after an alert row is created in /api/sync (cognitive drop, missed sessions, low adherence) |
- Notifications are generic ("Time for your medicine"); no medicine names or scores appear on a lock screen.
- The page and the service worker share one due-ness function and an atomic claim store, so a reminder never notifies twice.
- Offline: the service worker also registers Periodic Background Sync and reads reminders from IndexedDB with no network (Chromium installed PWAs, at the browser's own pace). Web Push covers closed-and-online; the open-app poll covers the rest.
- iOS needs the app added to the Home Screen (iOS 16.4+); the opt-in card says so.
- A phone can be a patient-reminder device or a caregiver-alert device, not both; the API returns 409 rather than silently replacing the other.
- No paid dependency: every notification goes over Web Push, so there is no SMS or WhatsApp cost.
Setup steps (migration 016, VAPID keys, CRON_SECRET, scheduler) are in 06_DEPLOYMENT.md.
| Language | UI text | Voice output |
|---|---|---|
| English, Hindi, Assamese | Full | Bundled offline clips (Hindi, Assamese) and Bhashini TTS |
| Bengali | Full | Bhashini TTS |
| Bodo, Manipuri | Full — every string has a confidence rating in translation-review.md; Manipuri is written in Bengali script | Bhashini TTS |
| Nepali | Full | Device voice |
- Voice input is available in Assamese, Hindi and Bengali (Bhashini ASR, with a Whisper fallback).
- Playback order for fixed prompts: bundled clip, then the local speech cache, then live Bhashini, then the device voice, then silent with on-screen text. Another language's audio is never substituted.
- Generate the bundled clips with
npm run audio:synthesize(needs theBHASHINI_*variables). It is throttled, resumable, and writespublic/audio/manifest.jsonanddocs/audio-coverage.json. - Changing the app language is a caregiver-only action: the picker only renders on caregiver screens.
sequenceDiagram
actor Patient
participant App as PWA (Next.js)
participant DB as IndexedDB (Dexie.js)
participant SW as Service Worker
participant API as /api/sync
participant Supabase
Patient->>App: Plays a game
App->>DB: Write telemetry event (synced: false)
DB-->>App: Local write confirmed
App-->>Patient: Instant UI update
Note over SW: Device regains connectivity
SW->>DB: Read unsynced records
SW->>API: POST batch (events, summaries, acks)
API->>Supabase: Insert / upsert rows
Supabase-->>API: OK + server timestamp
API-->>SW: Updated profiles & reminders
SW->>DB: Mark records synced: true
SW-->>App: Update sync indicator
| Data type | Conflict strategy | Why |
|---|---|---|
| Telemetry events | Append-only | Events are immutable facts — no conflicts possible |
| Daily summaries | Server recomputes from events | Single source of truth |
| Patient profiles | Last-write-wins by updatedAt |
Caregiver edits win |
| Reminder schedules | Last-write-wins by updatedAt |
Caregiver is the authority |
| Game difficulty level | Local device is authoritative | Device holds the latest performance data |
- Encrypted on the device. Sensitive fields in the local IndexedDB store are encrypted with AES-256-GCM before they are written; the storage key is held by the phone.
- End-to-end encrypted Memory Bank backup. Names, relationships, places and routines are encrypted on the phone before they reach Supabase, so the cloud copy is ciphertext to everyone with database access. The Memory Bank key is wrapped under a key derived from the caregiver's backup passphrase (PBKDF2-SHA256, 600,000 iterations) and again under a one-time recovery code. Neither ever reaches the server.
- Row Level Security on every table, per caregiver; kiosk voice routes require a signed device-trust token.
- Caregiver PIN with a persistent lockout, layered on a real sign-in.
- Consent is captured during caregiver onboarding.
- Generic notifications. Lock-screen text never carries medicine names or scores.
Details: 03_DATABASE.md (migrations 017 and 018).
erDiagram
CAREGIVERS ||--o{ PATIENTS : manages
CAREGIVERS ||--o{ FAMILY_SHARES : invites
PATIENTS ||--o{ GAME_SESSIONS : plays
GAME_SESSIONS ||--o{ TELEMETRY_EVENTS : logs
PATIENTS ||--o{ DAILY_SUMMARIES : summarized_in
PATIENTS ||--o{ REMINDER_SCHEDULES : has
REMINDER_SCHEDULES ||--o{ REMINDER_ACKS : acknowledged_by
PATIENTS ||--o{ ALERTS : triggers
PATIENTS ||--o{ MEMORY_BANK_ENTRIES : has
PATIENTS ||--o{ AI_CONVERSATION_LOG : chats
PATIENTS ||--o{ REMINISCENCE_QUIZZES : personalized_for
PATIENTS ||--o{ CAREGIVER_DIGESTS : summarized_by
FAMILY_SHARES ||--o{ FAMILY_NOTES : contains
CAREGIVERS {
uuid id PK
text email
text auth_provider
}
PATIENTS {
uuid id PK
uuid caregiver_id FK
text name
int education_years
}
TELEMETRY_EVENTS {
uuid id PK
uuid session_id FK
text game_type
boolean is_correct
int response_time_ms
}
ALERTS {
uuid id PK
uuid patient_id FK
text severity
text reason
}
Full schema, indexes, and Row Level Security policies live in docs/03_DATABASE.md.
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router), React 19, TypeScript |
| Styling | Tailwind CSS v4 |
| State | Zustand |
| Offline storage | Dexie.js (IndexedDB) |
| PWA / offline | next-pwa + Workbox service worker |
| Backend | Supabase — PostgreSQL, Auth, Realtime, Row Level Security |
| AI companion | Groq primary, OpenRouter fallback (model slugs change — see src/lib/ai/llm-client.ts) |
| Speech synthesis | Bhashini TTS (Assamese, Hindi, English, Bengali, Bodo, Manipuri), pre-synthesized bundled clips, browser speechSynthesis fallback |
| Speech recognition | Bhashini ASR (Assamese, Hindi, Bengali) with Groq Whisper fallback |
| Encryption | AES-256-GCM (@noble/ciphers), WebCrypto PBKDF2 key wrapping |
| Push notifications | Web Push (web-push, VAPID) + custom service-worker handlers |
| Forms & validation | react-hook-form + zod |
| Charts | Recharts |
| Motion | Framer Motion |
| Audio | Howler.js |
| i18n | next-intl + locale JSON (English, Hindi, Assamese, Bengali, Nepali, Bodo, Manipuri) |
| Testing | Vitest, Testing Library, fake-indexeddb |
| Accessibility typography | Atkinson Hyperlegible (low-vision optimized), Fraunces, Noto Sans Bengali/Devanagari |
| Deployment | Vercel + Supabase — $0/month on free tiers |
Expand file tree
smriti/
├── public/
│ ├── manifest.json # PWA manifest
│ ├── icons/ # App icons (192, 512, apple-touch)
│ ├── images/ # Game icon set
│ └── audio/ # Pre-synthesized voice prompts + manifest.json (generate with npm run audio:synthesize)
├── src/
│ ├── app/
│ │ ├── page.tsx # Landing page
│ │ ├── app/ # Patient home / game selector
│ │ ├── games/ # 15 game routes
│ │ ├── family/[id]/ # Family message board page
│ │ ├── reminders/ # Reminder flow
│ │ ├── companion/ # "Ask Smriti" AI companion
│ │ ├── login/ # Patient/device login
│ │ ├── caregiver/
│ │ │ ├── dashboard/ # Traffic-light triage
│ │ │ ├── patients/[id]/ # Patient detail + adherence
│ │ │ ├── memory-bank/ # Reminiscence content manager
│ │ │ ├── onboarding/ # New patient setup
│ │ │ ├── add-patient/ # Add another patient
│ │ │ ├── consent/ # Consent capture
│ │ │ ├── device/ # Trusted-device management
│ │ │ ├── settings/ # Language, display size, zoom lock, PIN
│ │ │ └── login/ # Magic link + Google OAuth
│ │ └── api/
│ │ ├── sync/ # Offline → cloud sync
│ │ ├── patients/ # Patient CRUD + timeline
│ │ ├── alerts/ # Cognitive-drop detection
│ │ ├── family-share/ # Family invite + notes
│ │ ├── device-trust/ # Kiosk device trust tokens
│ │ ├── push/ # Web Push subscribe + scheduled tick
│ │ └── ai/ # Companion, digests, transcription
│ ├── components/
│ │ ├── ui/ # Design-system primitives
│ │ ├── games/ # Per-game components
│ │ ├── patient/ # Patient-mode chrome
│ │ └── layout/ # Nav, language picker
│ ├── lib/
│ │ ├── db/ # Dexie schema + sync engine + field encryption
│ │ ├── engine/ # Difficulty, scoring, alerts
│ │ ├── dashboard/ # Cognitive score, activity, trends
│ │ ├── memoryBank/ # End-to-end encrypted Memory Bank backup
│ │ ├── a11y/ # Text size, icon size, zoom lock
│ │ ├── games/ # Difficulty model, level pacing
│ │ ├── ai/ # LLM client (Groq/OpenRouter)
│ │ ├── audio/ # Playback manager, bundled-prompt manifest
│ │ ├── push/ # Web Push sender, subscriptions, tick, alert delivery
│ │ ├── i18n/ # Locales + provider
│ │ └── supabase/ # Client factories, RLS-aware
│ ├── sw/ # Custom service-worker code (push, notification click, periodic sync)
│ ├── hooks/ # useOfflineStatus, useSync, ...
│ └── stores/ # Zustand stores
└── docs/ # PRD, architecture, DB, game design, deployment
Tip
The app lives inside the smriti/ subdirectory of this repo — don't forget the cd.
git clone https://github.com/prathameshfuke/smriti.git
cd smriti/smriti
npm install
cp .env.local.example .env.local
# fill in the keys below, then:
npm run dev
# open http://localhost:3000Install as a PWA on mobile: Add to Home Screen (Android Chrome or iOS Safari).
| Script | Purpose |
|---|---|
npm run dev |
Start the dev server |
npm run build |
Production build |
npm start |
Serve the production build |
npm run lint |
ESLint |
npm test |
Run the Vitest suite once |
npm run test:watch |
Vitest in watch mode |
npm run test:ui |
Vitest browser UI |
npm run audio:synthesize |
Pre-synthesize fixed voice prompts with Bhashini (needs BHASHINI_*; supports --dry-run, --lang, --force) |
| Variable | Required for | Notes |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Sync, caregiver dashboard | Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Sync, caregiver dashboard | Supabase anon/public key |
SUPABASE_SERVICE_ROLE_KEY |
Server-side kiosk/device-trust routes | Never expose to the browser or commit it |
DEVICE_TRUST_SECRET |
Patient-device voice: /api/ai/speak, /api/ai/transcribe, /api/ai/converse |
Long random string (openssl rand -hex 32), server-only. Without it every kiosk voice request is rejected and Hindi/Assamese narration silently drops to the browser voice; the server logs [device-trust] DEVICE_TRUST_SECRET is not set |
GROQ_API_KEY |
AI companion (primary) | Free at console.groq.com/keys |
OPENROUTER_API_KEY |
AI companion (fallback) | Used if Groq is rate-limited/unavailable — free at openrouter.ai/keys |
BHASHINI_USER_ID / BHASHINI_ULCA_API_KEY |
Assamese/Hindi speech-to-text and Assamese/Hindi/English text-to-speech (primary path) | ULCA credential pair from Bhashini — used for the config call in src/lib/ai/bhashini-auth.ts, which resolves the real service and mints the dynamic key the compute call sends |
BHASHINI_INFERENCE_API_KEY |
Legacy fallback for the case above | Kept alongside the pair above: bhashini-asr-client.ts and bhashini-client.ts fall back to it when live service discovery/authentication or primary inference fails; ASR also falls back when the primary response has no valid non-empty transcript |
| Google OAuth credentials | Caregiver "Sign in with Google" | See src/app/api/auth/google/route.ts |
NEXT_PUBLIC_VAPID_PUBLIC_KEY |
Web Push | Public VAPID key from npx web-push generate-vapid-keys; read at build time, so redeploy after setting |
VAPID_PRIVATE_KEY / VAPID_SUBJECT |
Web Push | Private key (server only) and a contact such as mailto:[email protected]. Push is a silent no-op if unset |
CRON_SECRET |
Closed-app reminders | Any long random string you choose; the scheduler sends it as Authorization: Bearer … to /api/push/tick. The route returns 503 if unset |
Note
Games and reminders work fully offline without any of these — only sync and the caregiver dashboard need them. All AI calls are routed through src/lib/ai/llm-client.ts; never call Groq/OpenRouter directly from a feature file.
npm testVitest + Testing Library, with fake-indexeddb standing in for Dexie's IndexedDB backend so offline-storage logic is covered without a browser.
| Doc | Covers |
|---|---|
| 01_PRD.md | Product vision, features, success metrics |
| 02_ARCHITECTURE.md | System design, offline data flow |
| 03_DATABASE.md | Full schema, RLS policies, migrations |
| 04_GAME_DESIGN.md | Clinical specs, difficulty algorithms |
| 06_DEPLOYMENT.md | Deploying to Vercel + Supabase, Web Push setup |
| 07_AGENT_PROMPTS.md | Build guide for AI pair-programming |
| 08_API_SPEC.md | API route reference |
| 09_PITCH_GUIDE.md | Hackathon presentation guide |
| translation-review.md | Every Bodo/Manipuri string with a confidence rating for native-speaker review |
- Phase 1 — Hackathon MVP: core games, rule-based difficulty, Assamese/Hindi/English audio, reminders, caregiver dashboard, offline + sync, installable PWA
- 15 games (vs. 4 planned), ML-assisted difficulty model, AI companion, family notes, caregiver digests, Google OAuth
- Traffic-light triage dashboard, cognitive score, activity panel, weekly leaderboard
- Difficulty that adapts to each patient's recent standing
- Bhashini TTS integration — companion answers + reminder narration, cached locally, browser-TTS fallback
- Bhashini ASR for Assamese, Hindi and Bengali voice input, with a Whisper fallback
- Bengali, Nepali, Bodo and Manipuri UI text
- Web Push reminders when the app is closed, and Web Push alerts to caregivers
- Offline voice-prompt manifest, synthesis tooling and bundled Hindi and Assamese voice
- Fully offline use after setup, including the caregiver dashboard
- Field-level encryption of the local store and an end-to-end encrypted Memory Bank backup with passphrase and recovery code
- Multi-patient support on a shared phone, daily play streaks, and caregiver PIN with lockout
- Two-way family message board with photos and seen acknowledgements
- Consent step in onboarding, and per-device text size, icon size and zoom lock
Contributions are by invitation only. This repo is set up to be worked on alongside an AI coding agent — see AGENTS.md for the Next.js version notes agents should read before touching code, and docs/07_AGENT_PROMPTS.md for the original build-prompt sequence.
Important
SMRITI supports cognitive engagement. It does not diagnose or treat any condition, and does not claim to prevent cognitive decline. Consult a healthcare professional for medical concerns.
It does not: diagnose dementia · require internet connectivity · require digital literacy from patients · store PII or sensitive health data in the cloud.
Proprietary. Copyright © 2026 SMRITI. All rights reserved.
No part of this software, its source code, or its documentation may be copied, modified, distributed, or used without prior written permission from the copyright holder.
Built with clinical guidance from LGBRIMH Tezpur (nodal tertiary geriatric mental health center, NER) and community partnership with ARDSI Guwahati (Alzheimer's and Related Disorders Society of India).
Designed using evidence from CANTAB, MoCA, and 25+ peer-reviewed studies on computerized cognitive training in MCI. Language infrastructure via Bhashini (MeitY) and Project ISHAAN (AI4Bharat).
Built for caregivers and ASHA workers, not wealthy urban users.
back to top
























