asopi tech
asopi techIndie Developer

Asopitech With · Fitness tracker

Fitbit steps, heart rate and sleep with Alopex Skulk & Alopex DB

Fitbit is a fitness tracker worn on the wrist that records steps, heart rate and sleep and shows them on the device and in a phone app. What if we rebuilt it with Alopex Skulk and Alopex DB?

Updated: Oct 13, 2026

What the service does

Fitbit devices record steps, heart rate and sleep. Devices that track heart rate also track sleep stages. The day’s records appear in Fitbit Today on the device and in the Google Health app on the phone. This page rebuilds the steps, heart rate and sleep records.

Where the data lives

  • Skulk time series: steps, heart rate and sleep stages are appended to Skulk with user and device tags. Daily totals and averages come from time buckets.
  • Alopex DB SQL tables: users, devices, goals and exercise records live in SQL tables.

Reading the sensors and writing values is the job of the device software.

Deployment

Skulk is embedded in the wrist device and the phone app, and Alopex DB in the phone app. Records collect locally and keep going where there is no signal. Where records from many users are gathered, the same engines run as servers or clusters.

Why Alopex Skulk and Alopex DB fit

Health records are both fine-grained time series and goals and exercise records. Skulk handles time-series ingestion and aggregation, and Alopex DB holds goals and records in SQL, both embeddable on the device.

See it in code

Goals and workout records live in Alopex DB (steps, heart-rate and sleep time series in Skulk). Just the core of showing progress toward a goal.

import alopex

# 目標と運動の記録は Alopex DB(歩数・心拍・睡眠の時系列は Skulk)
db = alopex.Database.open("fitbit.alopex")

db.execute_sql("CREATE TABLE IF NOT EXISTS goals (metric TEXT, target INTEGER)")
db.execute_sql("""
    CREATE TABLE IF NOT EXISTS workouts (
        ymd DATE,
        kind TEXT,
        minutes INTEGER
    )
""")

db.execute_sql("INSERT INTO goals (metric, target) VALUES (?, ?)", ["weekly_minutes", 150])
for ymd, kind, minutes in [("2026-10-18", "run", 40), ("2026-10-19", "walk", 30), ("2026-10-21", "run", 50)]:
    db.execute_sql("INSERT INTO workouts (ymd, kind, minutes) VALUES (?, ?, ?)", [ymd, kind, minutes])

# 今週の運動の合計と、目標までの残りを出す
total = db.execute_sql("SELECT SUM(minutes) AS total FROM workouts")[0]["total"]
target = db.execute_sql("SELECT target FROM goals WHERE metric = ?", ["weekly_minutes"])[0]["target"]
print(f"今週 {total}分 / 目標 {target}分(残り {max(target - total, 0)}分)")

Summing the records and comparing to the goal. The fine-grained steps, heart-rate and sleep time series is ingested and rolled up daily by Skulk.

Build step and heart rate records with Alopex Skulk, small enough to embed even in a tiny device.