4
2 Comments

What Tech Stacks Are Founders Using to Build HealthTech AI Startups? Lessons from LazyFit - A Personalized Nutrition Service

Introduction

Building an AI-powered startup in highly regulated spaces like HealthTech is about much more than just technology; it requires collaboration with experts, precise algorithms, and robust security measures. At LazyFit, we developed an AI-driven meal service designed for busy people with dietary needs. By collaborating with nutritionists, dietitians, nutrition coaches, and naturopaths, we codified algorithms for dietary personalization with over 90% approval from healthcare professionals. Our system is patented, ensuring that we offer unique, dynamic meal recommendations securely. Here's a look at the tech stack, AI models, and security measures we used to build LazyFit.


AI Personalization at LazyFit: Core Architecture

LazyFit’s meal recommendation engine is built on a solid foundation of human expertise, which is then enhanced by AI. We started by codifying dietary rules into algorithms that handle everything from allergens to macronutrient goals. These rules, developed in collaboration with industry experts, were designed to ensure accuracy across a wide range of dietary needs.

Our design focuses on dynamically adjusting meal recommendations based on user feedback and real-time inputs. This ensures that AI doesn't make arbitrary decisions, but instead operates within the strict boundaries set by our nutrition algorithms.

Codified Algorithms First, AI Second

At LazyFit, we didn’t rely on AI to create the foundation of our service. Instead, we focused on:

  • Dietary Filtering: Manually codified rules eliminate meals that don’t meet user restrictions (e.g., allergens, macronutrient ratios).
  • AI Adaptation: AI was layered on top of these rules to dynamically adjust meal recommendations based on real-time data, such as activity levels and user preferences.

This approach ensures that AI enhances, rather than replaces, human judgment.

Testing AI Models: OpenAI, Claude, and Cohere

To find the right AI models, we rigorously tested various platforms, evaluating them based on hallucination rates, accuracy, and cost-effectiveness.

  1. OpenAI (GPT-4):

    • Performance: Good for text generation, with a hallucination rate of \~15% for nutrition-related queries.
    • Cost: Affordable and scalable, making it a good choice for dynamic, text-based responses.
    • Use Case: Used primarily for generating meal descriptions and dynamic queries. All outputs are validated against our core nutrition algorithms to ensure compliance.
  2. Claude (Anthropic):

    • Performance: Strong adherence to guardrails, resulting in a hallucination rate \<5%. This model excels at generating accurate meal recommendations.
    • Cost: Slightly more expensive but worth it for high-stakes, health-critical recommendations.
    • Use Case: Preferred for generating health-sensitive recommendations, such as meals for users with allergens or specific medical conditions.
  3. Cohere:

    • Performance: Useful for cheap text generation, but its ability to handle complex nutrition queries was weak, with a hallucination rate \>20%.
    • Cost: Very low, making it ideal for non-critical content.
    • Use Case: Used for generating marketing copy and other non-health-related tasks.

Metrics from AI Model Testing

  • Hallucination Rate: OpenAI: 15%, Claude: 5%, Cohere: 20%+

  • Cost per 1000 API calls: OpenAI: $0.0015, Claude: $0.015 , Cohere: $0.0020

  • User Satisfaction in Beta Testing: 85% satisfaction with meal recommendations; most complaints were related to slower response times for highly personalized cases.


Security First: Protecting User Data

Given the sensitivity of health data, security was a critical consideration from day one. At LazyFit, we follow a data minimization principle, only storing information that is essential to our service.

Authentication with Clerk

We use Clerk to handle user authentication. Clerk manages:

  • Multi-factor authentication (MFA) to add an additional layer of security.
  • Role-based access control (RBAC), ensuring that only authorized users can access specific data.

This setup allows us to never store user credentials locally, reducing the risk of data breaches.

Encryption and Database Security

To further protect sensitive data, we implemented custom encryption:

  • Encryption at Rest: All sensitive data in our database, such as dietary preferences and health data, is encrypted using AES-256 before being stored.
  • Custom Encryption Logic: We developed an encryption system that encrypts data before it is stored, and decrypts it only at the moment it’s needed for processing. This ensures that if our database is ever compromised, the data will be unintelligible.
  • PostgreSQL: We use PostgreSQL for structured data storage, combined with Redis for caching frequently accessed data without ever caching sensitive information.

Team Expertise in Healthtech Security

Our team has deep expertise in building and securing healthtech platforms. Members have worked on securing health data at companies like League, Amazon Care, NHS, Costco Pharmacy, and Cohere. This experience ensured that we built LazyFit using industry-leading security protocols and best practices.


Core Algorithms: Building a Foundation for AI

Before AI even gets involved, every meal recommendation runs through a series of rule-based checks. These checks ensure that the meals align with the user’s dietary restrictions, macronutrient goals, and budget constraints before the AI adds its adaptive layer.

  • Meal Filtering Engine: Filters out meals that don’t align with user restrictions, such as allergens or dietary limitations.
  • Ranking Algorithm: Ranks the filtered meals based on macronutrient fit, cost, and user preferences.
  • AI Adaptation: AI refines and personalizes recommendations, but never overrides the core algorithms.

Post-Processing Validation Layer

To ensure the AI outputs accurate and compliant recommendations, we implemented a validation layer. This layer runs every AI-generated meal suggestion through our core algorithms before delivering it to the user. This step has reduced hallucination-related errors by over 80%.


Building a Scalable, Cloud-Native Infrastructure

LazyFit was built to scale from the start. Using AWS & GCP, we ensured the platform could grow without sacrificing speed or reliability.

Backend Architecture

  • Node.js (Express) handles real-time user requests, while Python manages the AI and machine learning models.
  • PostgreSQL serves as our primary database, with Redis used for caching high-frequency queries, reducing response times.
  • AWS provides scalable cloud infrastructure, allowing us to handle fluctuations in demand with auto-scaling.

Meal Database Engine (MDE)

The Meal Database Engine (MDE) is the system responsible for tagging, analyzing, and recommending meals:

  • Macronutrient Analysis: Tags meals based on nutritional content and adjusts recommendations based on user goals.
  • Cost and Cuisine Tagging: Allows users to filter meals based on price and cuisine preferences.
  • Feedback Module: Collects user ratings to refine future recommendations.

Scaling AI: Microservices and API Design

We built LazyFit using a microservices architecture to ensure scalability and flexibility. Each module—meal generation, user management, and order processing—runs as an independent service, making it easier to scale different parts of the system without affecting others.

  • API Design: We built RESTful APIs to handle real-time communication between the frontend and backend, ensuring smooth user interactions and efficient processing.

Key Takeaways

  1. Security by Design: By using Clerk for authentication and encrypting all sensitive data in our database, LazyFit ensures that user information is secure at all times.
  2. Human-Validated AI: AI is only as good as the human expertise behind it. We worked with nutrition experts to codify our core algorithms, ensuring over 90% accuracy in recommendations.
  3. Scalable and Reliable: From day one, we built LazyFit to scale using cloud infrastructure and microservices, ensuring we can handle growing user demand.

By combining AI with expert-validated algorithms and best-in-class security practices, LazyFit is able to offer a scalable, reliable, and secure platform that meets the high standards of the healthtech industry. If you’re building an AI startup, make sure to prioritize security from day one, codify your core logic, and ensure that AI is enhancing, not replacing, human expertise.


LazyFit.ca recenty launched its public beta in Toronto, Canada. We are inviting early adopters to give us feedback and support our goal of delivering accessible personalized nutrition to busy people living with dietary conditions, or just to support their health and fitness goals effortlessly. Visit us https://lazyfit.ca

on September 18, 2024
  1. 1

    Impressive! Have you thought about using SEO? With SEO AI, you can optimize your website’s content and boost its online visibility, helping LazyFit climb the search rankings so more users can discover the benefits of your personalized approach.

  2. 1

    Nice! It's really nice to see a detailed breakdown of this process.