Inspiration

We live in a generation that glorifies the grind and normalises the 2 AM screen scroll. Gen Z is consistently ranked as the most sleep-deprived demographic on the planet — not because we don't want to sleep, but because everything in our environment is engineered to keep us awake. Social media feeds, notification pings, blue-light screens, and the anxiety of just... existing in 2025.

The inspiration for Zzen came from a simple, personal frustration: every sleep app out there felt like it was built for a 40-year-old wellness blogger. Complicated, preachy, and completely disconnected from how young people actually live. We wanted to build something that meets Gen Z where they are — late nights, doom scrolling and all — and gently nudges them toward better sleep without judgment.

The name Zzen is a blend of Gen Z and Zen — the generation that needs rest, finally finding calm.

This also directly aligns with UN SDG 3: Good Health and Well-being, because sleep isn't a luxury — it's the foundation of every other health metric. Poor sleep is linked to increased anxiety, reduced academic performance, weakened immunity, and long-term cardiovascular risk. Fixing sleep for young people is one of the highest-leverage health interventions possible.


What it does

Zzen is an AI-powered sleep improvement app built specifically for Gen Z. Here's what it does:

  • 🌙 AI Sleep Coach — A Gemini-powered conversational coach that analyses your sleep patterns, understands your lifestyle, and gives you personalised advice — not generic tips from a listicle.
  • 🎵 Ambient Soundscapes — Five curated sound environments (white noise, rain, ocean, lo-fi, forest) that help your nervous system wind down, available through a built-in audio player.
  • 📊 Sleep Tracking & Scoring — Log your sleep, track trends over time with fl_chart visualisations, and get a nightly sleep score that reflects your actual habits.
  • 📱 Screen Time Analysis — Uses app_usage to pull real device screen-time data and feeds it into the AI for more accurate, context-aware recommendations.
  • 🔔 Smart Bedtime Nudges — Scheduled local notifications that remind you to wind down, customised to your target sleep time.
  • 👤 Personalised Profiles — Firebase Auth with Google Sign-In, with all data synced to Firestore so your history travels with you.
  • 📤 Sleep Report Sharing — Export and share your sleep progress as a screenshot-based report via share_plus.

The core loop is simple: track → analyse → improve → repeat.


How we built it

Zzen was built as a solo project using Flutter for the cross-platform UI, with a Firebase backend and Google Gemini as the AI brain.

Architecture overview:

User Input / Screen Time
        ↓
  Flutter UI (Dart)
        ↓
  Firebase Auth + Firestore
        ↓
  Gemini 1.5 Flash API (google_generative_ai)
        ↓
  Personalised Sleep Insights

Key technical decisions:

  • Flutter + Dart — Single codebase targeting Android (and extensible to iOS). Material 3 design system with custom dark theming.
  • Firebase Auth — Google Sign-In via google_sign_in, with flutter_secure_storage for token handling.
  • Cloud Firestore — Real-time NoSQL database storing sleep logs, user profiles, and AI conversation history.
  • Google Gemini 1.5 Flash — Lightweight, fast LLM via the google_generative_ai Dart SDK. We engineered prompts that feed in the user's sleep history and screen time context so the AI gives specific, not generic, advice.
  • fl_chart — For rendering sleep duration trend graphs, sleep score breakdowns, and weekly averages.
  • audioplayers — Handles ambient sound playback with seamless looping.
  • flutter_local_notifications + timezone — Powers the bedtime reminder system with precise scheduled alerts.
  • app_usage — Reads real Android screen time data to give the AI real behavioural context.
  • screenshot + path_provider + share_plus — Enables sleep report export and sharing.

We used .env + flutter_dotenv to keep API keys secure and out of version control.


Challenges we ran into

1. Kotlin/Gradle JVM compatibility The biggest time sink. Android Gradle and Kotlin JVM toolchain versions had silent conflicts that caused build failures with zero clear error messages. Resolving it required pinning specific Kotlin/JVM versions in android/build.gradle and android/app/build.gradle — something that isn't documented anywhere cleanly.

2. Gemini prompt engineering for sleep context Getting the AI to give useful sleep advice (not just regurgitate generic tips) required careful context injection. We had to structure the prompt to include the user's recent sleep log, screen time data, and stated goals in a way that kept token usage efficient while keeping the response grounded and personal.

3. Screen time permissions on Android app_usage requires the PACKAGE_USAGE_STATS permission, which isn't granted through a normal runtime dialog — users have to be sent to a special settings screen. Handling this gracefully (detecting if permission was granted, redirecting, and resuming) required custom native-layer logic.

4. Scheduled notifications across Android versions Android 12+ changed how exact alarms work. Getting reliable bedtime notifications required handling SCHEDULE_EXACT_ALARM permission separately for API 31+ while maintaining backward compat for older devices.

5. Secure .env in Flutter Keeping the Gemini API key out of the repo while still having it accessible at runtime in a Flutter app (which doesn't natively support server-side secrets) required the flutter_dotenv pattern with a .env file bundled as an asset — excluded from git via .gitignore.


Accomplishments that we're proud of

  • Shipped a fully working APK — solo, within a tight hackathon window.
  • Real AI personalisation — the Gemini coach actually factors in your screen time and sleep history, not just your question.
  • End-to-end data pipeline — from screen time read → Firestore log → AI analysis → personalised nudge, all wired up.
  • Clean, dark Gen-Z aesthetic — a UI that actually feels like it was made for us, not like a hospital wellness brochure.
  • SDG alignment baked in — every feature decision was made through the lens of does this actually improve health outcomes for young people?

What we learned

  • Gemini Dart SDK — This was our first time using google_generative_ai in Flutter. Learned how to structure multi-turn conversations, inject context into system prompts, and handle streaming responses.
  • Flutter audio architecture — Managing audio sessions, background playback state, and looping with audioplayers was more nuanced than expected.
  • Android permissions complexity — The gap between what you think permissions do and what they actually require at the OS level is massive. Usage stats, exact alarms, and notification permissions all have their own flow.
  • Prompt engineering is a skill — Writing AI prompts that produce consistent, helpful, safe, and concise output takes real iteration. The difference between a good and bad sleep coaching prompt is night and day (pun intended).
  • Build configs matter — Half the bugs in mobile development live in build.gradle, not in Dart. Gradle and Kotlin versioning deserve as much attention as your actual app code.

What's next for Zzen

Based on our roadmap in FUTURE_SCOPE.md:

Short term

  • Google Play Store publishing (signed AAB via Fastlane CI/CD)
  • iOS App Store launch (Apple Developer provisioning + Xcode build)

Medium term

  • Smart Watch integration — WearOS companion app using Health Connect to pull real sleep stage data (REM, Deep, Light) from accelerometer + heart rate sensors
  • Binaural beats & guided meditation — Expanding the soundscape library with science-backed sleep induction audio
  • Chronotype diagnostics — MEQ questionnaire to identify whether you're a lion 🦁, bear 🐻, wolf 🐺, or dolphin 🐬, and tailor your sleep score formula accordingly
  • Sleep gamification — Sleep streaks, virtual sleep pets, badges, and 30-day challenges

Long term

  • Data fusion engine — Kalman filter-based merging of watch physiological data + phone screen-time data for the most accurate sleep scoring possible
  • Premium tier — Via RevenueCat, unlocking unlimited Gemini messages and advanced Gemini 1.5 Pro analysis
  • Sleep Hygiene Quests — Structured 7/14/30-day programs with progressive difficulty

Sleep is the original performance hack. Zzen is building the app that finally makes it accessible for the generation that needs it most.

Built With

Share this project:

Updates