Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Health Tracker

A personal and family health tracking dashboard focused on longevity and preventive medicine. Track biomarker readings over time, upload lab reports for AI-powered extraction, and monitor your health journey with an interactive timeline.

Features

  • Biomarker tracking -- log readings over time with trend sparklines and optimal/suboptimal classification across categories like heart health, metabolic health, liver, kidney, thyroid, iron, and more
  • AI-powered lab report extraction -- upload PDF lab reports or paste text and let OpenAI extract biomarker values automatically
  • AI health summaries -- generate an AI overview of your biomarker profile with per-biomarker assessments and recommendations
  • Medical timeline -- chronological history of doctor visits, surgeries, medications, lab reports, and imaging
  • Document management -- store and organise lab reports, medical documents, and DICOM imaging files
  • Family sharing -- household model with admin-managed, per-member access control so family members can share data
  • Retest scheduling -- automatic retest recommendations based on biomarker intervals and urgency
  • Health data connectors -- OAuth-based linking to external health data providers

Tech stack

Layer Technology
Framework Next.js 16 (App Router)
Language TypeScript 5
UI React 19, Tailwind CSS 4, Radix UI
Charts Visx, D3.js
Database Cloudflare D1 (SQLite)
Auth D1-backed sessions (email/password + Google OAuth)
Storage Cloudflare R2
AI OpenAI API
Hosting Cloudflare Workers via @opennextjs/cloudflare
Testing Vitest, Testing Library
Medical imaging DWV (DICOM viewer)

Live site

biomarkerhistory.com

Getting started

Prerequisites

1. Install dependencies

pnpm install

2. Configure environment variables

cp .env.local.example .env.local

Edit .env.local with your credentials:

Variable Required Description
OPENAI_API_KEY Yes OpenAI API key for extraction and summaries
GOOGLE_CLIENT_ID No Google OAuth client ID (enables Google sign-in)
GOOGLE_CLIENT_SECRET No Google OAuth client secret
OPENAI_EXTRACTION_MODEL No Model for PDF extraction (default: gpt-5-mini)
OPENAI_ASSESSMENT_MODEL No Model for biomarker assessments (default: gpt-5-mini)
OPENAI_INTAKE_MODEL No Model for timeline intake (default: gpt-5-mini)

3. Set up Cloudflare (D1 + R2)

Provision the database and bucket with Terraform (see infra/README.md), copy the d1_database_id output into wrangler.jsonc, then apply the schema and seed data:

pnpm db:schema:local   # or db:schema:remote for the production database
pnpm db:seed:local     # or db:seed:remote

Migrating an existing Supabase project? Follow MIGRATION.md.

4. Run the development server

pnpm preview

This builds with OpenNext and runs the app in the Workers runtime with local D1/R2 bindings. (pnpm dev still works for pure UI work, but database and storage features need the Workers runtime.)

Open http://localhost:3000 to view the app.

Deployment

The app is deployed to Cloudflare Workers using the @opennextjs/cloudflare adapter, which converts the Next.js output into a format compatible with the Workers runtime.

Deploy

pnpm deploy

This runs opennextjs-cloudflare build (which invokes next build internally) and then deploys to Cloudflare Workers. The custom domain biomarkerhistory.com is configured in wrangler.jsonc.

Preview locally in Workers runtime

pnpm preview

Configuration

  • wrangler.jsonc -- Cloudflare Workers config (custom domain, compatibility flags, bindings)
  • open-next.config.ts -- OpenNext adapter config
  • .dev.vars -- local dev environment overrides for Workers
  • public/_headers -- static asset cache headers

Environment variables (OpenAI, Google OAuth) need to be set as secrets on the Worker:

npx wrangler secret put OPENAI_API_KEY
npx wrangler secret put GOOGLE_CLIENT_ID
npx wrangler secret put GOOGLE_CLIENT_SECRET

The D1 database and R2 bucket are attached as bindings in wrangler.jsonc (no connection strings or keys needed).

Scripts

Command Description
pnpm dev Start the Next.js dev server
pnpm build Build for production
pnpm start Start the production server
pnpm deploy Build and deploy to Cloudflare Workers
pnpm preview Build and preview in Workers runtime locally
pnpm lint Run ESLint
pnpm test Run tests in watch mode
pnpm test:run Run tests once
pnpm db:schema:local / db:schema:remote Apply db/schema.sql to D1
pnpm db:seed:local / db:seed:remote Seed biomarker types + reference ranges
pnpm migrate:from-supabase Export a Supabase project into D1/R2 import files

Project structure

src/
├── app/
│   ├── (app)/              # Protected routes
│   │   ├── biomarkers/     # Biomarker listing and detail pages
│   │   ├── timeline/       # Medical timeline
│   │   ├── upload/         # Document upload
│   │   ├── documents/      # Document management
│   │   ├── ai-summary/     # AI health summary
│   │   └── details/        # Profile, medications, surgeries
│   ├── (auth)/             # Login and signup
│   └── api/                # API routes
├── components/
│   ├── ui/                 # Reusable UI primitives
│   └── timeline/           # Timeline components
└── lib/
    ├── auth/               # Session auth (passwords, sessions, Google OAuth)
    ├── connectors/         # Health data connector adapters
    ├── db.ts               # D1 database access helper
    ├── storage.ts          # R2 document storage helpers
    ├── queries.ts          # Database query functions
    ├── types.ts            # TypeScript type definitions
    ├── classification.ts   # Biomarker classification logic
    └── openai-*.ts         # OpenAI integration modules

db/
├── schema.sql              # D1 (SQLite) schema
└── seed.sql                # Seed data (biomarker types, reference ranges)

infra/                      # Terraform for the D1 database + R2 bucket

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages