CodingIdeas.ai
← Browse All Ideas

Build Guide

How to Build a Habit Tracker

Habit trackers have a 90-day retention cliff — the apps that survive it all have streak recovery, not just streak tracking.

Beginner2–4 days

Habit trackers cover daily check-ins, streak logic, push reminders, and progress charts — everything you need to ship a real consumer app.

Data model

The core tables you'll need before writing any UI.

Userid, email, timezone, notification_time
Habitid, user_id, name, icon, color, frequency (daily/weekdays/custom), target_per_day, created_at
HabitLogid, habit_id, date (YYYY-MM-DD), value (1 for bool, n for quantity), created_at

Build order

The sequence that minimises rewrites — build in this order.

1

Habit list and daily check-in

Show a list of habits for today. Each has a checkbox. On check, write a HabitLog for today's date. If unchecked, delete today's log. Keep it simple — no streaks yet.

2

Streak calculation

Write a function that takes an array of log dates and returns the current streak. Walk backwards from today: if yesterday has a log, increment streak. Stop at the first missing day.

3

Streak recovery (grace period)

Add a grace_period field to habits (default: 1 day). If the user missed one day but the habit has a grace period, don't break the streak — show a "recover streak" button that logs yesterday.

4

Progress charts

Build a 7-day heatmap row showing which days had a check-in. Add a monthly calendar view where completed days are highlighted. Use a simple CSS grid — no chart library needed for this.

5

Habit templates

Seed 8–10 common habits (drink water, read, exercise, meditate) with icons and suggested targets. Show these as one-click templates on the add-habit screen.

6

Daily reminder notifications

On web, use the Web Notifications API + a service worker to schedule a daily notification. On mobile (Expo), use expo-notifications with a daily trigger at the user's preferred time.

7

AI weekly summary

Every Monday, generate a summary: fetch last week's logs, calculate hit rate per habit, send to Claude Haiku, get back a 2-sentence coaching comment per habit. Email or show in-app.

Build it with AI — Architect Prompt

Paste this into Claude, Cursor, Windsurf, or any AI coding tool. It includes the full context of this guide — data model, build order, and pitfalls — so the AI starts with everything it needs.

ClaudeCursorWindsurfCopilotGemini
architect-prompt.txt
<context>
App: Habit Tracker
Difficulty: Beginner
Estimated build time: 2–4 days

Data model:
  User: id, email, timezone, notification_time
  Habit: id, user_id, name, icon, color, frequency (daily/weekdays/custom), target_per_day, created_at
  HabitLog: id, habit_id, date (YYYY-MM-DD), value (1 for bool, n for quantity), created_at

Recommended build order:
  1. Habit list and daily check-in — Show a list of habits for today. Each has a checkbox. On check, write a HabitLog for today's date. If unchecked, delete today's log. Keep it simple — no streaks yet.
  2. Streak calculation — Write a function that takes an array of log dates and returns the current streak. Walk backwards from today: if yesterday has a log, increment streak. Stop at the first missing day.
  3. Streak recovery (grace period) — Add a grace_period field to habits (default: 1 day). If the user missed one day but the habit has a grace period, don't break the streak — show a "recover streak" button that logs yesterday.
  4. Progress charts — Build a 7-day heatmap row showing which days had a check-in. Add a monthly calendar view where completed days are highlighted. Use a simple CSS grid — no chart library needed for this.
  5. Habit templates — Seed 8–10 common habits (drink water, read, exercise, meditate) with icons and suggested targets. Show these as one-click templates on the add-habit screen.
  6. Daily reminder notifications — On web, use the Web Notifications API + a service worker to schedule a daily notification. On mobile (Expo), use expo-notifications with a daily trigger at the user's preferred time.
  7. AI weekly summary — Every Monday, generate a summary: fetch last week's logs, calculate hit rate per habit, send to Claude Haiku, get back a 2-sentence coaching comment per habit. Email or show in-app.

Known pitfalls to avoid:
  - Calculating streaks in local time without knowing the user's timezone — a check-in at 11pm in New York is the next day in UTC. Always store dates as YYYY-MM-DD strings in the user's timezone, not as UTC timestamps.
  - Breaking streaks on the first missed day — this is the #1 reason users abandon habit apps. Add a 1-day grace period and a "I forgot yesterday" recovery option before you punish missed days.
  - Storing one HabitLog per check action instead of one per day — if the user checks and unchecks, you'll have multiple logs per day. Use upsert on (habit_id, date) as a unique key.

