Product Case

Habit
Analyzer

Web app for habit tracking with a REST API and a dashboard for progress visualization.

Scope Architecture + Full-stack
Stack FastAPI · Next.js · PostgreSQL
Code Public (GitHub)
KPI −40% read cost
01

TL;DR — 1 minute

Problem

Tracking habits and progress often turns into a spreadsheet or loose notes, with little insight and low consistency.

Solution

Backend in FastAPI + JWT and a Next.js frontend with logging flows and habit charts.

Result

A functional MVP with Docker Compose, OpenAPI, and tests, plus optimized reads on large time windows.

Public code available on GitHub. Repository with README, OpenAPI, and evidence of the main flow.
02

Snapshot

Role
Architecture + Full-stack. API, authentication, persistence, and web dashboard.
Scale
Multiple habits per user, daily records, and enough history for charts and trends.
Constraints
Consistent dates and values, secure authentication, and schema evolution with migrations.
03

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.
04

Approach

1
Model

Structure habits, records, and analytic summaries in Postgres with clear persistence contracts and migration paths.

2
Expose

Provide a REST API with FastAPI, JWT authentication, and Swagger/OpenAPI docs to reduce integration friction.

3
Visualize

Deliver a Next.js web dashboard with fast logging, per-habit charts, and efficient reads for larger time windows.

05

Reliability

Risks

Inconsistent data, authentication regressions, and divergence between summaries and time series.

Guarantees

Pydantic validation, Alembic migrations, and unit + E2E tests on the critical flow.

Evidence

A summary strategy snippet with versioned cache and fallback between direct and pre-aggregated reads.

Python · FastAPI
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
FastAPINext.jsPostgreSQLJWTAlembicPlaywright
06

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.
Do you have this problem?

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.