Star 历史趋势
数据来源: GitHub API · 生成自 Stargazers.cn
README.md

Habit Tracker

Workshop participants: For the template and starting point, switch to the workshop branch.

A personal habit tracking web application for building and maintaining daily habits through streak tracking, completion rates, and calendar visualization. Built with FastAPI (Python) backend and React frontend, this local-first application runs entirely on your machine with no account required—just simple, distraction-free habit tracking.

Prerequisites

  • Python 3.11+ with uv package manager
  • Node.js 18+ with npm
  • Git (optional, for cloning)

Quick Start

1. Clone and Setup Backend

cd backend
uv sync
uv run uvicorn app.main:app --reload --port 8000

Backend runs at http://localhost:8000 (API docs at http://localhost:8000/docs)

2. Setup Frontend (new terminal)

cd frontend
npm install
npm run dev

Frontend runs at http://localhost:5173

3. Open the App

Navigate to http://localhost:5173 in your browser. Create your first habit and start tracking!

Architecture

┌─────────────────┐     HTTP/JSON      ┌─────────────────┐
│  React + Vite   │ ◄───────────────► │    FastAPI      │
│   Port 5173     │                    │   Port 8000     │
└─────────────────┘                    └────────┬────────┘
                                                │
                                       ┌─────────────────┐
                                       │     SQLite      │
                                       │   habits.db     │
                                       └─────────────────┘

Tech Stack

LayerTechnology
BackendPython 3.11, FastAPI, SQLAlchemy, SQLite
FrontendReact 18, Vite, TanStack Query, Tailwind CSS
Date Handlingdate-fns

Project Structure

habit-tracker/
├── backend/
│   ├── app/
│   │   ├── main.py           # FastAPI entry point
│   │   ├── database.py       # SQLite connection
│   │   ├── models.py         # SQLAlchemy models (Habit, Completion)
│   │   ├── schemas.py        # Pydantic request/response schemas
│   │   └── routers/          # API endpoints
│   │       ├── habits.py     # CRUD + streak calculation
│   │       └── completions.py
│   └── tests/                # pytest tests
├── frontend/
│   ├── src/
│   │   ├── features/
│   │   │   ├── habits/       # Habit components, hooks, API
│   │   │   └── calendar/     # Calendar view components
│   │   ├── components/ui/    # Shared UI components
│   │   ├── pages/            # Route pages
│   │   └── lib/              # Utilities
│   └── package.json
└── README.md

Features

  • Daily Habit Tracking — Create habits, mark them complete with one click
  • Streak Tracking — See current streak and completion rate per habit
  • Calendar View — Monthly grid showing completion history with color-coded days
  • Planned Absences — Skip days without breaking your streak
  • Local & Private — All data stored locally in SQLite, no account needed

API Endpoints

MethodEndpointDescription
GET/api/habitsList all habits with stats
POST/api/habitsCreate a new habit
POST/api/habits/{id}/completeMark habit complete for a date
DELETE/api/habits/{id}/completions/{date}Undo a completion
GET/api/habits/{id}/completionsGet completion history

Full API documentation available at http://localhost:8000/docs when backend is running.

Claude Commands

Slash commands for Claude Code to assist with development workflows. The AI coding workflow used to build this application follows the PIV (Prime, Implement, Validate) loop shown below:

PIV Loop Diagram

Planning & Execution

CommandDescription
/core_piv_loop:primeLoad project context and codebase understanding
/core_piv_loop:plan-featureCreate comprehensive implementation plan with codebase analysis
/core_piv_loop:executeExecute an implementation plan step-by-step

Validation

CommandDescription
/validation:validateRun full validation: tests, linting, coverage, frontend build
/validation:code-reviewTechnical code review on changed files
/validation:code-review-fixFix issues found in code review
/validation:execution-reportGenerate report after implementing a feature
/validation:system-reviewAnalyze implementation vs plan for process improvements

Bug Fixing

CommandDescription
/github_bug_fix:rcaCreate root cause analysis document for a GitHub issue
/github_bug_fix:implement-fixImplement fix based on RCA document

Misc

CommandDescription
/commitCreate atomic commit with appropriate tag (feat, fix, docs, etc.)
/init-projectInstall dependencies, start backend and frontend servers
/create-prdGenerate Product Requirements Document from conversation

关于 About

Habit Tracker for the AI Coding Workshop

语言 Languages

Python60.5%
JavaScript38.9%
HTML0.5%
CSS0.1%

提交活跃度 Commit Activity

代码提交热力图
过去 52 周的开发活跃度
6
Total Commits
峰值: 6次/周
Less
More

核心贡献者 Contributors