Architecture
Stack (reuses the Udhaar Khata stack)
- App: Flutter (Material 3), Riverpod, Dio, sqflite (offline), flutter_secure_storage,
flutter_local_notifications (on-device reminders), flutter_launcher_icons.
- Backend: Node 20 + Express + PostgreSQL 18, port 8043, JWT + OTP auth.
- WhatsApp: wa-hub (triotoonz) — shared token
/root/.config/wa-hub.env. Central template store
(wa_templates) like Udhaar. NOT the Vedamrita getaseed sender.
- Admin: static web SPA at
/admin + an admin API (separate admin token), served by the backend.
- Payments: Razorpay (subscriptions) + webhook.
- Hosting: nginx vhost
gharsaathi.itsmehere.com (/ landing, /docs, /admin), SSL via certbot;
API reverse-proxied (api.gharsaathi.itsmehere.com → 127.0.0.1:8043). systemd gharsaathi-backend
gharsaathi-scheduler.timer.
High-level
Flutter app ──HTTPS/JWT──> Node/Express API ──> PostgreSQL
│ (local notifications fire on-device) │
│ ├─> wa-hub (OTP, family alerts, WA reminders, list share)
└── offline cache + outbox sync └─> Razorpay (subscriptions) + webhook
Admin SPA ──admin token──> Admin API ─────────────┘
Reminder delivery model (key design)
- On-device local notifications handle daily habit + medicine + expiry reminders — work offline,
free, no FCM/Firebase dependency (ponytail). Scheduled on the phone from the user's reminders.
- Server scheduler (
gharsaathi-scheduler, every 5 min via systemd timer) handles things the
phone can't do alone: family miss-alerts (medicine not marked taken in time → WhatsApp to family),
expiry WhatsApp nudges, and Pro "WhatsApp reminder" delivery.
- No Firebase in v1. FCM cross-device push can be added later.
Data model themes
- One
reminders table with type (habit|medicine|expiry) + a schedule; reminder_logs for
done/missed. grocery_items for lists. users (phone). family_links. subscriptions.
- Money/entitlement:
subscriptions.plan (free|pro) + status drive feature gates, enforced server-side.
Security / conventions (same rails as Udhaar)
- Secrets in root-only
.env (gitignored); JWT HS256 pinned; parameterized SQL only; helmet;
rate-limited OTP (hashed, expiry, lockout); every query scoped by user_id from JWT.
- Admin API behind a separate
ADMIN_TOKEN / admin login, never the user JWT.
- Razorpay webhook signature verified.