The situation
A mental-wellness product with three businesses inside it: a consumer subscription, an employer portal sold to companies for their staff, and a marketplace where users book sessions with practitioners over video. On top of that, a recommendation engine that suggests what a person should do next based on how they say they are feeling.
The third one is the reason this project is worth writing about. A recommendation engine that suggests a breathing exercise to someone who is mildly stressed is a pleasant feature. The same engine suggesting a breathing exercise to someone in crisis is a serious failure. The engineering question is not how to build it - it is how to know it will not do that.
What I built
A Django and DRF backend with a React 18 application in front of it, delivered as one system: subscriptions and billing, the employer portal with its own seat management, the telehealth marketplace on the Zoom Video SDK, the community features, gamification, and a full administrative back office for the editorial team.
The recommendation engine
A hybrid rather than a pure model. A graded assessment of nervous-system state is derived from a structured check-in, and that grade drives weighted sampling across a catalogue rather than a static ranked list - so context beats popularity, and two people in different states never get the same answer merely because one item is generally well-rated. Discovery slots on a cooldown stop the catalogue collapsing onto the same twenty items, and the hot path bypasses the ORM entirely because it runs on every screen.
Two AI providers sit behind one abstraction, switchable from the admin, with response caching to keep the per-user cost predictable. Provider choice is a configuration decision, not an architectural one - which mattered within the year, when pricing changed.
Retrieval that stays grounded
Roughly thirty thousand distinct solutions were extracted from about ninety-five books and indexed for retrieval. Grounding is the whole point: the system answers out of that corpus rather than out of a model's general impression of wellness advice. Crisis-appropriateness weighting keeps inappropriate suggestions away from severe states, diversity caps stop one source dominating, and a whitelisted nutrition index blocks the model from straying into medical advice it has no business giving.
The conversational coach on top has persistent memory across sessions, a cadence controller that steers a conversation towards a concrete action rather than letting it wander pleasantly, and a three-strike moderation state machine for content that should end the exchange and hand over.
The part I am proudest of
None of the above is worth anything as an assertion. So I built a Monte Carlo harness that generates synthetic users with varied and adversarial states and runs them through the real engine.
A hundred and twenty thousand sessions across two runs, checking two properties: that no crisis-state session ever receives an inappropriate recommendation, and that no item in the catalogue is unreachable - a dead card is content somebody wrote and nobody will ever see. Both held.
The harness is exposed as a one-click action in the admin, so the editorial team re-runs it after every content change rather than waiting for an engineer. That is the part that makes it a safety property instead of a launch-day screenshot: it is checked by the people who can break it, at the moment they might.
An AI feature nobody has measured is not a feature. It is an unpriced risk that happens to demo well.
Commerce and compliance
Stripe subscriptions with a bilingual plan and discount engine editable in the admin, e-invoicing with automatic issue and overdue suspension, a multi-level ambassador commission engine, ten wearable integrations over OAuth, and lead scoring combining rules, a model and an AI pass.
What I would do differently
I would write the evaluation harness before the engine rather than shortly after it. I built the recommender, then built the thing that proves it - and spent a week changing the recommender to make it testable. Had I started from "what will I need to assert about this?", the design would have arrived in better shape and a week earlier.