Skip to content

Repository files navigation

Copilot - Productivity & Health Dashboard

A personal optimization co-pilot that tracks 9 health and productivity factors, providing AI-powered insights to help you perform at your best.

Overview

Copilot is a cross-platform dashboard (web + mobile) that aggregates data from various health metrics to give you actionable insights about your wellbeing and productivity patterns. Think of it as a personal coach that understands the interconnections between sleep, focus, stress, and physical health.

The 9 Tracked Factors

Factor Priority Key Metrics
Sleep Critical Duration, quality score, bedtime consistency, sleep debt
Focus Critical Deep work hours, context switches, longest focus block
Stress/Energy High Stress level (1-10), energy level, HRV-based indicators
Hydration Medium Daily water intake, % of goal, streak
Caffeine Medium Daily intake (mg), timing, "safe for sleep" countdown
Exercise Medium Weekly active minutes, days exercised, steps
Mindfulness Medium Minutes meditated, streak, weekly total
Nutrition Medium Meal logging, quality rating, protein tracking
Cognitive Load Medium Work hours, task completion rate, demand level

Nepheli Insights (AI Coaching)

The dashboard includes an AI coaching system called "Nepheli" (Νεφέλη) that:

  • Analyzes patterns across all tracked factors
  • Detects compound risks (e.g., poor sleep + high stress + overwork = burnout alert)
  • Provides contextual, actionable recommendations
  • Cites research-backed metrics (effect sizes, cognitive impairment data)

Features

Current Implementation

  • Dashboard View: Grid layout with factor cards showing current status and 7-day sparkline trends
  • Status Indicators: Color-coded badges (Good/Warning/Critical) based on configurable thresholds
  • Data Entry Modals: Quick-entry forms for each factor with smart defaults
  • Dark/Light Theme: System-aware with manual toggle
  • Responsive Design: Desktop (3-col), Tablet (2-col), Mobile (1-col)
  • RESTful API: Full CRUD operations with SQLite persistence
  • Cross-Platform: Shared types and API client between web and mobile

Visualization Components

  • Sparklines: 7-day trend mini-charts
  • Progress Rings: Circular progress for goals (hydration, exercise)
  • Stress Gauge: Semicircle gauge visualization
  • Streak Indicators: Visual dot patterns for consecutive days

Tech Stack

Runtime & Tooling

  • Bun v1.3.3+ - JavaScript runtime, package manager, bundler
  • TypeScript 5.9 - Type safety across all packages

Web (packages/web)

  • React 19 - UI framework
  • Vite 7 - Build tool with HMR
  • Tailwind CSS v4 - Utility-first styling
  • React Router 7 - Client-side routing
  • Recharts - Data visualization
  • Lucide React - Icon system

Mobile (packages/mobile)

  • React Native 0.83 - Cross-platform mobile
  • NativeWind 4.1 - Tailwind for React Native
  • React Navigation 7 - Native navigation stack
  • React Native Reanimated 4 - Animations

Backend (server/)

  • Bun.serve() - HTTP server with routing
  • bun:sqlite - Native SQLite driver
  • SQLite - Local database (WAL mode)

Architecture

copilot/
├── packages/
│   ├── web/                    # React web application
│   │   ├── src/
│   │   │   ├── components/     # UI components
│   │   │   │   ├── cards/      # Factor cards (SleepCard, FocusCard, etc.)
│   │   │   │   ├── charts/     # Visualization (Sparkline, ProgressRing, etc.)
│   │   │   │   ├── modals/     # Data entry modals
│   │   │   │   └── layout/     # Layout components
│   │   │   ├── context/        # React Context (AppContext, ThemeContext)
│   │   │   └── pages/          # Route pages
│   │   └── index.html
│   │
│   ├── mobile/                 # React Native application
│   │   ├── src/
│   │   │   ├── components/     # Native components
│   │   │   ├── screens/        # Screen components
│   │   │   ├── navigation/     # Navigation config
│   │   │   └── context/        # State management
│   │   ├── android/            # Android native project
│   │   └── ios/                # iOS native project
│   │
│   └── shared/                 # Shared code
│       └── src/
│           ├── types/          # TypeScript types (311+ lines)
│           └── lib/
│               ├── api.ts      # Typed API client
│               └── utils.ts    # Utility functions
│
├── server/                     # API server
│   ├── index.ts                # Routes & handlers
│   └── db/
│       ├── schema.ts           # SQLite schema
│       ├── database.ts         # Connection
│       └── seed.ts             # Seed with dummy data
│
└── data/                       # SQLite database files
    └── dashboard.db

