Inspiration

Sleep apps are very good at telling you that you slept badly, and then leaving you there. CBT-I — cognitive behavioral therapy for insomnia — is the clinically recommended first-line treatment, with better long-term evidence than sleeping pills. It is also locked behind six to eight sessions with a specialist most people cannot book.

Sleep Max ships the actual protocol: a prescribed sleep window that tightens and loosens from your own diary, stimulus control, sleep restriction, and a weekly review that recalculates the prescription.

There was a second itch. Gamified health apps reward the wrong thing. Rank people by a sleep score and you are ranking who owns the better wearable and who has the calmer life. So Sleep Max ranks behaviour — consistency and personal improvement — never the raw number.

What it does

  • Runs the full seven-week CBT-I program, rebuilding your sleep prescription from the nights you log
  • Scores every night 0–10 from duration, efficiency, consistency, circadian alignment and how you say you feel — and shows a confidence band instead of fake precision: a wearable night earns a precise number, a hand-logged night shows a range
  • Reads sleep, heart rate, HRV and resting heart rate from Health Connect, so a night measured by a wearable never has to be retyped
  • Awards a Discipline tier (Bronze → Diamond) from a behaviour composite, not from the score
  • Optional community: city / country / global leaderboards, a moderated forum, direct messages and profiles — anonymous by default
  • Soundscapes, a smart wake alarm with wake-up challenges, habit tracking, streaks and an activity heatmap

How we built it

Flutter and Dart for the app (Android shipped, iOS built from the same codebase), Riverpod for state, Hive for local-first storage — the app is fully usable with no account and no network. The backend is Fastify + TypeScript on Railway with Postgres via Prisma, and Redis for the leaderboards.

Monetization is RevenueCat. Three subscription products — weekly with a $0.99 introductory first week, monthly, and yearly — sit behind a single plus entitlement, with the Play Store products imported directly into RevenueCat over a Google Cloud service account.

RevenueCat did exactly what you want a payments layer to do: disappear. The app never touches a store SDK. One provider exposes a single boolean, the paywall asks for offerings and renders whatever comes back, and changing price or adding a platform became a dashboard change instead of a release.

Challenges we ran into

We were ranking genetics, not effort. The first leaderboard sorted on the sleep score, which quietly rewards good sleepers and better hardware. We replaced it with a server-computed composite of consistency, personal improvement and verified behaviour, gated on a minimum of verified nights, so nobody can top the board by hand-typing tens.

Anonymity silently switched off direct messages. We had gated message reachability on the anonymous flag — and since anonymous is the default, that disabled DMs for nearly everyone. Only driving the real flow caught it. Anonymity now governs display only; a separate, explicit policy decides who can reach you.

Getting a reviewer past our own paywall. Sleep Max charges after onboarding, and Google's reviewers cannot buy a subscription or use a free trial. Our first submission was rejected because we handed them a Play promo code — which Play implements as a trial, the one thing the policy excludes. We shipped a reviewer access code that unlocks the entitlement directly, and the app was approved on the next pass.

Refusing to fake precision. An early build showed a 0.1-resolution score for a night someone typed in from memory. Now the displayed precision is earned: the data source is labelled, and manual entries show a range.

What we learned

A therapy app and a competition app pull in opposite directions. Leaderboards can feed orthosomnia — the anxiety about sleep performance that CBT-I exists to treat. Every competitive surface is therefore opt-in, anonymous by default, and there is a wellbeing mode that hides ranks entirely.

We also learned that a hard paywall is a product decision with a review-process tail. It touched Play policy, the Data safety declaration, the reviewer flow, and our own marketing copy, which still described a free app long after the app stopped being one.

What's next

Lip-synced coaching, richer per-night explanations, and an iOS release from the same codebase.

Built With

Share this project:

Updates

Submission history