Commit graph

22 commits

Author SHA1 Message Date
ab937c4e9d feat: Telegram alerting + public health probe + Umami visitor digest
Launch-critical monitoring wiring — alerts go to tiaBaby_Bot via Telegram.

- src/lib/alert.ts: sendAlert(level, title, detail?, {fields, silent}) — HTML
  formatted, IST timestamped, best-effort (never throws). Env: TELEGRAM_BOT_TOKEN,
  TELEGRAM_CHAT_ID
- GET /api/healthz: public, no-auth liveness probe (200 ok / 503 down) for
  Uptime Kuma + Dokploy healthcheck. No sensitive detail
- cron/backup: alert on failure (fatal), warn if dump < 1KB (empty), silent
  success confirmation with file + size
- cron/monitor: error-spike rising-edge detection (last 1h > 5 and > 2x prior
  hour — stateless, no re-alert on flat rate), DB/migrations/integration checks.
  ?test=1 sends a Telegram test ping
- cron/visitor-summary: polls Umami REST API (login -> stats/metrics/active),
  posts visitor digest to Telegram. ?hours=N window (default 24)
- CLAUDE.md: new env vars + Monitoring & Alerting section

Health up/down flip detection is delegated to Uptime Kuma (pings /api/healthz);
this code covers what Kuma can't see from outside.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 22:01:18 +05:30
67f7c4836d docs: warn that migration journal when must exceed the last applied
Drizzle's migrator applies a migration only when its journal `when` is greater
than the max created_at already recorded. Entries 0003-0010 were given 2025-era
timestamps (smaller than the 2026 baseline), so drizzle silently skipped them —
they only applied via the debug-migration hot-apply endpoint. Document the rule.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 09:55:35 +05:30
e2a3e83638 docs+fix: overhaul CLAUDE.md + expose emailStatus in invite response
CLAUDE.md:
- Add RESEND_API_KEY, EMAIL_FROM, NEXT_PUBLIC_APP_URL to required env vars
- Document DB migration pattern (journal + hot-fix via debug-migration POST)
- Document R2 3-step proxy upload pattern (CORS note)
- Document users.image (NOT avatar_url) and two separate photo features
- Document admin auth server-component pattern
- Document family_invites fix, invite flow, cancel invite
- Full data storage table with all localStorage keys

Invite route:
- Return emailStatus in POST response so caller can see if Resend fired
  or why it failed (noKey / error message)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 15:15:53 +05:30
b10bfb0e2f docs: add growth page features to CLAUDE.md
Document the growth page components, state management, color codes, and layout order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 15:47:52 +05:30
796b6d8004 fix(growth): disable RLS on growth table
Growth table had RLS blocking writes. API has requireOwnership checks,
so disabling RLS is secure. Changed table owner to tia_app.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 14:36:15 +05:30
318b277e44 feat(growth): add edit/delete, goals, CSV export, and WHO percentile enhancements
- Add PUT and DELETE endpoints for growth records
- Add CSV export for pediatrician visits
- Add goal tracking with localStorage persistence
- Color-coded percentiles (green/yellow/red zones)
- Show WHO percentile lines (15th, 50th, 85th) on chart
- Growth velocity indicator (kg/month between readings)
- Enhanced WHO standards card with actual vs target + goal progress
- Better empty state with encouraging prompt
- Fix UUID type for growth record IDs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 13:52:02 +05:30
e47001365e Rate limit controlled via RATE_LIMIT_ENABLED env 2026-05-17 01:12:15 +05:30
2196c3d07d Security hardening: auth, bcrypt, rate-limiting, RLS, audit 2026-05-16 23:11:01 +05:30
c65051cf7d Add password management to admin users page
- Add PATCH endpoint to set user passwords
- Add password modal UI in admin panel
- Update CLAUDE.md with latest features

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 15:12:23 +05:30
049a496f7f Document Turbopack cumulative fixes tip
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:29:55 +05:30
26fe359303 Update documentation with recent fixes and known issues
- Add familyName and memberCount to FamilyProvider docs
- Document Turbopack parsing issue and workaround
- Add chat sessions localStorage note

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 01:16:14 +05:30
1f8cf74188 Update CLAUDE.md with auth and admin info 2026-05-10 23:42:16 +05:30
4f5836909c Sprint 1: Foundation Fix - Part 1
- FamilyProvider context for auth-based child fetching
- Replaced hardcoded childId with useFamily() hook
- Added tier and memberCount to context (for Pro tier)
- Updated layout to wrap with FamilyProvider
- Added null checks for child data

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 21:49:42 +05:30
3e66b259f2 Migrate medical data from localStorage to database
- Add database tables: medicines, allergies, doctor_visits, illness_logs
- Create API endpoints: /api/medicines, /api/allergies, /api/visits, /api/illnesses
- Update medical page to use database APIs instead of localStorage
- All medical data now persists across sessions and devices

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 21:07:26 +05:30
070293498b Update CLAUDE.md with R2 storage learnings 2026-05-10 15:16:45 +05:30
d5168316a7 Update CLAUDE.md with R2 env vars 2026-05-10 14:03:43 +05:30
5943ab19eb Update CLAUDE.md with project architecture and patterns 2026-05-10 13:22:40 +05:30
5cf0303999 Add debugging docs for AI/LiteLLM 2026-05-10 12:12:59 +05:30
83b8292ca0 Update CLAUDE.md with project status and conventions 2026-05-10 11:44:20 +05:30
13042f6e68 Add build verification rule to CLAUDE.md
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
EOF
)
2026-05-10 05:17:44 +05:30
507487c7d9 feat: add email provider for magic links 2026-05-10 04:18:08 +05:30
70e289e13b chore: initial setup 2026-05-10 03:33:32 +05:30