High-level engineering overview of My Debt Coach: product architecture, payoff engine, auth model, demo experience, content stack, and ops tooling. Companion to the Lab entry.
Overview
My Debt Coach is a TypeScript monorepo with a consumer web app, a separate internal ops hub, and shared packages for site configuration and data access.
Stack is Next.js, React, Tailwind, Supabase for auth and Postgres, Sanity for marketing and content, and Vercel for hosting and scheduled jobs.
System shape
At a high level the product splits into three cooperating surfaces:
Consumer app (portal + marketing) stores user financial data in Supabase.
Ops hub handles analytics, social publishing, and agent-assisted workflows.
Sanity CMS feeds marketing, Knowledge Base, and blog content.
Architecture
The consumer app separates marketing surfaces, the authenticated portal, and public help content.
Portal areas cover Home, My Debt, Plan, Payments, and Settings. Theme and accent choices stay scoped to the signed-in experience so marketing pages stay visually independent.
Postgres schema evolves through versioned migrations covering accounts, pay-later plans, notifications, and operational data.
Automated tests cover payoff math, BNPL schedules, consent flows, and plan comparison logic.
The ops hub deploys on its own release cadence so internal tooling never blocks consumer shipping.
Payoff engine
Seven strategies allocate leftover budget after minimums. Users pick a default strategy, then can compare any two on the same monthly budget.
Avalanche: highest interest first.
Snowball: smallest balance first.
Custom order: user-defined focus sequence.
Highest monthly payment first.
Most-used credit cards first.
Lowest interest first (including promotional balances).
Highest balance first.
Buy now, pay later installments are included in every projection.
Compare surfaces interest paid, months to debt-free, and remaining-balance charts for both plans.
Promotional and deferred APR inputs feed the simulator; payment states track scheduled, paid, skipped, and late items.
Data and auth
Sign-in supports Google OAuth and email/password through Supabase. Row Level Security keeps each user's financial data private to their account.
User preferences cover timezone, currency, appearance, and whether the session is a time-limited demo.
Optional private calendar feeds expose due dates to Apple, Google, or Outlook without sharing the full account.
Structured export and a clear-data flow let users take their records with them or reset financial data while keeping their login.
Live demo
Prospects can open a time-limited trial that lands in the real product with seeded sample debts, payments, and coaching states.
Demo sessions expire automatically. Background jobs prune stale trial data, and rate limits keep concurrent trials isolated.
Content and help
Sanity powers the marketing site, Knowledge Base, and blog. Editors work in an embedded studio; published changes revalidate affected pages.
In-app promo cards rotate curated articles so signed-in users still discover educational content.
Help chat searches published guides and common app destinations with a lightweight search index (no LLM in the loop).
Anonymous help queries inform which topics need clearer docs or product copy.
Marketing stack
The homepage is a block-based Sanity document: hero, feature grid, product showcases, how-it-works, FAQ, and CTA.
Blog posts, help guides, education articles, legal pages, and site settings are separate document types.
Shared metadata helpers handle titles, descriptions, canonical URLs, and social cards.
Structured data covers organization, product, and FAQ surfaces for search.
Sitemap and robots rules stay in sync with CMS content.
Analytics load only after consent; key funnel events are tracked in the tag manager.
Ops hub
A separate, role-gated application is the live ops surface: not a thin CMS, but the place where growth, support signals, and publishing workflows converge.
Dashboards cover signups, active accounts, demo usage, deletions, and onboarding completion.
Read-only user lookup supports support and fraud review without write access to ledgers.
Marketing panels compose and review social posts before they go out.
Agent-assisted publishing runs with human approval; platform credentials stay on the ops side only.
Maintenance controls can limit the portal or the full site with a custom message and ETA.
Social publishing
Social distribution is API-driven from the ops hub rather than manual link-outs only. Public profile links still appear in marketing footer and structured data.
Meta integration covers Facebook Page and Instagram Business publishing plus basic insights.
Bluesky integration supports text, media, replies, quotes, and engagement summaries.
TikTok integration supports short-form video publishing from the same ops workflow.
Other inbound hooks handle CMS revalidation, transactional email, and third-party support signals.
Analytics connectors
The ops hub is growing a connector pattern for warehouse and BI sync. Credentials never ship to the consumer app.
BigQuery is the first planned destination for product analytics and funnel rollups.
Additional warehouses or CRM destinations can plug into the same hub over time.
Ops and deployment
Consumer and ops apps ship on separate Vercel projects so internal experiments stay isolated from consumer releases.
Scheduled jobs send payment reminders and retire expired demo data.