Product Engineering Deep-Dive

How we built a HubSpot-class engagement system for nurse practitioners

The research, design decisions, and engineering behind every feature — from streak milestones to behavioral triggers. Here's what we borrowed from the best products in the world, and what we built differently.

Foundation

Four design principles guide every feature

Under 60 Seconds Per Action

Every marketing action in the hub is designed to complete in under a minute. We pre-write content, queue recipients, and prepare links — the user just confirms.

Inspired by Duolingo's "one lesson in 5 minutes" philosophy

Learn It, Then Use It

Each academy course unlocks the matching tool. You don't get the Referral Builder until you understand the Seven Touches method. Education-gated features ensure confident adoption.

Modeled after HubSpot Academy's certification → tool unlock pattern

Smart Coach, Not Autopilot

The system thinks for you and prepares everything, but the human sends. This preserves the authentic relationships that matter in healthcare referrals.

Path B philosophy with selective Path A automation (physical mail, data gathering)

Silent Tracking, Zero Data Entry

Every action publishes an event. Behind the scenes, the system calculates streaks, aggregates engagement snapshots, checks milestones, and triggers re-engagement — without asking users to log anything.

Inspired by Strava's passive activity tracking and Apple Health's background intelligence

Engagement Engine

Six systems that keep practices growing

Each system is independently functional but shares data through a common event architecture

Auto-Streak Milestones

When you complete daily moves, the server calculates your consecutive-day streak and automatically awards milestones at 3, 7, 14, 21, 30, 60, and 90 days. Each milestone is a UserMilestone record — celebrated in-app with confetti and tracked for your history.

How It Works

Server-side streak calculation in the /api/daily-moves/complete endpoint. Loops backward through ActionLog entries by day, counting consecutive active days. Awards are upserted to prevent duplicates.

vs. Reference Apps

Like Duolingo's streak system, but tuned for weekly business rhythms instead of daily language drills. We added milestone tiers beyond the basic 3/7 to reward long-term habit formation.

Smart Follow-Up Queue

Every morning, the system surfaces referral contacts whose nextFollowUpAt date has passed. You see the contact, their stage in the relationship, and an AI-drafted personalized outreach message — ready to copy and send.

How It Works

The /api/followup-queue endpoint queries ReferralContact where nextFollowUpAt ≤ now or lastContactedAt is null. LLM generates personalized email + SMS drafts using the contact's specialty, practice, and relationship stage.

vs. Reference Apps

HubSpot's "Tasks" queue meets AI writing. The key difference: our messages are tailored for the provider-to-provider referral context that PMHNPs navigate — not generic sales outreach.

AI-Personalized Weekly Digest

Every Monday, each user gets a "Practice Pulse" email with their stats, pipeline status, and academy progress. What makes it different: an LLM reads your actual week's data and generates a personalized "This Week's Insight" and "Next Priority" section.

How It Works

The weekly digest endpoint compiles per-user stats (streak, actions, contacts, academy %) then calls the LLM API with that data as context. The AI sections are injected into the HTML email template alongside traditional stats. Insights are stored in EngagementSnapshot for longitudinal tracking.

vs. Reference Apps

Traditional digest emails (Mailchimp, HubSpot) show stats. Ours interprets them. If you added 3 contacts but have 5 stale ones, the AI will point that out — not just show the number.

Behavioral Trigger Engine

Admin-configured rules that watch for specific patterns across all users: hitting the contact limit on free plans, completing 3 courses in a week, health score drops, unused features after course completion, and broken streaks. When a condition fires, the system sends a contextual email or in-app nudge.

How It Works

The /api/admin/triggers/evaluate endpoint iterates all active BehavioralTrigger records against all users. Each trigger has a condition (metric + operator + threshold), an action (email template + channel), and a per-user cooldown tracked via ActionLog entries with trigger-specific action types.

vs. Reference Apps

Like HubSpot's Workflows, but purpose-built for a PLG engagement model. Instead of CRM-style lead scoring, we're tracking product adoption signals — courses completed, tools used, streaks maintained.

Onboarding Funnel Dashboard

Admin view showing the full activation funnel: Signup → Profile Started → Onboarded → First Course Completed → First Tool Used, with conversion rates between each stage, retention cohorts at 7/14/30 days, and auto-generated insights about drop-off points.

How It Works

Server-side aggregation queries User, UserCourseProgress, ActionLog, and UserMilestone tables. Computes stage distributions, weekly signup trends, retention rates, and plan conversion metrics. Client renders a funnel visualization with conversion arrows and color-coded health indicators.

vs. Reference Apps

Amplitude's funnel analysis, simplified. Instead of requiring event taxonomy setup, we derive the funnel from existing schema relationships — every user already has onboardingStage, createdAt, lastActiveAt, and course/action records.

Re-engagement Sequences

When users go inactive, an automated sequence fires at 3, 7, 14, 30, and 60 days — each with progressively different messaging. Day 3 mentions their streak. Day 14 uses market intelligence to show what changed in their area. Day 60 asks for honest feedback.

How It Works

A daily scheduled task checks user.lastActiveAt against today. Each stage has its own notification type, cooldown tracking, and personalized HTML template. Users can opt out via notification preferences.

vs. Reference Apps

Similar to Intercom's re-engagement campaigns, but the content is auto-personalized using the user's actual platform data — their streak before they left, their stale contacts, their incomplete courses.

Standing on Giants

What we borrowed — and what we built differently

We studied the best products in learning, CRM, fitness, and analytics — then adapted their patterns for healthcare

H

HubSpot

CRM & Marketing Automation

What We Adopted

Academy-gated features, contact pipeline stages, weekly digest emails, behavioral workflows

What We Did Differently

HubSpot is built for sales teams. We adapted the patterns for clinician-to-clinician referral relationships — no "deals" or "lead scoring," just authentic provider connections.

D

Duolingo

Habit Formation & Gamification

What We Adopted

Daily streaks, milestone celebrations, bite-sized daily tasks, progress points, confetti moments

What We Did Differently

Duolingo optimizes for daily engagement. We optimize for weekly business outcomes — a 15-minute daily routine that moves the needle on referral partnerships, not just gamification metrics.

S

Strava

Silent Tracking & Social Proof

What We Adopted

Passive activity tracking, engagement snapshots, weekly summaries, streak-based motivation

What We Did Differently

Strava tracks athletic performance. We track marketing performance — contacts nurtured, profiles optimized, reviews generated — with the same "set it and forget it" philosophy.

A

Amplitude / Mixpanel

Product Analytics

What We Adopted

Funnel analysis, retention cohorts, feature adoption tracking

What We Did Differently

Instead of requiring custom event taxonomy, our admin dashboard derives funnels from natural schema relationships. No analytics engineer required — the data model IS the event model.

Architecture

Six interconnected layers

Every user action flows through these layers — from learning to engagement to retention

Education Layer

10 courses, 40 lessons, quizzes → feature gating via UserCourseProgress

Daily Engagement

MoveTemplate → ActionLog → streak calculation → milestone awards

Referral Pipeline

ReferralContact → OutreachSequence → follow-up queue → AI message drafting

Intelligence Layer

LLM-powered bios, smart moves, market analysis, personalized digest insights

Behavioral Engine

BehavioralTrigger rules → per-user evaluation → cooldown-aware action firing

Retention System

EngagementSnapshot → re-engagement sequences → notification preferences

All layers share a common data model — user actions ripple through every system automatically

Why we built it this way

PMHNPs are among the most needed healthcare providers in the country. They chose this career to help people with mental health — not to become marketers. But without referrals and visibility, they can't sustain a practice.

We built NP Sprout with the conviction that marketing should feel like a 15-minute daily routine, not a second job. Every system described above exists to reduce friction: the AI writes the message, the trigger fires the nudge, the streak keeps the habit alive, and the digest shows what's working.

The goal isn't engagement for engagement's sake. It's referrals, patients, and sustainable practices.