A comprehensive C# console application to help you build and maintain daily habits. Track streaks, view progress history, receive daily email reminders, and sync your habits with Google Calendar for seamless integration across all your devices.
- โ Add and delete daily habits
- ๐ View current streaks and habit history
- โ Mark habits as completed
- โฐ Schedule daily email reminders
- ๐ Google Calendar integration - Sync habits as all-day events
- ๐พ Data persistence using local file storage
- ๐จ Dark Mode support (See: THEME_SERVICE.md)
- ๐ Multi-language support with runtime language switching
- .NET 6+ SDK
- A Gmail account with App Passwords enabled (for email reminders)
- Google account for Calendar integration (optional)
- Clone this repository
git clone https://github.com/Leorev01/Habits_Builder.git
cd habit-tracker-app- Restore dependencies
dotnet restore- Build the application
dotnet build- Create a .envfile in the project root:
GOOGLE_APP_EMAIL=[email protected]
GOOGLE_APP_PASSWORD=your-app-password- Enable App Passwords in your Gmail account:
- Go to Google Account Settings
- Security โ 2-Step Verification โ App passwords
- Generate a new app password for "Habit Tracker"
 
- Create a mock credentials.json file in your project root:
{
  "installed": {
    "client_id": "YOUR_CLIENT_ID_HERE.apps.googleusercontent.com",
    "project_id": "your-project-id",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_secret": "YOUR_CLIENT_SECRET_HERE",
    "redirect_uris": ["http://localhost"]
  }
}- Replace with your actual credentials (see detailed setup below)
- 
Go to Google Cloud Console - Visit Google Cloud Console
- Sign in with your Google account
 
- 
Create a new project - Click "New Project"
- Name it "Habit Tracker"
- Click "Create"
 
- 
Enable Google Calendar API - Go to APIs & Services โ Library
- Search for "Google Calendar API"
- Click "Enable"
 
- 
Create OAuth 2.0 credentials - Go to APIs & Services โ Credentials
- Click "Create Credentials" โ "OAuth client ID"
- Configure OAuth consent screen (External user type)
- Fill required fields:
- App name: "Habit Tracker"
- User support email: your email
- Add your email to test users
 
- Choose "Desktop application" as application type
- Name it "Habit Tracker Desktop"
- Click "Create"
 
- 
Download and replace credentials - Click the download button (โฌ๏ธ) next to your OAuth client
- Replace the mock credentials.jsonfile with the downloaded file
- OR copy the values from the downloaded file to your mock file:
- client_id: Replace- YOUR_CLIENT_ID_HERE
- client_secret: Replace- YOUR_CLIENT_SECRET_HERE
- project_id: Replace- your-project-id
 
 
- 
First-time authentication - When you first use the calendar sync feature, a browser window will open
- Sign in to your Google account
- Grant permission to access your calendar
- The app will save your authentication tokens for future use
 
dotnet run- Add Habit - Create a new daily habit
- View Habits - See all habits with current streaks
- Mark Complete - Mark a habit as completed for today
- View History - See completion history for a specific habit
- Delete Habit - Remove a habit permanently
- Set Email Reminders - Schedule daily email notifications
- Change Language - Switch between supported languages
- Toggle Theme - Switch between light and dark mode
- Sync to Google Calendar - Create calendar events for your habits
- Exit - Save data and quit
- Sync Today: Press Enter when prompted for date
- Sync Specific Date: Enter date in format yyyy-mm-dd(e.g.,2025-01-07)
- All-Day Events: Habits appear as all-day events in your Google Calendar
- Smart Reminders: Automatic popup and email reminders
- Duplicate Prevention: Won't create duplicate events for the same habit/date
- Color Coding: Habit events appear in green for easy identification
- Your credentials.jsonfile contains sensitive information
- Never share this file publicly
- The file is automatically excluded from version control via .gitignore
- Authentication tokens are stored locally in token.json
HabitTrackerApp/
โโโ Classes/
โ   โโโ Habit.cs                    # Core habit model
โ   โโโ Storage.cs                  # Data persistence
โ   โโโ ReminderService.cs          # Email reminders
โ   โโโ Services/
โ       โโโ GoogleCalendarService.cs # Calendar integration
โ       โโโ LocalizationService.cs  # Multi-language support
โ       โโโ LanguageService.cs      # Language management
โ       โโโ ThemeService.cs         # Theme switching
โโโ Resources/                      # JSON Localization files
โ   โโโ en.json                    # English (default)
โ   โโโ it.json                    # Italian
โ   โโโ uk.json                    # Ukranian
โ   โโโ fr.json                    # French
|   โโโ ru.json                    # Russian
โโโ credentials.json               # Google API credentials (not in repo)
โโโ .env                          # Email configuration (not in repo)
โโโ habits.json                   # Habit data storage
โโโ token.json                    # Google auth tokens (auto-generated)
โโโ Program.cs                    # Main application entry point
This project supports multiple languages with dynamic runtime switching:
- ๐บ๐ธ English (default)
- ๐ฎ๐น Italian
- ๐ซ๐ท French
- ๐บ๐ฆ Ukrainian
- ๐ท๐บ Russian
๐ To add a new language, see Adding a new language guide.
- Light Mode: โ๏ธ Default bright theme
- Dark Mode: ๐ Easy on the eyes for low-light usage
- Dynamic Switching: Toggle themes at runtime
- Persistent Settings: Your theme preference is saved
See THEME_SERVICE.md for more details.
Please read our contribution guidelines to learn how to propose changes and report issues.
Calendar sync fails with "Invalid time zone"
- Ensure you're using the latest version of the app
- Check your internet connection
Email reminders not working
- Verify your .envfile has correct Gmail credentials
- Ensure App Passwords are enabled in Gmail
"OAuth client was not found" error
- Download fresh credentials.jsonfrom Google Cloud Console
- Ensure Google Calendar API is enabled in your project
- Make sure you replaced the mock values with your actual credentials
"Access denied" error
- Add your email as a test user in OAuth consent screen
- Or publish your app (not recommended for personal use)
Mock credentials.json not working
- Replace YOUR_CLIENT_ID_HEREandYOUR_CLIENT_SECRET_HEREwith actual values
- Ensure the project ID matches your Google Cloud project
If you encounter issues:
- Check the troubleshooting section above
- Review the Issues page
- Create a new issue with detailed error information
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Calendar API for seamless calendar integration
- .NET Community for excellent documentation and support
- Contributors who helped improve this application
Happy habit building! ๐ฏ