How this was built: Recommendation systems

OptySleep is a sleep tracking app that helps people understand what actually improves their sleep. It has a sleep widget, quick data logging, and OptyAI, an assistant that gives each user personal sleep tips.
The old recommendation setup had performance problems, so I designed a new engine from scratch with a custom scoring formula. It runs on FastAPI in Docker, uses Redis caching to keep responses fast, and uses A/B testing to check which recommendations really work. Firebase supports the mobile app side.
After the new engine went live, engagement went up by about 70%. Retention also improved, and more users renewed their subscriptions.
The engine looks at what each user has tried before and how it worked for them. It uses Sentence-BERT embeddings to find sleep methods with a similar meaning, and then suggests what to try next. For example, if cutting down on caffeine gave someone more energy, the app might suggest a blue light filter next.