CalmAI — AI-Powered Mental Health & Wellness Companion
CalmAI is a complete Flutter source code for a mental wellness app (Android + iOS + Web Admin Panel). It combines an AI therapy chatbot, mood tracking, guided journaling, CBT thought records, breathing exercises, a gratitude journal, a sleep tracker, a habit tracker, a guided meditation library with offline TTS playback, a worry box (CBT worry postponement), mood analytics, weekly AI-generated wellness reports, an always-on SOS grounding screen, and a 19-badge streaks & milestones system — all in a Living Sanctuary design (forest green palette, Newsreader + Manrope typography) with full dark mode support.
Includes a web-based admin panel with dashboard, user management, crisis conversation moderation, analytics, configuration editor, reports with CSV export, and audit log.
Built for developers who want to launch a mental health app quickly — everything is wired, tested, and ready to publish.
Try Before You Buy
Download Demo APK (Android):
Download CalmAI Demo APK from Google Drive
Note: Enable “Install from unknown sources” in your Android settings to run the demo.
️ Live Admin Panel Demo (Web):
https://calmai-fd671.web.app
Test Account: Email: admin@calmai.com / Password: 123456
✨ Key Features
- AI Therapy Chat — GPT-4o or Gemini-powered chatbot with CBT-based responses, conversation history, and conversation starters
- Mood Logging — 8 mood types, 1–5 intensity slider, trigger tags, and instant AI mood acknowledgment
- Guided Journal — Free write, AI-prompted, and CBT thought record (6-step) with AI review
- 5 Breathing Exercises — Box breathing, 4-7-8, deep calm, energize, sleep wind-down — fully animated, 100% offline
- Gratitude Journal — Daily 3-item entry, streak tracking, and a scrollable gratitude jar
- Sleep Tracker — Bedtime / wake-time pickers, 5-emoji quality scale, optional note, live duration ring, weekly bar chart, 30-night history, consecutive-night streak chip
- Habit Tracker — 6 seeded default habits + custom habits with emoji picker, tap-to-complete daily cards, weekly completion-rate card, 30-day per-habit heatmap, archive control
- Guided Meditation Library — 8 bundled scripts across 8 categories (anxiety, sleep, focus, self-compassion, morning, stress, grief, confidence), category filter chips, TTS player with real silence on
[pause Xs] markers, session logging. Free tier sees 3, premium unlocks all. - Worry Box — CBT worry postponement: capture worries any time (offline-first), set a daily Worry Time reminder, then review each pending worry and resolve it as faded / resolved / still on my mind. Weekly stats card shows how many worries faded on their own; still-relevant worries can be sent to a prefilled CBT record or discussed in chat. Optional premium AI reflection on your review session.
- Voice Input & Text-to-Speech — Speak to CalmAI instead of typing; toggle voice mode to have AI responses read aloud
- Mood Analytics — Day streak counter, color-coded pattern insights, top mood triggers chart, and wellness score (fl_chart)
- White-Label Branding — Set app name, support email, privacy policy URL, and terms URL from the admin panel — no code changes needed
- Weekly AI Wellness Report — Personalized summary of wins, insights, and next-week intention (premium)
- Morning Affirmation — Personalized AI affirmation on the home dashboard
- Crisis Safety System — Client-side keyword detection, offline crisis resources (US/UK/AU/CA/International), always-visible professional help link
- SOS Coping Cards — Persistent SOS button on every screen opens 10 evidence-based grounding techniques (5-4-3-2-1, Box Breathing, STOP, etc.) plus tap-to-dial regional crisis hotlines. 100% offline.
- Streaks & Milestone Badges — 19 unlockable badges across day-streak (3/7/14/30), first-time milestones (mood, journal, CBT, breathing, meditation, sleep, worry), volume milestones (moods, journals, gratitude, breathing, worries), the sleepStreak7 night-tracking badge, and firstWeeklyReport. Snackbar announces unlocks, badges shelf on the profile screen, full grid view at
/profile/badges. - Premium IAP — RevenueCat monthly + annual subscriptions, paywall screen
- AdMob Ads — Banner + interstitial, fully optional (disable via Remote Config)
- Dark Mode — Full dark theme with persisted user preference
- Firebase Auth — Email/password, Google Sign-In, Anonymous (guest mode)
- Push Notifications — Daily check-in reminders, streak alerts, weekly report
- GDPR-Ready — Full data export + one-tap account & data deletion
- Web Admin Panel — Dashboard with KPIs, user management (search, toggle premium, GDPR delete), crisis conversation moderation, mood analytics with charts, runtime configuration editor, weekly reports with CSV export, and immutable audit log
- Firebase Hosting — One-command deployment for the admin panel
- 193 Unit Tests — Crisis detection, badge enum (19 values), coping cards, mood patterns, validators, sleep quality, meditation category, meditation script parser, worry status, worry stats calculator, all enums
Tech Stack
- Flutter 3.41 / Dart 3.11 — Android + iOS + Web Admin
- State Management: Riverpod 2.x
- Navigation: GoRouter 14.x
- Backend: Firebase (Auth, Firestore, Remote Config, FCM)
- AI: OpenAI GPT-4o + Google Gemini 1.5 Pro (switchable via Remote Config)
- IAP: RevenueCat
- Ads: Google AdMob
- Data Models: Freezed + JSON serializable
- Charts: fl_chart 0.69
- Voice: speech_to_text 7.x + flutter_tts 4.x
What’s Included
- Full Flutter source code — 35 mobile screens + 11 admin screens, clean architecture
- Web admin panel with dashboard, user management, moderation, analytics, config, reports, audit log
- All 5 breathing exercise animations (offline, no API)
- 8 bundled guided meditation scripts (offline TTS, no API call to play)
- Offline crisis resource database (5 regions) + 10-card SOS grounding pool
- Complete Firebase Firestore security rules (12 user-scoped subcollections)
- Firebase Hosting config for admin panel deployment
- 193 unit tests
- Offline HTML documentation + Quick Start Guide
⚙️ Requirements
- Flutter 3.41.x (stable channel)
- Firebase project (free Spark plan works for development)
- OpenAI API key or Google Gemini API key
- RevenueCat account (free tier available)
- AdMob account (optional — leave empty to disable all ads)
Changelog
Version 1.5.0 — July 2026 (Worry Box Update)
- NEW: Worry Box — a CBT worry-postponement tool. Capture worries any time into an offline-first box (short text + optional 1–5 intensity), with the new worry drop into the pending list instantly. Reached from a new Home tool tile.
- NEW: Worry Time reminder — set a daily time (stored on the user profile, default 18:00) that schedules a local notification prompting you to open the box and review. Toggle also exposed in Settings alongside the daily mood reminder.
- NEW: Review flow — work through pending worries one-by-one and resolve each as “faded on its own”, “resolved”, or “still on my mind”. A weekly stats card surfaces the postponement insight (“N worries this week — M faded on their own”). Worries that still matter can be sent to a prefilled CBT thought record or discussed in AI chat.
- NEW: Optional premium AI reflection — after a review session, premium users get a warm 2–3 sentence AI observation on their worry patterns (capped by a timeout so it never hangs). Free users see the static stats plus an upsell.
- NEW: 2 new milestone badges —
firstWorry (“Worry Boxer”) and worries10 (“10 Worries Boxed”). BadgeType enum now has 19 values total. - NEW:
worries Firestore subcollection (worries/{uid}/entries/{worryId}), user-scoped and wiped by the existing GDPR delete (deleteAllUserData() now covers 12 subcollections). New worryTime field on the user profile. - NEW: AI service gains a
generateWorryReflection method (OpenAI + Gemini) with a dedicated prompt in therapy_prompts.dart. - SAFETY: worry capture is 100% offline and sends nothing to AI. Every worry text runs through the client-side crisis detector — at capture a crisis keyword surfaces the offline resource sheet + “Open SOS” (worry still saves), and the AI reflection is skipped entirely if any worry trips detection.
- NEW: Tests — worry_status (5) and worry_stats_calculator (5), plus the badge_type test bumped to assert 19 values. Total unit tests now 193 (was 183).
- NOTE: Home dashboard tool grid grew from 9 → 10 tiles with the addition of Worry Box.
Version 1.4.0 — May 2026 (Sleep, Habits & Meditation Update)
- NEW: Sleep Tracker — log bedtime, wake time, quality (5 emojis), and an optional note. Live duration ring updates as you adjust pickers. Weekly bar chart of duration plus a 30-night history list. Consecutive-night streak chip on the log screen.
- NEW: Habit Tracker — 6 buyer-seeded default habits (hydration, exercise, going outside, no screens before bed, meditate, gratitude). Tap-to-complete daily cards, weekly completion-rate card, 30-day per-habit heatmap on the detail screen, archive control, and an add-custom-habit bottom sheet with a 14-emoji picker.
- NEW: Guided Meditation Library — 8 bundled scripts across 8 categories (Anxiety, Sleep, Focus, Self-Compassion, Morning, Stress, Grief, Confidence). First 3 are free; the rest are premium-gated (configurable via the new
free_meditations Remote Config key, default 3). Category filter chips on the library screen. - NEW: Meditation Player with offline TTS — narrates each script via
flutter_tts at a slowed, calm pace. [pause Xs] markers in the script insert real silence between text chunks. Play / pause / stop controls; finished sessions are logged. - NEW: 4 new milestone badges —
firstSleepLog, sleepStreak7 (7 consecutive nights of sleep logging), firstMeditation, meditations5 (5 completed meditations). BadgeType enum now has 17 values total. - NEW: Weekly AI Wellness Report v2 — the prompt now ingests sleep averages (hours + quality), weekly habit completion rate, and meditation session count. The response includes two new sections (Sleep + Habit Tip) shown on the report screen, in the PDF export, and in the share text. Nullable fields keep v1.3 reports rendering correctly.
- NEW:
free_meditations Remote Config key — Int, default 3. Controls how many meditations free-tier users can play before the paywall. - NEW: Four new Firestore subcollections (all user-scoped):
sleepLogs, habitDefinitions, habitCompletions, meditationSessions. All four are wiped by the existing GDPR delete (deleteAllUserData() now covers 10 subcollections). - NEW: Home dashboard tool grid grew from 6 → 9 tiles with the addition of Sleep, Habits, and Meditate. Tile layout: AI Chat, Journal, Breathe, Gratitude, Sleep, Habits, Meditate, Insights, Premium.
- NEW: Tests — sleep_quality (4), meditation_category (4), meditation_script_parser (6) — plus the badge_type test bumped to assert 17 values. Total unit tests now 183 (was 169).
- UPDATED: Habits screen avoids a screen-level FloatingActionButton (would overlap the persistent SOS FAB). “Add habit” lives as an AppBar action and an inline outlined button at the bottom of the daily list.
Version 1.3.0 — May 2026 (SOS & Engagement Update)
- NEW: SOS Coping Cards screen — persistent floating SOS button on every authenticated screen (hidden only on chat & SOS itself to avoid duplication). Opens a calming page with 3 randomly-shuffled grounding techniques from a pool of 10 (5-4-3-2-1, Box Breathing, Cold Water Reset, Safe Place Visualization, Name Your Emotion, Opposite Action, Body Check-In, Reach Out, STOP, One Breath/One Step). 100% offline — no API calls.
- NEW: Tap-to-dial crisis resources sheet — opens from the SOS screen, lists region-specific hotlines (US/UK/AU/CA/International), tapping a number launches the system dialer.
- NEW: Streaks & Milestone Badges — 13 unlockable badges. Day-streak counter now bumps on any tracked activity (mood, journal, CBT, breathing, gratitude) instead of mood-only. Awards
streak3, streak7, streak14, streak30, four first-time badges (firstMoodLog, firstJournal, firstCBT, firstBreathing), four volume badges (moods10, journals10, gratitude10, breathingSessions10), and firstWeeklyReport. - NEW: Badges shelf on Profile screen + full grid at
/profile/badges showing earned (in color with earned-date) vs locked (desaturated with lock icon). - NEW: Badge unlock snackbar — surfaces from any tab via a global Riverpod listener. Single unlock shows the badge title; multiple simultaneous unlocks show ” N badges unlocked”.
- NEW:
userBadges Firestore subcollection — added to GDPR delete flow. - UPDATED: Journal screen “New Entry” button moved from
FloatingActionButton to AppBar action so the persistent SOS FAB has a clear slot. - UPDATED: Streak math centralized in
BadgeService — inline streak update logic removed from MoodLogNotifier.
Version 1.2.0 — April 2026 (Voice, Insights & White-Label Update)
- NEW: Voice input — tap the mic button in chat to speak your message; speech is transcribed and auto-populated in the text field
- NEW: Text-to-speech — toggle voice mode in chat to have CalmAI’s responses read aloud
- NEW: Day streak counter on the Analytics screen, pulling from the user profile’s live streak data
- NEW: Top Mood Triggers section on Analytics — horizontal bar chart showing the user’s top 5 recurring triggers with frequency counts
- NEW: Color-coded insight cards — each insight type (positive, downward trend, trigger, pattern) has a distinct icon and accent color
- NEW: White-label branding panel in Admin Config — set app name, support email, privacy policy URL, and terms URL at runtime from Firestore, no redeployment needed
- UPDATED: Admin Config screen pre-loads existing values from Firestore on open; all branding changes are audit-logged
Version 1.1.0 — April 2026 (Admin Panel Update)
- NEW: Web admin panel — dashboard with KPIs, user management, crisis conversation moderation, mood analytics, configuration editor, weekly reports with CSV export, immutable audit log
- NEW: Admin authentication with role-based access (superAdmin, admin, viewer)
- NEW: Audit trail — all admin actions logged with timestamp, admin identity, and details
- NEW: CSV export for reports, audit logs, and per-user mood logs/journal entries
- NEW: Crisis keyword and resource management via admin panel
- NEW: Firebase Hosting deployment for admin panel
- NEW: 160+ unit tests
- UPDATED: Design system — Living Sanctuary theme (forest green, Newsreader + Manrope typography)
- UPDATED: Flutter 3.41 / Dart 3.11
Version 1.0.0 — March 2026 (Initial Release)
- AI Therapy Chat with GPT-4o and Google Gemini 1.5 Pro (switchable via Remote Config)
- Mood logging — 8 mood types, intensity slider, trigger tags, AI acknowledgment
- Guided journal — free write, AI-prompted, and CBT thought record with AI review
- 5 guided breathing exercises — Box Breathing, 4-7-8, Deep Calm, Energize, Sleep Wind-Down
- Gratitude journal — daily entry, streak tracking, gratitude jar
- Mood analytics — trend charts, pattern insights, weekly wellness score
- Weekly AI wellness report — personalized summary, wins, insights (premium)
- Morning affirmation — personalized AI affirmation on home dashboard
- Firebase Auth — email/password, Google Sign-In, anonymous guest mode
- RevenueCat IAP — monthly and annual premium subscriptions, paywall screen
- AdMob — banner and interstitial ads (fully optional via Remote Config)
- Push notifications — daily reminders, streak alerts, weekly report notification
- Dark mode — full dark theme with persisted preference
- Crisis safety system — offline keyword detection, 5-region crisis resource database
- GDPR-ready — full data export and one-tap account deletion
Support
We’re here to help you get the app running and published.
Typical response time: within 24 hours on business days. Please include your CodeCanyon purchase code when reaching out.