About Agada Health

Inspiration

The idea for Agada Health came from my personal struggle to stay motivated in my fitness journey. As someone who has faced weight challenges, I was inspired by how difficult it can be to find a proper diet and strength-training schedule. With Perplexity’s Sonar API, generating tailored plans has become significantly easier.

What it does

Agada Health is an AI-powered coaching platform that seamlessly tracks:

  • Profile & Demographics (height, age, sex, goal weight)
  • Workouts and Weight History
  • Body Metrics (BMI, BFP, BMR, TDEE, etc.)

Through a chat-based interface, it generates:

  • Personalized fitness routines
  • Strength-training programs
  • Diet plans

All tailored to your goals, medical history, and activity level.

How we built it

  1. Database & ORM
    • Modeled users, sessions, profiles, weight logs, and AI suggestions in SQLite using Drizzle ORM for type-safe relational data.
  2. Backend & API
    • Developed Next.js server functions to handle profile CRUD, weight logging, and calls to Perplexity Sonar API for metric calculations and content generation.
  3. AI Prompting
    • Crafted precise system/user prompts and JSON/Markdown schemas to ensure the LLM returns valid, structured outputs every time.
  4. Frontend
    • Implemented a chat-driven UI in Next.js where users can log data, ask questions, and receive formatted recommendations in real time.

Challenges we ran into

  • LLM Consistency: Ensuring the AI adhered strictly to JSON schemas or Markdown formats required multiple prompt refinements.
  • Time & Date Logic: Converting JS Date objects to SQLite timestamps and accurately computing age across time zones.
  • Data Integrity: Managing cascading deletes and foreign-key relationships so that deleting a user cleans up all related data.
  • Error Handling: Handling occasional API failures or unexpected responses gracefully.

Accomplishments that we're proud of

  • End-to-End Integration: A seamless flow from data entry to AI-driven recommendations.
  • Structured AI Outputs: Schema-driven prompts that reliably produce valid JSON or Markdown, reducing post-processing.
  • Modular Architecture: Clear separation of database models, server logic, and AI layers, simplifying future extensions.
  • Personalization at Scale: Automatic tailoring of fitness and nutrition plans based on individual metrics, goals, and restrictions.

Use of Perplexity Sonar API

Body-Metrics Calculation

  • calculateBodyMetrics
    Sends user height, age, sex, and weight to Perplexity with a JSON schema prompt
    Returns a JSON object of metrics (BMI, BFP, BMR, TDEE, etc.)

Metric Explanation

  • explainBodyMetrics
    Takes a single metric label and full metrics payload
    Requests a Markdown-formatted explanation in six sections:
    • measures
    • importance
    • comparison
    • improvement
    • tips
    • diet

General Coaching Suggestions

  • generateSuggestions
    Feeds current vs. goal weight, metrics, medical history, and activity level to Perplexity
    Outputs a JSON list of nutrition, exercise, and lifestyle tips with rationales

Strength-Training Program Generation

  • generateStrengthTrainingSuggestions
    Markdown outline

  • generateWorkoutFromSuggestion
    JSON schema for full program

Diet-Plan Creation

  • generateDietSuggestions
    Sends user context to Perplexity and requests a five-section Markdown diet plan

Input Normalization & Parsing

  • generateWeight

  • generateProfileInfo
    Extracts or converts free-form text into canonical JSON fields

What we learned

  • Proper use of Perplexity Sonar API for structured AI responses
  • Advanced prompt engineering to deterministic model behavior

What’s next for Agada Health

The functionality I have on my mind that I am planning to add after judging period are:

  • Sync workout program with google calendar -Ability to track workout inside the application

Built With

  • drizzle
  • next.js
  • perplexity
  • plerplexity-ai
  • turso
Share this project:

Updates