Wired

Stay wired. Sleep well.

Can I have another coffee and still sleep tonight?


Screenshots

Onboarding

Splash Sleep schedule Metabolism
Welcome Sleep schedule Metabolism

Core Flow

Dashboard empty Dashboard active Log drink Drinks list
Dashboard (clear) Dashboard (active) Log a drink Drink history

The Problem

Caffeine's half-life averages 5 hours — meaning a 3pm coffee still has half its caffeine in your system at 8pm. Most people know caffeine affects sleep, but have no intuition for how much or for how long. Wired makes that invisible curve visible.


Features

Live caffeine arc — A pharmacokinetic decay model samples your caffeine level every 15 minutes across a 24-hour window and renders it as a continuous arc. It rises when you log a drink and decays in real time.

Sleep window — Set your bedtime once. Wired tells you whether you'll clear your threshold in time — green if you're on track, amber if it's close, "Window closed" when you've had too much too late. No lecture, just the fact.

Clearance countdown — The dashboard always shows your exact mg in system and the clock time you drop below your sleep threshold.

Personalized half-life — Caffeine metabolism ranges from 3.5 to 7 hours depending on the person. Set your sensitivity on first launch and the model adjusts accordingly.

10 drink types — Espresso-based drinks logged by shot count; drip, cold brew, matcha, tea, energy drink, and pre-workout by size. Each uses researched caffeine baselines.


How It Works

Caffeine follows first-order exponential decay. For each logged drink:

mg_remaining(t) = dose × 0.5^(t / halfLife)

Where t is hours elapsed since logging and halfLife is determined by sensitivity setting (Slow: 7h, Normal: 5h, Fast: 3.5h). Multiple drinks sum linearly.

The curve samples 97 points across a 24-hour window starting 4 hours before now, so the arc always captures the rise from recent drinks alongside the projected decay ahead.


Drink Types

Drink Caffeine Input
Espresso 75 mg / shot Shot count
Latte 75 mg / shot Shot count
Americano 75 mg / shot Shot count
Mocha 75 mg / shot Shot count
Drip Coffee 150 mg (medium) S / M / L
Cold Brew 200 mg (medium) S / M / L
Matcha 70 mg (medium) S / M / L
Tea 50 mg (medium) S / M / L
Energy Drink 150 mg (medium) S / M / L
Pre-Workout 200 mg (medium) S / M / L

Size factors: Small 0.75×, Medium 1.0×, Large 1.25×


Architecture

CaffeineEngine          Pure static functions — no state, fully unit tested
       ↓
CurveViewModel          @Observable — owns entries, settings, timer, derived curve
       ↓
Views                   Read from vm, never call engine directly

CaffeineEngine is stateless and dependency-free by design. All 11 unit tests pass.


Tech Stack

  • Swift / SwiftUI — native iOS
  • SwiftData — persists logged drinks as LogEntry models
  • UserDefaults — stores bedtime, sensitivity, and threshold settings
  • Canvas API — renders the caffeine arc and mini chart with no charting library
  • Observation framework@Observable view model with a live Timer for current mg

No third-party dependencies.


Built At

Pacific Lutheran University — LuteHacks 2026

Built With

Share this project:

Updates