Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 36 ยท Projects and Practice

Project: A Habit Tracker

Build a habit tracker in Notion step by step with a Habits and a Daily log database, a button to check in, streak and weekly percentage formulas, and views.

In this project you build a small but complete system: a habit tracker that records each day's check-ins, shows your current streak, and tells you how consistent you were this week. It uses everything from this track: databases, relations, buttons, templates, formulas and views.

Notion cannot run on this site, so the steps describe the real app. After each step, a labelled JavaScript stand-in lets you test the logic you will paste into Notion's formulas. Formula syntax changes between versions, so treat the Notion snippets as guides and use the formula editor's autocomplete.

Plan the data

Two databases keep things simple:

  1. Habits: one row per habit ("Read 20 minutes", "Walk 8,000 steps").
  2. Check-ins: one row per habit per day, related to a habit.

Why not a single table with a checkbox column per day? It works for a week, then you have 365 columns. Rows scale; columns do not.

Step 1: the Habits database

Properties:

Property Type
Name Title
Goal per week Number (for example 5)
Active Checkbox
Check-ins Relation to Check-ins (created automatically with the other side)

Step 2: the Check-ins database

Property Type
Name Title (can be a formula combining habit and date)
Habit Relation to Habits
Date Date
Done Checkbox

Add a template for Check-ins that sets Date to today and Done to checked, so a new entry is one click.

Step 3: a check-in button

On your Home page, add a button block called "Check in" with the action Add page to Check-ins, setting Date to the current date and Done to checked. You choose the Habit from a property when you press it, or create one button per habit with the Habit prefilled. A database button on the Habits table that adds a check-in for that row works equally well.

Step 4: this-week count and streak

On the Habits database add a rollup over Check-ins to count check-ins with Done checked in the last 7 days (the rollup filter is available in newer versions; otherwise add the filter in a linked view). The weekly percentage is that count divided by Goal per week, capped at 100%.

For the streak, Notion's formulas are not ideal at counting consecutive days across related rows. A practical approach: keep a Last check-in rollup (Latest date) and a Streak number that a button or automation increments, resetting to 0 if the last check-in was more than one day ago. Treat streaks as a view-time calculation if you can use the API (see the API chapter); the stand-in below shows the exact logic.

Stand-in: streak and weekly rate

This JavaScript is not a Notion formula, but it implements the same rules, which you can then express with Notion's formula editor or an API script.

JS Stand-in: streak calculator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The "today not done yet" rule stops a streak from showing 0 first thing in the morning.

JS Stand-in: weekly consistency

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The older October entry is correctly ignored: it is outside the 7-day window.

Step 5: views

  • Today: Check-ins grouped by Habit, Date is today. A Board view makes checking items quick.
  • Habits: a Table of active habits showing the weekly count and streak, sorted by streak.
  • Calendar: a Calendar view of Check-ins by Date shows gaps at a glance.
  • Progress: a Gallery or Table with a progress bar (number property displayed as a bar) for the weekly percentage.

Step 6: polish

  • Add icons to habits for fast scanning.
  • Put a linked view of Today and the Habits table on your Home page.
  • Use a daily reminder (@Today with a reminder, or an automation that notifies you at 8 pm if no check-in was recorded).
  • Do a monthly review: archive habits you stopped, and adjust goals.

Extension ideas

  • Why journal: add a Notes text property to Check-ins.
  • Rewards: a rollup that sums check-ins for a monthly total.
  • API: a script that calculates streaks and writes them to a Number property nightly.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. Why use a Check-ins database instead of one checkbox column per day?

    One row per check-in grows naturally and works with relations, views and rollups.
  2. 2. In the streak logic, why start from yesterday when today is not checked yet?

    The day is not over, so the streak should still reflect earlier days.
  3. 3. Which view shows gaps in your check-ins at a glance?

    A calendar highlights days with and without entries.

Summary

  • Two databases (Habits and Check-ins) with a relation scale better than a wide table.
  • A button or template makes checking in a single click.
  • Streak and weekly rate are date arithmetic; rollups, formulas or an API script can compute them.
  • Views for Today, Calendar and Progress make the data useful.

Next: Project: A Simple CRM