Skip to content

sushil930/HabitFlow-RustProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌿 Habit Flow

A calm, offline-first desktop habit tracker built with Rust and the Iced GUI framework.


πŸ“– Overview

Habit Flow is a minimal, distraction-free desktop application designed to help you build and maintain daily habits. It runs entirely offline β€” your data never leaves your machine. Built with Rust for performance and reliability, and powered by the Iced GUI framework for a smooth, native-feeling interface.


✨ Features

  • βœ… Today View β€” See and check off all your habits for the current day at a glance
  • πŸ“… Weekly View β€” Review your habit completion across the past week in a clean grid layout
  • πŸ“Š Statistics Dashboard β€” Track streaks, completion rates, and long-term progress per habit
  • πŸ—‚οΈ Categories β€” Organize habits into 11 categories: General, Health, Fitness, Mindfulness, Learning, Productivity, Work, Home, Social, Finance, and Creative
  • 🎨 Custom Icons β€” Each habit and category gets a Lucide icon for quick visual recognition
  • πŸ—„οΈ Archived Habits β€” Archive habits you've paused without losing their history
  • βš™οΈ Settings β€” Manage app preferences, data export, and import
  • πŸ’Ύ JSON Export / Import β€” Back up and restore all your habits and logs via a portable JSON file
  • πŸ”’ Fully Offline β€” All data stored locally using SQLite; no accounts, no cloud, no tracking
  • πŸͺŸ Clean Windows Build β€” Console window hidden in release builds for a polished desktop experience

πŸ› οΈ Tech Stack

Layer Technology
Language Rust (Edition 2021)
GUI Framework Iced v0.13
Database SQLite via rusqlite (bundled)
Icons Lucide Icons via lucide-icons
Serialization serde + serde_json
Date/Time chrono
ID Generation uuid v4
File Dialogs rfd (Rusty File Dialogs)
Platform Dirs dirs

πŸ“ Project Structure

Desktop-Application-RustProject/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs           # App entry point, state management, Iced update/view loop
β”‚   β”œβ”€β”€ models.rs         # Core data types: Habit, DailyLog, HabitCategory, HabitWithStats
β”‚   β”œβ”€β”€ db.rs             # All SQLite database operations (CRUD for habits and logs)
β”‚   β”œβ”€β”€ export.rs         # JSON export and import logic
β”‚   β”œβ”€β”€ theme.rs          # Custom Iced theme and styling definitions
β”‚   β”œβ”€β”€ icons.rs          # Icon helpers and mappings
β”‚   β”œβ”€β”€ lucide.rs         # Lucide icon integration with Iced
β”‚   β”œβ”€β”€ app_icon.rs       # Application window icon setup
β”‚   β”œβ”€β”€ repository.rs     # Repository module re-exports
β”‚   β”œβ”€β”€ views/
β”‚   β”‚   β”œβ”€β”€ mod.rs        # View module definitions
β”‚   β”‚   β”œβ”€β”€ today.rs      # Today's habit checklist view
β”‚   β”‚   β”œβ”€β”€ weekly.rs     # Weekly completion grid view
β”‚   β”‚   β”œβ”€β”€ stats.rs      # Per-habit statistics and streak view
β”‚   β”‚   β”œβ”€β”€ archived.rs   # Archived habits management view
β”‚   β”‚   β”œβ”€β”€ sidebar.rs    # Navigation sidebar
β”‚   β”‚   └── settings.rs   # Settings and data management view
β”‚   └── components/       # Reusable UI components
β”œβ”€β”€ assets/               # Static assets (app icon, SVGs)
β”œβ”€β”€ docs/                 # Additional documentation
β”œβ”€β”€ build.rs              # Build script (Windows icon embedding, etc.)
β”œβ”€β”€ Cargo.toml            # Project manifest and dependencies
└── Cargo.lock            # Locked dependency versions

πŸš€ Getting Started

Prerequisites

  • Rust (stable, edition 2021 or later)
  • Cargo (included with Rust)
  • On Linux: you may need system libraries for GUI rendering (e.g., libxkbcommon, libvulkan or libGL)

Clone the Repository

git clone https://github.com/sushil930/Desktop-Application-RustProject.git
cd Desktop-Application-RustProject

Run in Development Mode

cargo run

Build for Release

cargo build --release

The optimized binary will be located at target/release/habit-flow (or habit-flow.exe on Windows).

Note: The release build applies LTO, symbol stripping, and size optimization (opt-level = "s") for a lean final binary.


πŸ’‘ How It Works

Data Storage

Habit Flow uses an embedded SQLite database stored in your system's local app data directory (resolved via the dirs crate). No setup required β€” the database is created automatically on first launch.

Habit Categories

Each habit belongs to one of 11 categories, each with a dedicated Lucide icon:

Category Icon
General ✨ Sparkles
Health πŸ’“ Heart Pulse
Fitness πŸ‹οΈ Dumbbell
Mindfulness 🧠 Brain Circuit
Learning πŸ“– Book Open
Productivity πŸ“‹ Clipboard List
Work πŸ’Ό Briefcase
Home 🏠 Home
Social πŸ‘₯ Users
Finance πŸ‘› Wallet
Creative 🎨 Palette

Statistics Tracked Per Habit

  • πŸ”₯ Current Streak β€” consecutive days completed up to today
  • πŸ† Longest Streak β€” all-time best streak
  • βœ… Total Completions β€” total days the habit was completed
  • πŸ“† Total Logged Days β€” total days the habit has been tracked
  • πŸ“ˆ Last 30-Day Rate β€” completion percentage over the past 30 days

Export & Import

You can export all your habits and daily logs to a .json file from the Settings view. This file can be used to migrate data between machines or restore from a backup using the import option.


πŸ”§ Build Configuration

The Cargo.toml release profile is tuned for a compact, fast binary:

[profile.release]
lto = true           # Link-Time Optimization for smaller binary
strip = true         # Strip debug symbols
opt-level = "s"      # Optimize for size
codegen-units = 1    # Single codegen unit for better optimization

On Windows, winapi is used to suppress the console window in release builds, giving the app a native desktop feel.


🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to open an issue or submit a pull request.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m 'feat: add your feature'
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request

πŸ“„ License

This project is open source. Please check the repository for license details.


πŸ‘€ Author

sushil β€” @sushil930


Built with πŸ¦€ Rust and a calm mindset.