Skip to content

angelself/SisyphusFlow

Repository files navigation

███████╗██╗███████╗██╗   ██╗██████╗ ██╗  ██╗██╗   ██╗███████╗
██╔════╝██║██╔════╝╚██╗ ██╔╝██╔══██╗██║  ██║██║   ██║██╔════╝
███████╗██║███████╗ ╚████╔╝ ██████╔╝███████║██║   ██║███████╗
╚════██║██║╚════██║  ╚██╔╝  ██╔═══╝ ██╔══██║██║   ██║╚════██║
███████║██║███████║   ██║   ██║     ██║  ██║╚██████╔╝███████║
╚══════╝╚═╝╚══════╝   ╚═╝   ╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚══════╝
                    ─── F L O W ───

每天推一次石头,不问山顶。

Python FastAPI React TailwindCSS SQLite


> whoami

Sisyphus Flow 是一款极简主义习惯追踪器 — 没有社交绑架、没有打卡排行榜,只有你和你的石头。

核心能力:

  • 🪨 创建习惯 — 自定义名称 + 描述 + 开始日期
  • ✏️ 编辑习惯 — 修改名称、描述、开始日期
  • 每日打卡 — 一键 check-in,重复防抖,不可逆
  • 🔥 连续 Streak — 自动计算连续坚持天数(断签归零)
  • 🗑️ 删除习惯 — 二次确认,硬删除含所有打卡记录
  • 📊 仪表盘总览 — 移动端优先的赛博面板,今日进度可视化

选做功能:

  • 🪨 巨石预警 — 22:00 后未打卡时,屏幕边缘泛红辉光 + 倒计时
  • 🏔️ 里程碑庆祝 — 连续 7 / 30 / 100 天时弹出全屏庆祝动画
  • 📟 极客战报 — ASCII 热力图一键生成,支持剪贴板复制分享

> arch --stack

┌─────────────────────────────────────────────────────────┐
│                    SISYPHUS FLOW                        │
├──────────────────────┬──────────────────────────────────┤
│       FRONTEND       │            BACKEND              │
│                      │                                  │
│  React 19 + Vite 7   │   FastAPI + Uvicorn             │
│  Tailwind CSS 4      │   SQLAlchemy ORM                │
│  Axios               │   SQLite (zero-config)          │
│  Lucide Icons        │   Pydantic v2 Schemas           │
│                      │                                  │
│  :5173               │   :8000                          │
├──────────────────────┴──────────────────────────────────┤
│                      SQLite                             │
│               sisyphus_flow.db                          │
└─────────────────────────────────────────────────────────┘
              ▲ REST API (JSON) ▲
         POST /api/habits
         GET  /api/habits
         PUT  /api/habits/{id}
         POST /api/habits/{id}/checkin
         DELETE /api/habits/{id}
         GET  /api/habits/{id}/checkins

> quickstart

环境要求

依赖 最低版本
Python 3.9+
Node.js 18+
npm 9+

一键启动

# 1. 克隆仓库
git clone <repo-url> && cd HabitTracker_Bootcam

# 2. 创建 Python 虚拟环境并安装后端依赖
python3 -m venv .venv
source .venv/bin/activate
pip install fastapi uvicorn sqlalchemy

# 3. 点火 🚀
chmod +x start.sh
./start.sh

start.sh 会自动完成:

  • ✔ 检测 .venv 虚拟环境
  • ✔ 自动 npm install(如缺 node_modules
  • ✔ 并行启动后端 Uvicorn + 前端 Vite
  • Ctrl+C 优雅关停所有进程

启动后访问:

服务 地址
前端 App http://localhost:5173
后端 API http://127.0.0.1:8000
Swagger 文档 http://127.0.0.1:8000/docs

> tree --annotated

.
├── start.sh                        # 🔥 双擎一键启动脚本
├── backend/
│   ├── main.py                     # ★ FastAPI 入口 — 路由 & 中间件 (6 endpoints)
│   ├── models.py                   #   SQLAlchemy 模型 (User, Habit, CheckIn, MilestoneRecord)
│   ├── schemas.py                  #   Pydantic 请求/响应 Schema
│   ├── crud.py                     #   数据库 CRUD 操作
│   └── database.py                 #   SQLite 引擎 & Session 工厂
├── frontend/
│   ├── index.html                  #   SPA 入口
│   ├── vite.config.js              #   Vite 构建配置
│   └── src/
│       ├── App.jsx                 #   React 根组件
│       ├── main.jsx                #   ReactDOM 挂载点
│       ├── index.css               #   Tailwind @theme + CSS 动画系统
│       ├── domain/
│       │   └── streakCalculator.js # ★ 领域服务 — 13 个纯函数 (DDD)
│       ├── components/
│       │   ├── HabitCard.jsx       # ★ 习惯卡片 — 打卡/编辑/删除/战报
│       │   ├── HabitFormModal.jsx   #   创建/编辑习惯共用弹窗
│       │   ├── TabBar.jsx          #   底部导航栏
│       │   ├── BoulderWarning.jsx  #   巨石预警 — 22:00 后倒计时
│       │   ├── MilestoneCelebration.jsx  # 里程碑庆祝弹窗
│       │   └── BattleReport.jsx    #   极客战报 — ASCII 热力图
│       └── pages/
│           ├── Dashboard.jsx       # ★ 首页 — 30天热力图与统计
│           ├── Habits.jsx          #   习惯页 — 打卡与管理列表
│           └── ProfilePage.jsx     #   我的页 — 人格引擎与开发者暗门
├── docs/                           #   PRD / 测试用例 / 视觉规范 / AI 日志
└── scripts/
    └── validate_prd.py             #   PRD 校验脚本

= 核心文件,修改前请三思。


> api --endpoints

Method Endpoint 描述
POST /api/habits 创建新习惯
GET /api/habits 获取习惯列表(含 streak & 今日状态)
PUT /api/habits/{id} 编辑习惯(名称/描述/开始日期)
POST /api/habits/{id}/checkin 提交打卡记录(不可逆,每日限一次)
DELETE /api/habits/{id} 删除习惯及所有打卡记录
GET /api/habits/{id}/checkins 获取某习惯的全部打卡日期列表

> license

MIT — 自由如西西弗斯。


"One must imagine Sisyphus happy."
                        — Albert Camus

Built with 🪨 and ☕

About

Minimalist habit tracker inspired by Sisyphus. Push your boulder daily. React 19 + FastAPI + TailwindCSS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors