Skip to main content
ZTZayanTech.dev
All Work
Behavioral Health SaaS

HopeRising

Science-Based Behavioral Health Platform

Next.jsSupabaseStripeResendStreak engine
Visit live product
HopeRising screenshot

Overview

HopeRising is a science-based behavioral health platform that helps users build and sustain habit change. It combines a daily protocol engine, trigger tracking, encrypted journaling, real-time streak counters, and a structured 30-day program — all in a single private dashboard.

The Problem

Behavioral health apps in this space either operate like generic habit trackers or are community forums with no clinical structure. Neither provides the specific behavioral tools that research shows work: daily commitment rituals, urge logging with contextual data (trigger, intensity, location), guided reframing techniques, and analytics that surface patterns over time.

HopeRising builds those tools into a structured SaaS with a free 7-day program for acquisition and a Pro tier for long-term engagement.

Core Architecture

Daily Protocol Engine — Three timed events per day:

  1. Morning commitment (07:00) — Intent-setting prompt, streak display, today's program step
  2. Urge survival mode — Panic button that launches a breathing exercise + stoic reframing sequence. Logs urge data: intensity (1–10), trigger category, location
  3. Evening reflection — Mood log, gratitude prompt, day rating

The protocol runs off a server-side cron that fires Resend transactional emails at configured times. Users can adjust timing in settings.

Streak Engine — A Postgres function computes current streak and longest streak from the daily check-in table. Check-ins are timestamped server-side (not client) to prevent manipulation. A missed day resets the active streak but preserves the history.

-- Streak calculation: consecutive days with a check-in before midnight UTC
SELECT COUNT(*) AS streak
FROM generate_series(
  CURRENT_DATE - INTERVAL '90 days',
  CURRENT_DATE,
  '1 day'::interval
) AS d
WHERE EXISTS (
  SELECT 1 FROM check_ins
  WHERE user_id = $1
    AND DATE(created_at) = d::date
)
ORDER BY d DESC
-- stops at first gap

Encrypted Journaling — Journal entries are encrypted client-side using AES-256 before storage. The server never sees plaintext. The encryption key is derived from the user's password via PBKDF2 — if the password changes, entries are re-encrypted.

Stack

LayerTechnology
FrontendNext.js 15, TypeScript, Tailwind
DatabaseSupabase (Postgres + RLS + Auth)
PaymentsStripe (Free + Pro $19/mo)
EmailResend (daily protocol reminders)
EncryptionAES-256 client-side (Web Crypto API)
DeployVercel

Key Decisions

Client-side encryption — Health data in this category is sensitive enough that server-side encryption (encrypt at rest) is insufficient. Users need confidence the platform cannot read their entries. Web Crypto API runs in the browser — no server contact for the encryption step.

Cron via Resend + Vercel Cron — Daily protocol emails are the product's engagement mechanic, not just a notification. Each email includes the day's program step, yesterday's streak progress, and a direct link to the morning commitment flow. Open rate is the primary activation metric.

Recovery roadmap as onboarding — Day 1 · Day 7 · Day 30 · Day 90 milestones give users a progress narrative. Each milestone unlocks a new program phase, creating natural re-engagement points without gamification gimmicks.

What This Proves

HopeRising is vertical health SaaS proof: streak engine, client-side AES-256 encryption, daily protocol automation via email sequences, and subscription billing in a single privacy-first system.

If you're building a health, wellness, or habit app that requires encrypted data, scheduled protocol delivery, and analytical dashboards, this is the architecture we'd apply.

Want this?

Built on the same stack as HopeRising. Let's scope yours.