Skip to content

Habit Tracker Generator - Productivity Tool

Habit Tracker Generator

A practical productivity tool for building better habits - This Rust application generates printable habit tracking sheets with flexible layouts, custom time periods, and multiple output formats.

Overview

The Habit Tracker Generator creates printable worksheets to help users:

  • Track daily habits with visual progress indicators
  • Build consistency through structured tracking
  • Analyze patterns in habit formation
  • Stay motivated with visual progress representation

Key Features

Flexible Time Periods

Generate trackers for any month or multi-month spans

Custom Habits

Add any number of personal habits and goals

Printable Format

Optimized for printing with clear, readable layouts

Multiple Outputs

Text and PDF formats for different use cases

Quick Start

Basic Usage

Terminal window
# Generate tracker for current month + next 2 months
cargo run

Custom Start Month

Terminal window
# Start from April 2025
cargo run 2025-04

Custom Habits

Terminal window
# Specify your own habits
cargo run 2025-04 "Running" "Reading" "Coding" "Meditation" "Hydration" "Vitamins"

Output Formats

Text Format (Default)

Generates a clean, printable text layout:

HABIT TRACKER - April 2025
Running □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □
Reading □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □
Coding □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □
Meditation □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □ □

PDF Format (Planned)

Future enhancement will include PDF generation with:

  • Professional formatting
  • Better typography
  • Print optimization
  • Custom branding options

Technical Implementation

Dependencies

[dependencies]
chrono = "0.4" # Date/time handling
clap = { version = "4.0", features = ["derive"] } # CLI parsing
anyhow = "1.0" # Error handling

Core Logic

Date Calculation

use chrono::{Datelike, NaiveDate, Utc};
fn generate_months(start_date: NaiveDate, months: usize) -> Vec<MonthData> {
(0..months)
.map(|offset| {
let date = start_date + chrono::Months::new(offset as u32);
MonthData {
year: date.year(),
month: date.month(),
days_in_month: days_in_month(date.year(), date.month()),
}
})
.collect()
}

Layout Generation

fn create_tracker(habits: &[String], months: &[MonthData]) -> String {
let mut output = String::new();
for month in months {
writeln!(output, "HABIT TRACKER - {} {}", month.month_name(), month.year)?;
for habit in habits {
write!(output, "{:<12}", habit)?;
for _ in 0..month.days_in_month {
write!(output, "")?;
}
writeln!(output)?;
}
writeln!(output)?;
}
Ok(output)
}

Project Architecture

Command-Line Interface

#[derive(Parser)]
#[command(name = "habit-tracker")]
#[command(about = "Generate printable habit tracking sheets")]
struct Args {
/// Starting month in YYYY-MM format (defaults to current month)
start_month: Option<String>,
/// Number of months to generate (default: 3)
#[arg(short, long, default_value = "3")]
months: usize,
/// List of habits to track
habits: Vec<String>,
}

Data Structures

#[derive(Debug)]
struct MonthData {
year: i32,
month: u32,
days_in_month: u32,
}
#[derive(Debug)]
struct HabitTracker {
habits: Vec<String>,
months: Vec<MonthData>,
output_format: OutputFormat,
}

Development Features

CI/CD Pipeline

The project includes comprehensive CI/CD with Woodpecker:

  • Automated Testing: Runs on every push
  • Multi-Platform: Tests across different Rust versions
  • Documentation: Auto-generates docs with mdBook
  • Release Management: Automated changelog generation

Development Tools

  • git-cliff: Automated changelog generation
  • mdBook: Documentation generation
  • Woodpecker CI: Continuous integration
  • Codeberg Pages: Automated deployment

Usage Examples

Monthly Planning

Terminal window
# Plan for Q2 2025
cargo run 2025-04 --months 3 \
"Exercise" "Read 30min" "Write Code" "Meditate" \
"Drink Water" "Take Vitamins" "Learn New Skill"

Weekly Habits

Terminal window
# Focus on weekly goals
cargo run 2025-04 --months 1 \
"Monday Workout" "Tuesday Learning" "Wednesday Writing" \
"Thursday Project" "Friday Review" "Weekend Planning"

Custom Time Periods

Terminal window
# 6-month habit building
cargo run 2025-01 --months 6 \
"Wake Early" "Healthy Breakfast" "No Phone 1hr" \
"Evening Walk" "Gratitude Journal" "Sleep by 10pm"

Habit Tracking Best Practices

Getting Started

  1. Start Small: Begin with 3-5 habits maximum
  2. Be Specific: Use clear, actionable habit descriptions
  3. Track Consistently: Mark habits at the same time each day
  4. Review Weekly: Assess progress and adjust as needed

Effective Habits

  • Positive Framing: Focus on what to do, not what to avoid
  • Measurable: Make habits quantifiable when possible
  • Achievable: Set realistic expectations
  • Relevant: Choose habits that matter to you

Progress Tracking

  • Visual Feedback: Use the checkbox system for satisfaction
  • Streak Building: Track consecutive days for motivation
  • Pattern Recognition: Look for trends in your data
  • Celebration: Reward milestones and consistency

Future Enhancements

Planned Features

  • PDF Export: Professional printable format
  • Data Import/Export: Save and load habit configurations
  • Progress Analytics: Statistics and trend analysis
  • Mobile Companion: Web interface for on-the-go tracking
  • Habit Templates: Pre-built habit collections
  • Reminder System: Notification integration

Technical Improvements

  • Web Assembly: Browser-based generation
  • Database Storage: Persistent habit data
  • API Endpoints: Integration with other tools
  • Internationalization: Multi-language support

Contributing

The project welcomes contributions in:

  • New Output Formats: PDF, HTML, CSV support
  • Habit Templates: Curated habit collections
  • UI/UX Improvements: Better CLI experience
  • Documentation: Usage examples and tutorials
  • Testing: Additional test coverage

View on Codeberg | Live Demo | Usage Guide