Habit
Analyzer
Web app for habit tracking with a REST API and a dashboard for progress visualization.
TL;DR — 1 minute
Tracking habits and progress often turns into a spreadsheet or loose notes, with little insight and low consistency.
Backend in FastAPI + JWT and a Next.js frontend with logging flows and habit charts.
A functional MVP with Docker Compose, OpenAPI, and tests, plus optimized reads on large time windows.
Snapshot
Problem & Impact
- Symptom Scattered manual logging and little visibility into progress over time.
- Cause Data without a single model and without an aggregated view of habit history.
- Impact Lower adherence to tracking and worse routine decisions due to weak signal.
Approach
Structure habits, records, and analytic summaries in Postgres with clear persistence contracts and migration paths.
Provide a REST API with FastAPI, JWT authentication, and Swagger/OpenAPI docs to reduce integration friction.
Deliver a Next.js web dashboard with fast logging, per-habit charts, and efficient reads for larger time windows.
Reliability
Inconsistent data, authentication regressions, and divergence between summaries and time series.
Pydantic validation, Alembic migrations, and unit + E2E tests on the critical flow.
A summary strategy snippet with versioned cache and fallback between direct and pre-aggregated reads.
def get_habit_summary(self, user_id, habit_id, days=30): cache_key = (str(user_id), str(habit_id), days, int(habit.summary_version or 0)) use_daily = settings.USE_SUMMARY_DAILY and days <= settings.SUMMARY_WINDOW_DAYS if use_daily: rows = self.record_repo.get_summary_daily(habit_id, start_date, end_date) else: records = self.record_repo.get_by_date_range(habit_id, start_date, end_date) return result
Extensions & Next steps
- Add goals, streaks, and reminders to improve adherence.
- Expand weekly and monthly reports with per-habit filters.
- Add API and error observability for safer product evolution.
Need an MVP with API, authentication, and a visualization dashboard?
I design the architecture, implement the critical flow, and validate delivery with documentation and tests.