Key Design Patterns

  • Shared Package: All TypeScript types and API client code is shared between web and mobile
  • Context + Reducer: Global state management with typed actions
  • Composition: FactorCard is a generic base; specific cards compose it with domain logic
  • Optimistic Updates: UI updates immediately, syncs with API in background

Getting Started

Prerequisites

  • Bun v1.3.3 or higher
  • For mobile: Xcode (iOS) or Android Studio (Android)

Installation

# Install dependencies
bun install

# Seed the database with sample data
bun run db:seed

Development

# Start API server (port 3001)
bun run server:dev

# Start web app (port 5173)
bun run dev

# Start mobile app
bun run mobile

Running Tests

# Mobile tests (Jest)
bun run --filter '@dashboard/mobile' test

# Run specific test file
bun run --filter '@dashboard/mobile' test <filename>

API Reference

Method Endpoint Description
GET/PUT /api/settings User settings and goals
GET/POST /api/sleep Sleep entries
GET/POST /api/focus Focus sessions
GET/POST /api/stress Stress check-ins
GET/POST /api/hydration Water intake logs
GET/POST /api/caffeine Caffeine logs
GET/POST /api/exercise Exercise logs
GET/POST /api/mindfulness Mindfulness logs
GET/POST /api/nutrition Meal logs
GET/POST /api/workload Workday logs
GET /api/aggregates Calculated weekly statistics
GET /api/insights AI-generated coaching insights
POST /api/insights/:id/dismiss Dismiss an insight

Current Status

Completed

  • Monorepo structure with Bun workspaces
  • Shared types package
  • API client with typed endpoints
  • SQLite database with full schema
  • REST API for all 9 factors
  • Web dashboard with all factor cards
  • Data entry modals
  • Sparkline and progress visualizations
  • Dark/light theme support
  • React Native app scaffold
  • Mobile navigation structure
  • NativeWind styling setup

In Progress

  • Mobile factor cards with full parity
  • Insights generation logic
  • Aggregate calculations
  • Cross-factor correlation analysis

Roadmap

Phase 1: Core Polish

  • Complete mobile UI parity with web
  • Implement insight generation algorithms
  • Add data validation and error handling
  • Comprehensive test coverage

Phase 2: Data Import

  • Apple Health integration
  • Google Fit integration
  • Wearable device sync (Oura, Whoop, Garmin, Fitbit)
  • Calendar integration for context switches
  • Toggl/RescueTime import

Phase 3: Intelligence

  • Pattern detection algorithms
  • Compound risk identification (burnout, overtraining)
  • Personalized threshold learning
  • Trend prediction
  • Natural language insights

Phase 4: Engagement

  • Push notifications for check-ins
  • Widget support (iOS/Android)
  • Daily/weekly digest emails
  • Goal setting and tracking
  • Achievement system

Phase 5: Scale

  • Multi-user support
  • Cloud sync
  • Export functionality (CSV, PDF reports)
  • API for third-party integrations

Design Philosophy

  • Data-dense but not cluttered: Show relevant metrics at a glance
  • Personal, not enterprise: Feels like a co-pilot, not corporate software
  • Science-backed: Citations and effect sizes where applicable
  • Quick entry: Logging should take seconds, not minutes
  • Privacy-first: Local-first data, optional sync

Thresholds Reference

Sleep

  • Good: 7-9 hours, quality 7-10
  • Warning: 6-7 hours, quality 5-6
  • Critical: <6 hours, quality <5

Focus

  • Good: >4h deep work, <10 context switches
  • Warning: 2-4h deep work, 10-20 switches
  • Critical: <2h deep work, >20 switches

Stress

  • Good: 1-3 level
  • Warning: 4-6 level
  • Critical: 7-10 level

Exercise

  • Good: >150 min/week, 5+ active days
  • Warning: 75-150 min/week, 3-4 active days
  • Critical: <75 min/week, <3 active days

Caffeine

  • Good: 200-400mg, last intake before 2pm
  • Warning: 400-600mg, last intake 2-5pm
  • Critical: >600mg, last intake after 5pm

License

Private project - All rights reserved.


Built with Bun, React, and a commitment to human performance optimization.

About

Productivity & Health Co-Pilot Dashboard - Track 9 health/productivity factors with AI insights

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages