A minimal self-hosted period tracking app with a JSON file for data, two APIs, and a single-page frontend, free from accounts, cloud, ads, and data reporting.

Stars

17

7-day growth

No data

Forks

1

Open issues

0

License

MIT

Last updated

2026-07-07

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It offers complete privacy and simplicity—your body data stays on your own machine, with automatic deduplication, cycle derivation, and phase coloring, all without requiring Node.js or external services.

Who it is for

  • Privacy-conscious individuals tracking their menstrual cycles
  • Developers wanting a self-hosted, lightweight alternative to cloud-based period apps
  • Users who prefer simple, file-based backup and no vendor lock-in
  • People interested in understanding basic menstrual cycle algorithms

Use cases

  • Logging the start of a period with one click or retroactively via calendar
  • Viewing derived cycle statistics: average cycle length, next predicted start, current phase
  • Backing up data by copying a single JSON file
  • Running locally on a personal server with basic auth via reverse proxy

Strengths

  • No external dependencies for frontend (prebuilt static files included)
  • Automatic deduplication of repeated logs within the same period
  • Sensible cycle derivation algorithm (filters intervals <15 days and >60 days)
  • Full MIT license, enabling modification and reuse

Considerations

  • Only one user supported (no multi-user or sharing)
  • No encryption or authentication built-in (must add reverse proxy for public access)
  • Predictions are for reference only and not medical advice; limited accuracy with fewer than two recorded cycles

README quick start

period-tracker

极简自托管经期记录。一个 JSON 文件存数据、两个 API、一页前端——没有账号、没有云、没有广告、没有数据上报,你的身体数据只待在你自己的机器上。

功能

  • 一键「经期来了」记录来潮起始日;点日历任意一天可补记 / 撤销
  • 自动推导:平均周期、下次预计、当前周期第几天、当前相位(经期 / 卵泡 / 排卵 / 黄体 / 超期)
  • 日历按相位着色(只标到今天为止,不预演未来)
  • 同一次经期内手滑重复点击自动去重,不会算歪周期
  • 数据就是一个 period_state.json,备份 = 复制一个文件

跑起来

pip install -r requirements.txt
python server.py
# 打开 http://127.0.0.1:8080

前端构建产物已带在 static/ 里,克隆即用,不装 Node 也能跑。

配置

环境变量默认说明
PERIOD_DATA./period_state.json数据文件路径
PERIOD_PORT8080端口
PERIOD_HOST127.0.0.1监听地址。要对外服务请自己套认证(反代 + Basic Auth 等)

API

GET  /api/period/state
     → {state: {starts: ["YYYY-MM-DD", ...], period_length: 5}, derived: {...}}

POST /api/period/log
     body: {action: "start" | "undo", date?: "YYYY-MM-DD"}   # date 省略 = 今天
     → 同上

derived 字段:last_start / next_due / recorded / cycles / avg_cycle / period_length / day_of_cycle / days_until_next / phase

改前端

cd web
npm install
npm run dev      # 开发:5173 端口,API 代理到 :8080
npm run build    # 构建落到 ../static

测试

pip install pytest
pytest tests/

周期推导怎么算

  • 平均周期 = 相邻两次来潮起始日间隔的均值;间隔 60 天视为漏记一轮(不计入均值)
  • 排卵日 ≈ 下次预计前 14 天,前后各留一天为排卵窗口
  • 不足两次记录时按默认 28 天周期估算

⚠️ 预测仅供参考,不构成医疗建议;周期异常请咨询医生。

License

MIT

Description

极简自托管经期记录 · self-hosted period tracker: one JSON file, two APIs, one page

Related repositories

Similar projects matched by category, topics, and programming language.

TanStack
Featured
TanStack GitHub avatar

router

TanStack Router is a type-safe, data-driven React router with built-in caching, prefetching, and nested layouts, while TanStack Start extends it into a full-stack SSR framework.

Web DevelopmentFrontend Frameworks
14,861
vercel-labs
Featured
vercel-labs GitHub avatar

scriptc

scriptc compiles ordinary TypeScript into small, fast native executables without needing Node.js, V8, or any JavaScript runtime in the binary.

Developer ToolsCode Quality & Build
1,985
Jakubantalik
Featured
Jakubantalik GitHub avatar

thinking-orbs

A React component library that renders six hand-tuned animated thought orb loading indicators on a plain 2D canvas, with two purpose-tuned sizes and automatic theme detection for AI and agent UIs.

AI & Machine LearningAI Agents
1,191