Habit-tracking apps (Streaks, Productive, Habitify, Atomic Habits-inspired apps) are simple-looking but reveal interesting system design questions: streak calculation, time-zone sensitivity, smart reminders, and offline-first sync. The interview tests whether you understand the surprising depth of “just check off a box.”
Functional requirements
- Define habits with frequency (daily, weekly, custom)
- Mark complete with one tap
- Streak tracking
- Reminders at user-chosen times
- Visualization (calendar, charts)
- Sync across devices
The streak calculation
Surprisingly subtle:
- What counts as “today” — the user’s local time, not server UTC
- What if the user travels across time zones? Did Tuesday repeat?
- What if the user marks a habit complete at 2am? Is it for today or yesterday?
- What about Daylight Saving Time?
Standard solution: track completions as date-time-zone tuples. Compute streaks based on local “day” boundaries. Handle DST as a 23 or 25-hour day.
Custom frequencies
Habits beyond daily:
- Three times a week (no specific days)
- Mondays only
- Every other day
- Once a month
Streak math gets complex. Define “miss” precisely for each frequency type.
Reminders
Local notifications via UNUserNotificationCenter (iOS) or AlarmManager (Android). Constraints:
- iOS limits to 64 pending notifications
- Android allows more but exact alarms need permission
- Handle time-zone changes — re-schedule when device time zone changes
Smart reminders
Beyond “remind me at 8am”:
- Reminder fires only if not yet completed
- Reminder cancels if user opens the app and marks complete
- Snooze 15/30/60 minutes
- Adaptive: learn when the user typically completes
Offline-first sync
Common case: user marks complete on phone offline. Sync later. Strategies:
- Local SQLite as source of truth
- Operations log (mark complete, undo, edit) synced to server
- Server merges via last-write-wins per (habit, date) pair
- Conflict resolution: client tracks timestamps with HLC for clock-skew tolerance
Multi-device sync
If the user has phone + tablet, both should reflect the same data:
- Server is source of truth for cross-device state
- Push notifications signal “data changed; refresh”
- Pull on app foreground
Apple Watch / Wear OS companion
Glanceable habits, one-tap completion. Sync via WatchConnectivity or Wearable Data Layer.
Gamification
Common features:
- Streak counters
- “Don’t break the chain” calendar visualization
- Achievements / badges
- Stats: longest streak, completion rate, total completions
Be careful — gamification can backfire (users obsess over streaks at expense of habit’s real benefit).
Battery and data
Minimal. Habit apps are check-and-leave; no always-on processing. Data: tiny.
Frequently Asked Questions
How do I handle a user who legitimately could not do a habit (sick, traveling)?
Many apps offer “skip days.” The streak is preserved. Without this, perfectionism kills habits.
What if the user wants to track “did not do this” (e.g., quitting smoking)?
Same data model, opposite framing. Some apps support both kinds explicitly.
How accurate are streaks across time zones?
Most apps store date-tagged completions. Streak math is local-time dependent. Edge cases (international travel during a Tuesday) confuse most apps; well-engineered ones use UTC + zone snapshots.