MemoryDensity
A Next.js PWA with Supabase that delivers daily prompts, logs first-times, compiles weekly Time Capsules, and scores memory density with push/email reminders and offline install.
Highlights
- Daily reflection prompts — A Vercel cron (/api/cron/assign-prompts) runs hourly and assigns each user today’s prompt from a Postgres catalog based on their stored timezone; responses are submitted, edited, skipped, or deleted via Next.js server actions with RLS-protected user_responses rows.
- First-times log — Users record novel experiences in a dedicated dashboard section; CRUD flows through server actions against a first_times table, with cursor-based infinite scroll (useInfiniteScroll + paginated server actions) for long histories.
- Weekly Time Capsules — A Monday cron (/api/cron/generate-capsules) aggregates the prior week’s prompt answers and first-times into JSON snapshots stored in time_capsules, then notifies users via in-app feed, web push, and/or a React Email digest sent through Resend.
- Memory Density Score (0–10) — Scoring runs in Postgres via a get_weekly_score RPC (capped points from completed prompts + first-times per week), surfaced on the dashboard with historical week-over-week trends and streak tracking in lib/streaks.ts.
- Email OTP authentication — Passwordless sign-in/sign-up using Supabase Auth 6-digit codes (not magic-link redirects); proxy.ts refreshes sessions on every request, guards /dashboard/*, and redirects incomplete onboarding to /onboarding.
- Timezone-aware notifications — Onboarding captures timezone, preferred prompt reminder hour, and channel (push or email); /api/cron/send-push delivers reminders through web-push + VAPID keys or falls back to Resend, with idempotency tracked in cron_deliveries.
- Installable PWA with offline fallback — Serwist generates a service worker (app/sw.ts) with precaching, network-only rules for authenticated routes, and an /offline fallback; manifest.json enables home-screen install, with a dedicated /install guide for iOS and Android.
- Interactive marketing landing page — Public site includes a lazy-loaded Three.js visualizer (@react-three/fiber) modeling age-based time compression, Motion scroll animations, FAQ/SEO metadata, and consent-gated Google Analytics loaded only after cookie approval.
- Production observability & CI — Sentry captures client and server errors; GitHub Actions runs ESLint, Vitest, and production builds on every PR.
Technology
- Next.js - React framework for production
- React Three Fiber - React renderer for three.js
- Resend - email API for developers
- Sentry - Error monitoring
- Serwist - Service worker and PWA build pipeline
- Supabase - open source Firebase alternative
- Tailwind CSS - CSS framework
- TypeScript - strongly typed programming language
- Vercel - platform for deploying and hosting
- Vitest - Unit test framework
- shadcn/ui - customizable UI components
- web-push - Browser push notifications with VAPID