Tech stack (intermediate): Next.js + Supabase + Clerk + React Native Web for cross-platform
</context>

<role>
You are a Senior Full-Stack Engineer and product architect who has shipped production Habit Trackers before. You know exactly where developers get stuck and how to structure the project to avoid rewrites.
</role>

<task id="step-1-clarify">
Before writing any code or spec, ask me 3–5 clarifying questions that will meaningfully change the architecture. Focus on: scale expectations, auth requirements, platform (web / mobile / both), must-have vs nice-to-have features for the MVP, and any hard constraints (budget, deadline, existing infrastructure).

<example>
BAD: "What tech stack do you want to use?" — too broad, doesn't change architecture decisions.
GOOD: "Do you need real-time sync across devices, or is single-device with periodic refresh acceptable? This decides whether we use WebSockets or simple REST polling and significantly affects infrastructure complexity."
</example>
</task>

<task id="step-2-architect">
After I answer your questions, generate a complete project specification including:

1. Final tech stack with version numbers
2. Full file and folder structure
3. Complete database schema — every table, column, type, index, and foreign key
4. All API routes with request/response shapes and auth requirements
5. Component tree with TypeScript props interfaces
6. Auth and authorisation flow (who can do what)
7. Step-by-step implementation plan in the exact build order from <context> above
8. All environment variables with descriptions

<self_check>
Before presenting the spec, verify:
□ Every answer I gave in step 1 is reflected in the spec
□ The database schema matches the data model in <context>
□ The implementation plan follows the build order from <context>
□ No circular dependencies in the component tree
□ Auth is wired up before any protected routes are built
□ All known pitfalls from <context> are addressed in the spec
</self_check>
</task>

<task id="step-2.5-agents-md">
Generate an AGENTS.md file at the project root. This file is read automatically by Claude Code, Cursor, Windsurf, Sourcegraph Cody, and all major AI coding tools at the start of every session.

Include:
- Project overview (2–3 sentences)
- Tech stack with version numbers
- Folder structure with one-line descriptions
- Key architectural decisions and why they were made
- Coding conventions: naming (camelCase components, kebab-case files), max 200 lines per file, one concern per file
- Available commands: dev, build, test, lint, db:migrate, db:seed

Note in the file: "Cursor users can symlink .cursorrules → AGENTS.md. Claude Code users can symlink CLAUDE.md → AGENTS.md."
</task>

<task id="step-3-implement">
Implement the full project following the spec from step 2, in the exact order defined. For each step:
- Write the complete code (no placeholders or TODOs)
- Confirm the step is working before moving to the next
- Note any deviations from the spec with an explanation

<constraints>
- Max 200 lines per file. WHY: every file must fit in one AI context window for easy review and editing.
- One concern per file. WHY: mixing auth logic into API routes makes it impossible to reuse — extract to lib/auth.ts.
- TypeScript strict mode, no `any` types. WHY: catches data shape mismatches at compile time, not in production at 2am.
- All database queries in server components or API routes only. WHY: keeps credentials server-side, prevents accidental client-side exposure.
- All environment variables documented in .env.example. WHY: the next developer (or your future self) should be able to set up the project in under 5 minutes.
- Comment every non-obvious decision. WHY: AI tools read your comments to understand intent — without them, the next edit will break the pattern you established.
</constraints>
</task>

How to use this prompt

  1. 1.Copy the prompt above
  2. 2.Open Claude, Cursor (Cmd+L), or Windsurf
  3. 3.Paste the prompt and send — the AI will ask 3–5 clarifying questions
  4. 4.Answer the questions, then it generates your full project spec
  5. 5.Continue in the same session to implement step by step

Common mistakes

What trips up most developers building this for the first time.

⚠️

Calculating streaks in local time without knowing the user's timezone — a check-in at 11pm in New York is the next day in UTC. Always store dates as YYYY-MM-DD strings in the user's timezone, not as UTC timestamps.

⚠️

Breaking streaks on the first missed day — this is the #1 reason users abandon habit apps. Add a 1-day grace period and a "I forgot yesterday" recovery option before you punish missed days.

⚠️

Storing one HabitLog per check action instead of one per day — if the user checks and unchecks, you'll have multiple logs per day. Use upsert on (habit_id, date) as a unique key.

Recommended tech stack

Pick the level that matches your experience.

Beginner

