Case 006 — Health programs platform

All work

Public tools and editorial bring clients in. A members area — login, paid programs, structured content delivery — keeps them. One Next.js app on Cloudflare runs both surfaces, with the paywall as a content layer rather than a feature flag.

bassammallick.com — health programs and tools platform
Livebassammallick.com

Industry

Health / Membership platform

Year

2026

Role

Platform architecture · Membership & payments · Auth flow · Content layer · Tool architecture · UI direction

Stack

Next.js · TypeScript · Cloudflare · R2 · PostgreSQL · Stripe · Lucia auth · Resend

Architecture · 8 layers · request flows left to right

  1. Next.js
  2. TypeScript
  3. Cloudflare
  4. R2
  5. PostgreSQL
  6. Stripe
  7. Lucia auth
  8. Resend
/ 01Outcomes

Multi-track

Program tracks live

structured programs behind the paywall

Session cookies

Auth surface

Lucia-style, HttpOnly, rotated on login

Webhook + reconcile

Payment retries

Stripe events keyed by event.id, deduped at DB

5 dims

Tool quality bar

function · ease · UI · education · report

/ 02The brief

Bassam Mallick sells structured health programs. The site has to do two jobs without either undermining the other — earn trust on the open web with evidence-grade tools and editorial, then sell and deliver paid programs behind a login. We built both surfaces as one Next.js app on Cloudflare, with shared content primitives and a members area that treats program access as data, not a marketing toggle.

/ 03Architecture

Public surface — Next.js on Cloudflare

Marketing pages, the editorial line, and the public tools (BMI as the reference standard, others built to clear the same bar). Static where possible, edge-rendered where the tool needs it. The role of this surface is to be good enough on its own that paying for the programs is the next step, not the only reason to be there.

  • Tools shipped at premium-product quality, not lead-magnet quality
  • Editorial line: if you cannot cite it, do not say it
  • Clean route boundary between public and /members

Client portal — auth, sessions, account state

A members area at /members guarded by session cookies. Login, password reset, and email verification go through Resend. Sessions are HttpOnly, rotated on login, and bound to a server-side store so revocation is one DB write. The portal lists the programs the client has access to and resumes them where they left off.

  • Custom auth flow rather than a third-party hosted login (kept on the same Next runtime)
  • Server-side session validation on every members route
  • Account, billing, and program-access views as first-class pages

Payments and program access — Stripe + webhook reconcile

Stripe Checkout for purchase. The webhook handler writes to an append-only events table keyed on event.id so re-delivery is safe, then reconciles into a program_access table that the portal reads. Access is granted by data, not by a session flag — refunds and chargebacks remove access by the same path.

  • Checkout-driven, not in-app card capture
  • program_access rows are the source of truth, not Stripe metadata
  • Failed-payment recovery handled by Stripe's own retry schedule, then a final email through Resend

Program content delivery — DB-structured, R2-backed assets

Each program is a structured object in PostgreSQL — modules, lessons, completion state, ordering — with media (video, PDF, audio) stored in R2 and served through signed URLs scoped to the authenticated session. New programs ship by writing data, not by deploying a new page tree.

/ 04Build highlights
  1. 01

    Paywall as a content layer, not a feature flag

    Program access lives in its own table and is checked at the data layer. There is no "if user.tier === pro" sprinkled through components — a page either has rows to render or it does not.

  2. 02

    Tools that earn the email

    The public tools are not three-input calculators with a signup wall. They produce a clinical-grade report layer on their own; the members area is offered as the next step, not the price of entry.

  3. 03

    Program completion as a first-class entity

    Lessons, modules, and completion state are modelled in PostgreSQL so resume, progress, and access revocation all read from one place. The portal shows progress; the admin view reads the same rows.

  4. 04

    Evidence-backed editorial line

    Every claim on the public site is linked to its source. The same discipline carries into the program copy behind the paywall — clients see the same standard they were sold on.

  5. 05

    One runtime, two surfaces

    Public tools and the members portal are the same Next.js app on Cloudflare Workers. Shared primitives, shared design language, no second deploy target to keep in sync.

  6. 06

    Transactional email as part of the product

    Verification, password reset, receipt, and access-granted emails go through Resend on templates that match the site, not on a generic SaaS chrome.

/ 05What it became

The site now runs as a working membership business for Bassam — public tools and editorial pull traffic, Stripe Checkout converts it, the members area delivers the programs the client paid for, and access state lives in data that the portal, the admin, and the webhook handler all read from the same place.

Next caseConfidential — Fintech pipeline platform