{"id":27781245,"url":"https://github.com/pyfig/habit_tracker","last_synced_at":"2026-04-13T21:01:39.764Z","repository":{"id":289109087,"uuid":"969993006","full_name":"pyfig/habit_tracker","owner":"pyfig","description":"A simple and intuitive habit tracking application. It helps you build good habits, break bad ones, and stay consistent over time. Features include user authentication, habit management, daily check-ins, and progress tracking through a calendar view.","archived":false,"fork":false,"pushed_at":"2025-04-28T19:05:39.000Z","size":128,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-28T19:43:58.860Z","etag":null,"topics":["bash","docker-compose","dockerfile","javascript","python3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyfig.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-21T09:25:15.000Z","updated_at":"2025-04-28T19:05:44.000Z","dependencies_parsed_at":"2025-04-21T16:22:16.584Z","dependency_job_id":"923df3c4-7381-4f4d-8606-71ce2994a3da","html_url":"https://github.com/pyfig/habit_tracker","commit_stats":null,"previous_names":["pyfig/habit_tracker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyfig%2Fhabit_tracker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyfig%2Fhabit_tracker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyfig%2Fhabit_tracker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyfig%2Fhabit_tracker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyfig","download_url":"https://codeload.github.com/pyfig/habit_tracker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251702782,"owners_count":21630092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","docker-compose","dockerfile","javascript","python3"],"created_at":"2025-04-30T12:43:35.811Z","updated_at":"2026-04-13T21:01:39.759Z","avatar_url":"https://github.com/pyfig.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Habit Tracker\n\nA simple, container-ready application for forming and maintaining daily habits.  \nCreate, edit, archive, restore and track progress through a calendar.\n\n---\n\n## Features\n### Authentication\n* **Registration / Login / Logout** (JWT)\n\n### Habit Management\n* **Create / Edit / Delete**\n* **Archive** and **Restore**\n* **Mark completed / undo** with database persistence\n* **Complete habits** with automatic mark creation\n\n### Progress Tracking\n* **Daily completion marks**\n* **Calendar view** with streaks\n* **Today's completed list**\n* **Delete mark**\n* **Visual progress indicators**\n\n### Database \u0026 Testing\n* **PostgreSQL** database with SQLAlchemy ORM\n* **94.32% test coverage** with comprehensive test suite\n* **End-to-end testing** for all functionality\n* **SQLite** for testing with automatic setup\n\n---\n\n## API\n\n| Method | Endpoint                              | Description                        | Auth |\n|--------|---------------------------------------|------------------------------------|------|\n| POST   | `/api/auth/register`                  | Register a new user                | ❌   |\n| POST   | `/api/auth/login`                     | Obtain JWT token                   | ❌   |\n| GET    | `/api/habits/`                        | List active habits                 | ✅   |\n| POST   | `/api/habits/`                        | Create a habit                     | ✅   |\n| PUT    | `/api/habits/{habit_id}`              | Update a habit                     | ✅   |\n| DELETE | `/api/habits/{habit_id}`              | Delete a habit                     | ✅   |\n| POST   | `/api/habits/{habit_id}/archive`      | Archive a habit                    | ✅   |\n| POST   | `/api/habits/{habit_id}/restore`      | Restore a habit                    | ✅   |\n| GET    | `/api/habits/archived`                | List archived habits               | ✅   |\n| GET    | `/api/habits/completed`               | List completed habits              | ✅   |\n| POST   | `/api/habits/{habit_id}/complete`     | Mark habit completed today         | ✅   |\n| POST   | `/api/habits/{habit_id}/uncomplete`   | Undo completion mark               | ✅   |\n| POST   | `/api/marks/`                         | Create a mark (any date)           | ✅   |\n| GET    | `/api/marks/habit/{habit_id}/`        | All marks for a habit              | ✅   |\n| DELETE | `/api/marks/{mark_id}`                | Delete a mark                      | ✅   |\n| GET    | `/api/profile/metrics`                | Get user metrics                   | ✅   |\n| GET    | `/`                                   | Health-check \"Welcome\" message     | ❌   |\n\n\u003e **✅** Authenticated endpoints require `Authorization: Bearer token;`\n  where the token comes from `/api/auth/login`.\n\n---\n\n## Quick Start\n\n### Requirements\n* Docker \u0026 Docker Compose  \n* Git\n\n```bash\ngit clone https://github.com/your-org/habit_tracker.git\ncd habit_tracker\n./main.sh      \n```\n\n| Service  | URL                                            |\n| -------- | ---------------------------------------------- |\n| Backend  | [http://localhost:8000](http://localhost:8000) |\n| Frontend | [http://localhost:3000](http://localhost:3000) |                     \n\nFront-end is a static SPA (HTML / CSS / vanilla JS) served by Nginx.\nIn the standard Docker setup, the frontend sends API requests to `/api` on the same host, and Nginx proxies them to the backend container.\n\n---\n\n## Testing \u0026 Coverage\n\n### Run Tests\n```bash\n# inside project root\n./tests.sh                        # report in results.txt  \n                                  # spins up Postgres -\u003e runs backend tests -\u003e shows coverage\n```\n\n### Test Coverage\n- **Current Coverage: 94.32%** (exceeds 80% requirement)\n- **17 tests passing** with comprehensive coverage\n- **End-to-end testing** for habit completion functionality\n- **Integration tests** for API endpoints\n\n### Test Structure\n```\nbackend/tests/\n├── test_auth.py                      # Authentication tests\n├── test_habits.py                    # Habit CRUD tests\n├── test_marks.py                     # Mark tests\n├── test_metrics.py                   # Profile metrics tests\n├── test_archive.py                   # Archive/restore tests\n├── test_complete_functionality.py    # E2E completion test\n├── test_db_setup.py                  # Database setup debug\n├── create_test_db.py                 # Database creation debug\n├── conftest.py                       # Pytest configuration\n└── README.md                         # Test documentation\n```\n\n---\n\n## Project Structure\n\n```\n📦 habit_tracker\n├─ backend/             # FastAPI application\n│  ├─ app/              # routes, models, schemas, auth, main.py\n│  ├─ tests/            # pytest suite (runs inside container)\n│  └─ requirements.txt  # Python dependencies\n├─ frontend/            # Static SPA\n├─ tests.sh             # one-liner test runner (Docker Compose)\n├─ main.sh              # one-liner app runner (Docker Compose)\n├─ pytest.ini           # pytest config\n├─ docker-compose.yml   # db, backend, frontend, tests\n└─ README.md / README_RUS.md\n```\n\n---\n\n## Recent Updates\n\n### ✅ Completed Features\n* **JWT authentication** with secure token handling\n* **Habit completion** with database persistence\n* **Archive/restore** functionality\n* **Calendar streaks** and visual progress\n* **Comprehensive test suite** with 94.32% coverage\n* **End-to-end testing** for complete workflows\n* **SQLite testing** with automatic database setup\n* **Frontend improvements** with proper API integration\n\n### 🚀 Planned Features\n* Grafana dashboard with metrics\n* Telegram notifications for completed habits\n* Advanced analytics and reporting\n* Mobile-responsive design improvements\n\n---\n\n## Technical Details\n\n### Backend\n- **FastAPI** with automatic API documentation\n- **SQLAlchemy ORM** with PostgreSQL/SQLite support\n- **JWT authentication** with secure password hashing\n- **Pydantic validation** for request/response schemas\n- **Comprehensive error handling** and validation\n\n### Frontend\n- **Vanilla JavaScript** with modern ES6+ features\n- **Responsive design** with CSS Grid and Flexbox\n- **Real-time updates** without page refreshes\n- **Local storage** for authentication persistence\n\n### Testing\n- **Pytest** with async support\n- **Coverage reporting** with HTML output\n- **Docker-based testing** for consistency\n- **Integration tests** for API endpoints\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyfig%2Fhabit_tracker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyfig%2Fhabit_tracker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyfig%2Fhabit_tracker/lists"}