Walkthrough: Sprint 1 to 6 — Foundations, Auth, Onboarding, Chat, Brain, Voice, Vision, and Settings
This document details the work accomplished during Sprint 1 to 6 of the Lumina AI Companion application. It outlines the structure of the mobile client, python backend, database schemas, and how to verify that everything works correctly.
The project is organized as follows:
Lumina/
├── client/ # Flutter Mobile Application
│ └── lib/
│ ├── core/ # Router, Theme, Network Dio provider
│ ├── features/ # Auth, Onboarding, Chat, Settings, Wakeup
│ └── shared/ # Shared models (UserProfile, Message)
├── backend/ # Python FastAPI backend
│ ├── models/ # Request schemas (ChatRequest, OnboardingRequest)
│ ├── routes/ # Health ping, Onboarding, Session start/end, Chat, Account
│ ├── services/ # Prompt building, Key rotator, Tone classifier, LLM service, Rate limiter, Memory service
│ └── utils/ # JWT Auth validation, Supabase admin client
├── database/ # Database schemas & migrations (schema.sql)
└── documents/ # Project specifications & ticket lists
- LLM Upgrade (services/llm_service.py): Switched LLM routes to use Gemini 2.5 Flash (
gemini-2.5-flash). - Daily Rate Limiting (services/rate_limiter.py): Enforces a user limit of 50 messages/day resetting at midnight UTC.
- Account Deletion (routes/account.py): Exposes
DELETE /accountto remove user record in theuserstable (cascading database-wide to wipe chat history, memories, and rate limits) and deletes the user auth profile viasupabase.auth.admin.delete_user. - Vision Image Storage (routes/chat.py): Stores incoming image base64 data directly inside
messages.image_urlon user chat message insertions.
- History Sync & REST Post (features/chat/providers/chat_provider.dart):
- Restores the last 30 messages from Supabase on startup.
- Sends text + base64 image strings to backend
/chat. - Captures 429 status and parses
reset_atto disable chat input. - Offers
clearHistory()utilizing cascading deletes.
- Countdown Banner (features/chat/widgets/rate_limit_banner.dart): Displays ticking count in
HH:MM:SSformat. - Image Pick & Compress (features/chat/widgets/chat_input_bar.dart): Integrates
image_pickerandflutter_image_compress(min 512px, 85% JPEG). Displays interactive thumbnail preview with a cancel button.
- Text-to-Speech (features/chat/providers/tts_provider.dart): Wraps
flutter_ttsto read AI responses on tapping speaker icons or automatically whenautoplayTtssetting is enabled. - Speech-to-Text (features/chat/widgets/voice_input_button.dart): Captures voice inputs, showing a glowing, red pulsing ring animation when recording.
- Voice Overlay (features/chat/screens/live_voice_overlay.dart): Immersive voice screen triggered from the headphones icon button in
ChatScreenApp Bar. - Reactive Voice Orb: Displays a glowing animated gradient mesh changing behavior based on conversation states:
- Listening: Slow sage-green breathing pulse.
- Thinking: Multi-layered rotating purple mesh.
- Speaking: Amber waves.
- Tap to Interrupt: Tapping the central orb stops TTS immediately and restarts microphone listening.
- Settings Screen (features/settings/screens/settings_screen.dart):
- Profile Card: Displays user's Google name, email, and photo.
- Your AI: Inline renamed input fields synchronized database-wide, displaying companion archetype descriptions.
- Preferences: Segmented dropdown selection of App Theme (Light / Dark / System Default) and Auto-play voice switcher.
- Actions: Clear history confirmation alerts, local sign-out, and Delete My Account cascading wipe triggers.
- Login UI Contrast & Themes (auth/screens/login_screen.dart):
- Configured title, subtitle, and footer texts to dynamically read the theme brightness and switch between light and dark high-contrast colors (
textPrimary/textPrimaryDarkandtextSecondary/textSecDark), solving contrast issues on dark backgrounds.
- Configured title, subtitle, and footer texts to dynamically read the theme brightness and switch between light and dark high-contrast colors (
- Official Google Logo SVG (assets/google_logo.svg):
- Integrated the official Google "G" logo SVG asset using the
flutter_svgpackage, replacing the previous custom-drawn and distorted painter.
- Integrated the official Google "G" logo SVG asset using the
- Google Sign-In Configurations:
- Extracted debug SHA-1/SHA-256 certificate fingerprints and configured the Web Client ID for proper OAuth flow with Supabase and Android Google Play Services.
- Guest Authentication Service (auth_service.dart):
- Added support for Supabase anonymous sign-in, letting guest users bypass Google play services credentials.
- Transient Data Cleanups (auth_provider.dart):
- App startup automatically detects if the previous active session belongs to a guest user and triggers backend account deletion (
DELETE /account) and signs them out cleanly. This prevents guest data from persisting across runs. - Logging out of a guest session triggers a cascading backend
DELETE /accountcall, immediately freeing public and auth table storage space in Supabase.
- App startup automatically detects if the previous active session belongs to a guest user and triggers backend account deletion (
- Onboarding Unique Guest Mappings (onboarding.py):
- Automatically generates a unique, non-null mock email
guest_<UUID>@lumina.aiand default display nameGuestduring upsert to satisfy constraints of the publicusersdatabase table.
- Automatically generates a unique, non-null mock email
- Interactive UI Additions (login_screen.dart & settings_screen.dart):
- Added a secondary outlined "Continue as Guest" button to the login page.
- Profile cards display friendly guest placeholders instead of empty text.
- Backend Bypass Support (onboarding.py):
- Modified the onboarding submission route to check if the quiz responses list
answersis empty. If empty, the system automatically assigns the default"drifter"archetype and bypasses calculations.
- Modified the onboarding submission route to check if the quiz responses list
- Client Onboarding State (onboarding_provider.dart):
- Added
isIntroCompletedstate variable (defaulting tofalse). - Added
startQuiz(): setsisIntroCompleted = true, resets indexing, and initializes the answers list with empty placeholder values. - Added
skipQuiz(): setsisIntroCompleted = true, clears selections, and callssubmitQuiz()to assign the default archetype. - Added
previousQuestion()andgoBackToIntro()to enable navigating back to previous questions or the welcome screen, preserving selected answers at each index.
- Added
- Client Quiz View & Custom Answer Input (quiz_screen.dart):
- Overhauled state machine to display a warm Intro welcome card asking "I want to know you before we talk." with action buttons "I'm not ready" (skips quiz completely) and "Bring it on" (starts quiz) if
isIntroCompletedis false. - Rendered a custom text input field below the preset option buttons. Typing select/registers custom input, while tapping a preset option button clears the custom text field.
- Pre-populates the custom text input field with the user's previously typed custom answer when navigating back or forward to a question.
- Wrapped the main question body card in a
GestureDetectorthat detects horizontal drag swipes: swipe right navigates to the previous question (or back to the intro welcome screen if on the first question), while swipe left moves to the next question (if answered).
- Overhauled state machine to display a warm Intro welcome card asking "I want to know you before we talk." with action buttons "I'm not ready" (skips quiz completely) and "Bring it on" (starts quiz) if
- Cozy Space-Theme Styling: Updated dark theme color scheme across all screens (
login_screen.dart,chat_screen.dart,naming_screen.dart,settings_screen.dart) using cozy charcoal (#0B0C14), dark indigo (#1A1530), and warm gold glows. - Glassmorphism Overlay (shared/widgets/glass_container.dart): Frosted blur and bevel overlays applied on input bars, settings tiles, and app bar surfaces.
- Ambient Canvas (shared/widgets/ambient_particles.dart): Floating stellar particle stream running at 60 FPS behind chat and login backdrops.
- Ambient Soundscapes (core/soundscape_service.dart): Streams loopable relaxing tracks (Cozy Rain, Fireplace, Cozy Lo-Fi) utilizing the
audioplayerspackage. - Entrance Animations (features/chat/widgets/entrance_transition.dart): Message bubbles smoothly fade and slide upwards when rendered.
- Circular Adaptive Launcher Icon:
- Implemented crop_logo_circular.py to crop, mask, and save the app icon as a circle with transparent corners.
- Added Android adaptive icon configs (
adaptive_icon_background: "#0B0C14",adaptive_icon_foreground: "assets/lumina_logo.png") in pubspec.yaml. - Linked
android:roundIconin AndroidManifest.xml. - Re-generated all native assets utilizing
flutter_launcher_iconsand uninstalled old versions to refresh OS caches.
- Native App Updater: Integrated
open_filexandpackage_info_plusin the client to support seamless, in-app updates directly from GitHub Releases with live download progress. - Git Ignore Security: Created a root-level
.gitignoreand updatedclient/.gitignoreto ignore.envfiles (protecting sensitive credentials likeSUPABASE_SERVICE_KEYandGEMINI_API_KEYfrom public exposure) and local build environments (venv,.dart_tool/,build/). - Templates: Created
backend/.env.exampleandclient/assets/.env.exampletemplates to guide production deployment setups.
- Internet Checker: Integrated
connectivity_plusto listen to network adapters. Performs DNS socket lookups ongoogle.comto verify true internet capability. - Glassmorphic Offline Screen: Created a full-screen
OfflineOverlaydisplaying a cozy offline illustration: "Lost connection to the stars. Grab a warm cup of tea ☕ while we reconnect..." It overlay-blocks all user interaction automatically when the device goes offline. - Pre-emptive Wakeup Service: Initializes a background ping to the Render backend
GET /pingas soon as the app launches (or connection is restored). Since Render's free tier sleeps after 15 minutes, this triggers a "cold boot" immediately while the user is on the welcome handwriting animation or login screens, neutralizing the startup spinup lag. - Status Indicator: The chat app bar displays
"Waking up companion..."in amber when the server is cold booting, changing back to regular cozy AI status once the backend returns200 OK.
Run static analysis checks:
cd client
flutter pub get
flutter analyzeCurrent Status: No issues found! (Zero warnings, errors, or info notes).
Start development server:
cd backend
.\venv\Scripts\uvicorn main:app --reloadTest health status:
Invoke-RestMethod -Uri "http://127.0.0.1:8000/ping"Current Status: Returns {"status": "ok", "message": "Lumina is awake."}.
All routes compile and run cleanly.