Inspiration

I live with a rare disease which makes my bones very brittle. I'm on regular medications and so I take frequent blood tests. It has become tedious to correlate different parameters from the blood test to my medications and existing ailments. I need to gain better insights from my blood tests so I can ask informed questions to my doctors. Hence I built my own Flutter Butler - Blood Health Tracker.

What it does

Blood Health Tracker is an intelligent Flutter web application with a Serverpod 3.2.0 backend that helps users track their blood test results, analyze correlations between health parameters, and get AI-powered insights using Google Gemini with Search grounding.

Features

  • Blood Report Management - Upload PDF/image reports for AI extraction or manually enter parameters; supports both numeric and qualitative (text-based) test results across blood, urine, and other parameter types
  • AI-Powered Correlation Analysis - Uses Gemini 2.5 Flash-Lite with Google Search grounding to correlate abnormal parameters with user health data, medications, and historical trends
  • Abnormal Detection - Automatically identifies parameters outside reference ranges with visual indicators
  • Doctor Questions - AI-generated relevant questions to ask your doctor based on analysis results
  • Historical Tracking - Compare parameters across reports over time with trend detection (improving/worsening)
  • Health Profile - Manage ailments, medications, and personal health information (height, weight, DOB, gender)
  • PDF Export - Generate PDF reports of blood test results
  • User API Key Support - Users can provide their own Gemini API key via settings
  • Async Job Processing - Long-running AI operations run asynchronously with status polling to avoid timeouts
  • Web-First - Responsive Flutter UI with navigation rail, accessible from any modern browser

How we built it

Technology Stack

Frontend

  • Flutter 3.32.0 (Web) - Responsive UI with Material Design 3
  • Provider 6.1.2 - State management
  • fl_chart 0.69.0 - Data visualization
  • Serverpod Client - Type-safe backend communication (auto-generated)
  • Serverpod Auth IDP - Authentication
  • pdf - PDF generation
  • file_picker / web - File upload support

Backend

  • Serverpod 3.2.3 - Dart backend framework with ORM, authentication, and code generation
  • Relic - High-performance web server integrated in Serverpod 3 (serves Flutter Web build)
  • PostgreSQL - Relational database via Serverpod ORM
  • Google Generative AI (Gemini) - AI-powered extraction and correlation analysis
  • Serverpod Auth IDP - Built-in authentication

Deployment

  • Serverpod Cloud - Managed hosting with single-command deployment, auto SSL, load balancing, and managed PostgreSQL

Built with Serverpod, Relic, and Serverpod Cloud

Blood Health Tracker is built entirely on the Serverpod ecosystem, and this choice shaped the project in fundamental ways. What could have been months of backend scaffolding, deployment configuration, and client-server integration work was instead handled by Serverpod's cohesive platform. Here's how each piece contributed.

Serverpod Framework: End-to-End Type Safety and Productivity

Serverpod 3.2 gave this project something rare in full-stack development: a single language (Dart) across the entire stack with type-safe code generation bridging the backend and frontend.

Protocol-driven development meant defining models once in .spy.yaml files and having Serverpod generate the database schema, Dart classes, serialization logic, and client-side stubs automatically. The 14 data models powering this app (blood reports, parameters, ailments, medications, correlation analyses, async jobs, and more) each required only a concise YAML definition. From that, serverpod generate produced:

  • Server-side model classes with full ORM support
  • A type-safe client library with endpoint method stubs
  • Database table definitions and migration SQL
  • Serialization/deserialization for all RPC calls

This eliminated an entire class of bugs. When an endpoint signature changed, the client code wouldn't compile until updated. When a model field was added, the migration system tracked the schema change. There was no separate API documentation to keep in sync, no manual JSON parsing, and no version drift between client and server.

Serverpod's ORM provided expressive, type-safe queries without writing raw SQL:

final reports = await BloodReport.db.find(
  session,
  where: (t) => t.userProfileId.equals(profile.id!),
  orderBy: (t) => t.reportDate,
  orderDescending: true,
);

The migration system tracked 6 incremental schema changes across development, each auto-generated and applied with --apply-migrations. Adding new tables (like async_jobs for background processing) required only a model definition and a single command.

Serverpod Auth provided production-ready email authentication with JWT tokens, verification codes, and password reset flows out of the box. Integrating it required minimal configuration in server.dart, and every endpoint could access the authenticated user via session.authenticated.userIdentifier. This saved significant effort compared to building custom auth, and the security model was sound from day one.

Relic: One Server, One Deployment

Relic, the high-performance web server integrated into Serverpod 3, was critical to this project's architecture. Instead of deploying the Flutter web app to a separate CDN or static hosting service and managing CORS, routing, and multiple deployment targets, Relic serves the entire Flutter web application directly from the Serverpod server.

pod.webServer.addRoute(
  FlutterRoute(Directory(Uri(path: 'web/app').toFilePath())),
  '/app',
);

This single integration point meant:

  • No CORS configuration - The API and web app share the same origin
  • No separate hosting - One server handles API calls, authentication, and the full Flutter web UI
  • Simplified routing - FlutterRoute handles client-side routing fallbacks automatically
  • Dynamic configuration - A custom AppConfigRoute serves runtime API configuration to the Flutter app, so the same build works across environments

Relic also serves static assets (landing page, images) alongside the Flutter app, making the server a complete, self-contained web application host. For a health data application where simplicity and reliability matter, having fewer moving parts directly improved both development velocity and operational confidence.

Serverpod Cloud: From Code to Production in One Command

Deploying a health tracking application with a database, backend API, web frontend, SSL, and managed infrastructure would typically require configuring multiple cloud services. With Serverpod Cloud, the entire deployment is:

scloud deploy

The scloud.yaml pre-deploy script automates the full build pipeline:

scripts:
  pre_deploy:
    - cd ../blood_health_tracker_flutter && flutter build web --release --base-href /app/
    - cp -r ../blood_health_tracker_flutter/build/web/* web/app/

Every deployment automatically builds the Flutter web app, copies it into the server directory, deploys the Serverpod backend with Relic serving the frontend, applies pending database migrations, and provisions SSL certificates and load balancing.

Secrets management via scloud secret kept API keys (like the Gemini AI key) out of source control and securely available in production. Managed PostgreSQL meant zero database administration. Log access via scloud log provided immediate production debugging.

The practical impact: this project went from local development to a publicly accessible, SSL-secured, load-balanced production deployment with managed PostgreSQL without writing a single line of infrastructure configuration. No Dockerfiles for production, no Kubernetes manifests, no Terraform scripts, no CI/CD pipeline configuration.

What This Meant for the Project

The combination of Serverpod + Relic + Serverpod Cloud allowed a solo developer to build and ship a full-stack health application with AI integration, real-time data processing, and production infrastructure in a fraction of the time it would have taken with conventional tools. The developer's time went into building features (AI-powered report extraction, correlation analysis, async job processing) rather than plumbing.

Key outcomes enabled by the Serverpod ecosystem:

  • 10 type-safe API endpoints with auto-generated client code and zero manual serialization
  • 14 database models with migration tracking and expressive ORM queries
  • Unified deployment of Flutter web + Dart backend + PostgreSQL via a single command
  • Built-in authentication with JWT tokens and email verification
  • Async job system for long-running AI operations, working within Serverpod Cloud's proxy architecture
  • Production infrastructure (SSL, load balancing, managed database, secrets) with zero DevOps overhead

For a project handling sensitive health data, the reduced surface area for bugs (type safety), built-in security patterns (Serverpod Auth), and managed infrastructure (Serverpod Cloud) weren't just conveniences. They were the difference between shipping a reliable product and getting lost in infrastructure.

Challenges we ran into

  1. Was facing timeout issues in the client while waiting for the response during AI jobs from the Serverpod Cloud as Gemini response time varied with the size of the blood report. Fixed the issue by implementing Async Jobs to poll the Serverpod Cloud for results instead of waiting for the response.

  2. SMTP ports 465, 587 were closed in the Serverpod Cloud, Used an API instead to sent email verification emails.

Remaining challenges covered in my feedback submission.

Accomplishments that we're proud of

Built a full-stack AI powered application with just dart and flutter to solve my problem within the stipulated period of the hackathon.

What we learned

Serverpod provides great Developer Experience to develop a full-stack application akin to what Flutter developers are used to with the front-end development.

By just defining the models in .spy.yaml files, Serverpod can generate the database schema, Dart classes, serialization logic, and client-side stubs automatically. This saves lot of time during development and avoids mistakes.

The structured framework and the availability of MCP for the documents makes it really easy to build Serverpod powered applications using AI.

What's next for Blood Health Tracker

  • Flutter mobile apps
  • Push notifications for abnormal results
  • Interactive charts for historical parameter visualization
  • Direct integration with healthcare providers
  • Family health tracking and sharing
  • Multi-language support
  • HIPAA Compliance

Built With

Share this project:

Updates