React + localStorage — solid MVP in a weekend

Intermediate

Next.js + Supabase + Clerk + React Native Web for cross-platform

Advanced

Expo (React Native) + Supabase + Claude API for AI coaching + push via Expo Notifications

Take it further — related ideas

Each comes with revenue math, a full build guide, and a prompt to paste into Claude or Cursor.

9 ideas in the archive

Ship in:
beginnerBusiness Automation

ContractPulse - Vendor Renewal and Health Monitor for Bootstrapped SaaS Teams

Small SaaS teams routinely lose money on zombie vendor contracts because no one owns the renewal calendar. ContractPulse ingests your vendor invoices and emails, surfaces upcoming renewals, flags price drift, and sends Slack alerts 30 days out. It's the CFO dashboard you couldn't afford to hire.

Time to ship2 weeks
DemandHigh
Revenue7/10
AI quality score6/10
View Details →
beginnerGig Economy

GigHive - Single-View Project and Payment Pulse for Freelancers With 5+ Simultaneous Clients

Freelancers juggling five clients across email, Notion, Slack, and their brain have no single place to see what is due, what is unpaid, and what client is about to ghost. GigHive is the focused project and payment pulse tracker built for exactly this chaos.

Time to ship2 weeks
DemandVery High
Revenue7/10
AI quality score6/10
View Details →
beginnerGig Economy

CoachSlot - Mobile Booking and Payments for Solo Fitness Coaches

Solo yoga teachers and PTs are running $5k/month businesses on WhatsApp and bank transfers like it's 2009. CoachSlot gives every solo fitness coach a personal booking link, Stripe card payments, and automatic cancellation fee enforcement — no more ghost clients.

Time to ship2 weeks
DemandVery High
Revenue8/10
AI quality score7/10
View Details →
intermediateAnalytics

PageWatch - Affordable Visual and Text Diff Monitor for Journalists and Archivists

The Wayback Machine is great for finding what a site looked like in 2018 — not so great for getting a Slack alert the moment a government agency quietly edits a policy page. PageWatch monitors your URL list daily, generates pixel-level visual diffs and text change extracts, and sends you a digest before your morning coffee.

Time to ship2 weeks
DemandHigh
Revenue7/10
AI quality score7/10
View Details →
intermediateDeveloper Tools

FaultCluster - Auto-Root-Cause Clustering for Service Failures

Your team spends every Monday morning in a Slack thread playing 'who broke what' with no answers. FaultCluster ingests your error logs, clusters them by root cause using embeddings, and delivers a daily digest so your on-call engineer stops being a full-time detective.

Time to ship2 weeks
DemandVery High
Revenue8/10
AI quality score7/10
View Details →
intermediateSales Automation

PipelineReplay - CRM Pipeline History Snapshots and Trending

Automatically snapshots your Salesforce or HubSpot pipeline daily, stores the history, and surfaces month-over-month trending in a 3-line dashboard. See what deals moved, stalled, or closed—without manual exports.

Time to ship2 weeks
DemandVery High
Revenue8/10
AI quality score7/10
View Details →
intermediateBusiness Automation

TimeStitch - Auto-Capture Billable Work from Calendar and Email

Slack bot that passively watches your calendar, email, and message activity to build a daily billable hours log with one-click confirmation. No manual time entry reconstruction from memory at 5pm.

Time to ship5 weeks
DemandVery High
Revenue8/10
AI quality score8/10
View Details →
intermediateHealth and Wellness

FormPerfect - AI Workout Form Coach via Phone Camera with Real-Time Corrections

Gym-goers hurt themselves doing squats and deadlifts with poor form. Expensive form coaches ($100/session) are out of reach. FormPerfect uses phone camera to analyze joint angles in real-time, detects form breakdowns, and corrects them mid-rep — like having a personal trainer in your pocket.

Time to ship4 weeks
DemandHigh
Revenue6/10
AI quality score8/10
View Details →
beginnerFinance

MicroBiz - All-in-One Finance and Operations Dashboard for Micro-SaaS Founders

Micro-SaaS founders log into 6 different tools daily: Stripe for payouts, Plaid for spending, email for refunds, analytics platform for metrics, AWS for costs, and a spreadsheet for projections. MicroBiz combines all of them into one obsidian-dark dashboard with a single metric that matters: 'Are we profitable this month?'

Time to ship2 weeks
DemandVery High
Revenue7/10
AI quality score7/10
View Details →