Skip to content

About

πŸ” Habit tracker, reflection journal & AI analyst β€” a Flutter Web Telegram Mini App. Bilingual (RU/EN), free, bring-your-own OpenRouter key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

HabitFlow β€” Mini App

Habit tracker Β· reflection journal Β· analytics Β· AI chat β€” a Flutter Web Telegram Mini App.

Flutter Dart Riverpod License: MIT

Try it in Telegram

English Β· Русский

πŸ€– Live bot β†’ @habit_flow_app_bot

Flutter Web Mini App that runs inside Telegram. It authenticates with initData, talks to Supabase over PostgREST, and renders the full HabitFlow experience β€” Today, Habits, Journal, Analytics, AI, and Profile. Also ships an Android build (login via bot deep-link) from the same codebase. The companion notification bot lives in habit_flow_bot.

πŸ“Έ Screenshots coming soon.


✨ What's inside

  • Today β€” only habits due now, one-tap done/skip, all-done celebration
  • Habits β€” CRUD with emoji / Telegram-photo icons, colors, schedules, swipe-to-archive/delete
  • Habit detail β€” calendar heatmap, history, streaks & recovery, anti-habit "days since"
  • Journal β€” reflection entries with optional templates
  • Analytics β€” completion rate, trends, activity heatmap (fl_chart + table_calendar)
  • AI β€” chat, periodic summaries, and ready-made prompt buttons (OpenRouter, bring your own key)
  • Profile β€” settings, AI key, donations (Telegram Stars), about/contact
  • Bilingual RU + EN, Material 3 theme overridden from Telegram.WebApp.themeParams

πŸš€ Getting started

flutter pub get

flutter run -d chrome --web-port=5173 \
  --dart-define=SUPABASE_URL=https://xxx.supabase.co \
  --dart-define=SUPABASE_ANON_KEY=xxx

Release web build:

flutter build web --release \
  --dart-define=SUPABASE_URL=https://xxx.supabase.co \
  --dart-define=SUPABASE_ANON_KEY=xxx \
  --dart-define=ENV=production

Common dev commands:

flutter analyze
flutter test
dart run build_runner build --delete-conflicting-outputs   # freezed / json / riverpod
flutter gen-l10n                                            # after editing .arb files

βš™οΈ Environment (--dart-define)

Env.assertValid() runs in main.dart before runApp and fails fast with a clear StateError if a required value is missing.

Key Required Default Purpose
SUPABASE_URL βœ… β€” Supabase project URL
SUPABASE_ANON_KEY βœ… β€” Supabase public anon key
OPENROUTER_BASE_URL β€” https://openrouter.ai/api/v1 OpenRouter base URL
OPENROUTER_DEFAULT_MODEL β€” openai/gpt-oss-120b:free default AI model
ENV β€” development production enables strict modes (Env.isProduction)
APP_BASE_URL β€” https://habitflow.app canonical Mini App URL (HTTP-Referer)
BOT_PUBLIC_CHANNEL β€” https://t.me/habitflow_dev public Telegram channel/chat
OPENROUTER_KEYS_URL β€” https://openrouter.ai/keys OpenRouter keys dashboard

πŸ”’ The OpenRouter API key is the user's own, stored in flutter_secure_storage (WebCrypto on Web). BOT_TOKEN and SUPABASE_SERVICE_ROLE_KEY never live here.


πŸ— Architecture

Feature-first. Each feature owns data/ (models + repository), domain/ (pure functions), and presentation/ (screens + widgets).

lib/
β”œβ”€β”€ main.dart, app.dart
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ config/        # env, theme
β”‚   β”œβ”€β”€ routing/       # go_router
β”‚   β”œβ”€β”€ services/      # supabase, telegram, openrouter, notifications
β”‚   β”œβ”€β”€ localization/  # .arb + generated
β”‚   └── utils/
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ auth/          # splash + initData β†’ JWT
β”‚   β”œβ”€β”€ habits/        # CRUD, Today, Habits
β”‚   β”œβ”€β”€ journal/       # reflection journal
β”‚   β”œβ”€β”€ analytics/     # Analytics tab
β”‚   β”œβ”€β”€ ai/            # chat, summaries, prompts
β”‚   β”œβ”€β”€ profile/       # settings, donations
β”‚   └── onboarding/
└── shared/widgets/

πŸ“ Conventions

  • State β€” Riverpod, preferably @riverpod codegen.
  • Models β€” freezed + json_serializable.
  • Routing β€” go_router. Deep links ?screen=...&id=... are required for the bot.
  • Theme β€” Material 3, overridden by Telegram.WebApp.themeParams via TelegramService.
  • Localization β€” AppLocalizations.of(context)!.<key>. No hard-coded UI strings.
  • Telegram Mini App limits β€” no background API; habit timers are frontend, resumed from last_active_at.
  • Comments β€” only "why", never "what the code does".
  • Design β€” mockups arrive separately and are copied 1:1, never interpreted.

πŸ” Security

  • BOT_TOKEN, SUPABASE_SERVICE_ROLE_KEY β€” never on the client.
  • initData is logged masked only.
  • Authorization is server-side initData validation. tg.initDataUnsafe is for UI params (name, avatar) only β€” never for auth.

πŸ“š More docs


πŸ“„ License

MIT Β© 2026 zFannur.

About

πŸ” Habit tracker, reflection journal & AI analyst β€” a Flutter Web Telegram Mini App. Bilingual (RU/EN), free, bring-your-own OpenRouter key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages