Skip to content

EduLinkUp/MoodGenie-EduLinkUpCapstoneProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ§žβ€β™‚οΈ MoodGenie - Your Emotional AI Companion

MoodGenie is an AI-powered mood journaling and companion app built using Flutter (frontend) and FastAPI + Gemini API (backend). It helps users reflect on their thoughts, get emotionally intelligent replies, and store their mood summaries locally using Hive.

πŸ“₯ Download MoodGenie App: Download APK


πŸš€ Features

  • 🧠 AI-generated emotional responses using Google Gemini API
  • ✨ Auto-generated mood summaries stored locally on device
  • 🐝 Local database using Hive (no internet needed for mood history)
  • πŸ“± Shareable as APK, without the Play Store
  • 🌐 Backend deployed via FastAPI on Render
  • 🎨 Beautiful UI with custom animations and Google Fonts

πŸ“¦ Tech Stack

Layer Technology
Frontend Flutter
Backend FastAPI
AI Model Google Gemini (gemini-2.0-flash-lite)
Local Storage Hive

πŸ› οΈ Prerequisites

Before you begin, ensure you have the following installed:

For Backend:

  • Python 3.8+ - Download Python
  • pip (Python package manager, comes with Python)

For Frontend:

  • Flutter SDK 3.8.0+ - Install Flutter
  • Dart SDK (comes with Flutter)
  • Android Studio (for Android development) or Xcode (for iOS development on macOS)
  • A code editor like VS Code or Android Studio

API Keys:


βš™οΈ Backend Setup

1. Navigate to Backend Directory

cd backend

2. Create Virtual Environment (Recommended)

# On macOS/Linux
python3 -m venv venv
source venv/bin/activate

# On Windows
python -m venv venv
venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the backend directory:

touch .env

Add your Gemini API key to the .env file:

GEMINI_API_KEY=your_gemini_api_key_here

Replace your_gemini_api_key_here with your actual API key from Google AI Studio.

5. Run the Backend Server

# Development mode with auto-reload
uvicorn main:app --reload

# Production mode
uvicorn main:app --host 0.0.0.0 --port 8000

The backend API will be available at http://localhost:8000

API Endpoints:

  • POST /chat - Send user prompt and receive AI response
  • GET /summary - Get conversation summary when app closes

πŸ“± Frontend Setup

1. Navigate to Frontend Directory

cd frontend

2. Install Flutter Dependencies

flutter pub get

3. Configure Backend URL

Open lib/screens/home_screen.dart and update the API URL if needed:

final url = Uri.parse('http://localhost:8000/chat'); // For local testing
// OR
final url = Uri.parse('https://moodgenie.onrender.com/chat'); // For production

4. Verify Assets

Ensure the following assets are present in the assets/ directory:

  • app_icon.png - App launcher icon
  • cloudy_animation.mp4 - Background animation (optional)

5. Run the App

For Android:

flutter run

For iOS (macOS only):

cd ios
pod install
cd ..
flutter run

For Web:

flutter run -d chrome

6. Build APK (Android)

To create a release APK:

flutter build apk --release

The APK will be located at: build/app/outputs/flutter-apk/app-release.apk

For split APKs per ABI (smaller file sizes):

flutter build apk --split-per-abi

🎯 Project Structure

MoodGenie/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                          # FastAPI server
β”‚   β”œβ”€β”€ gemini_handler.py                # Gemini AI integration
β”‚   β”œβ”€β”€ moodgenie_training_data.json     # AI training context
β”‚   β”œβ”€β”€ requirements.txt                 # Python dependencies
β”‚   β”œβ”€β”€ .env                             # Environment variables (not tracked)
β”‚   └── .gitignore
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ main.dart                    # App entry point
β”‚   β”‚   └── screens/
β”‚   β”‚       β”œβ”€β”€ splash_screen.dart       # Welcome screen
β”‚   β”‚       β”œβ”€β”€ mainAppScreen.dart       # Main navigation
β”‚   β”‚       β”œβ”€β”€ home_screen.dart         # Chat interface
β”‚   β”‚       └── history_screen.dart      # Mood history
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ app_icon.png                 # App icon
β”‚   β”‚   └── cloudy_animation.mp4         # Background video
β”‚   β”œβ”€β”€ pubspec.yaml                     # Flutter dependencies
β”‚   └── .gitignore
└── README.md

πŸ§ͺ Testing the Application

Backend Testing:

  1. Start the backend server:

    cd backend
    uvicorn main:app --reload
  2. Test the chat endpoint:

    curl -X POST http://localhost:8000/chat \
      -H "Content-Type: application/json" \
      -d '{"user_prompt": "I am feeling happy today!"}'
  3. Test the summary endpoint:

    curl http://localhost:8000/summary

Frontend Testing:

  1. Ensure backend is running
  2. Launch the Flutter app
  3. Test conversation flow
  4. Check mood history storage
  5. Verify summary generation on app close

🌐 Deployment

Backend Deployment (Render):

  1. Push your code to GitHub
  2. Connect your repository to Render
  3. Set environment variable: GEMINI_API_KEY
  4. Deploy with build command: pip install -r requirements.txt
  5. Start command: uvicorn main:app --host 0.0.0.0 --port $PORT

Frontend Deployment:

  • Android: Share the APK file directly
  • iOS: Distribute via TestFlight or App Store
  • Web: Deploy using flutter build web and host on Firebase/Netlify/Vercel

πŸ”§ Troubleshooting

Common Backend Issues:

Issue: ModuleNotFoundError: No module named 'fastapi'
Solution: Run pip install -r requirements.txt in the backend directory

Issue: google.generativeai.types.generation_types.BlockedPromptException
Solution: Check your API key and ensure it's valid

Common Frontend Issues:

Issue: Failed to load asset
Solution: Run flutter pub get and verify assets in pubspec.yaml

Issue: Connection refused when testing
Solution: Ensure backend server is running and URL is correct in home_screen.dart

Issue: Build fails for iOS
Solution: Run cd ios && pod install && cd .. then try again


🀝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is open source and available for educational purposes.


πŸ‘€ Author

Aryan Varshney


πŸ™ Acknowledgments

  • Google Gemini AI for the conversational intelligence
  • Flutter team for the amazing framework
  • FastAPI for the lightning-fast backend framework
  • Hive for efficient local storage

πŸ“ž Support

If you encounter any issues or have questions, please:

  1. Check the Troubleshooting section
  2. Review existing issues on GitHub
  3. Create a new issue with detailed information

Happy Coding! πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors