A modern, feature-rich chat application built with Flutter that combines real-time messaging with AI-powered conversation analysis and thread organization.
- Overview
- Features
- Tech Stack
- Architecture
- Installation
- Configuration
- Project Structure
- Key Features Explained
- Contributing
- Security
- License
- Acknowledgments
ThreadFlow is an intelligent chat application that organizes conversations into threads and uses AI to automatically generate summaries, analyze sentiment, and extract keywords from conversations. Built with Flutter and Firebase, it provides a seamless real-time messaging experience with powerful AI enhancements.
- Organized Conversations: Threads keep discussions focused and easy to follow
- AI-Powered Insights: Automatic summaries and sentiment analysis
- Real-Time Communication: Instant messaging with typing indicators
- Cross-Platform: Works on Android, iOS, and Web
- User Authentication – Email/Password signup and login with Firebase Auth
- Real-Time Messaging – Instant message delivery with Firestore streams
- Thread Organization – Create and manage conversation threads
- Group Chats – Create group chats and add members
- Message Reactions – React to messages with emojis
- Image Sharing – Upload and share images (Cloudinary integration)
- AI Summaries – Auto-generated thread summaries using Groq LLM
- Sentiment Analysis – AI-powered sentiment detection
- Search Messages – Search through chat history
- Typing Indicators – See when others are typing
- Delete/Leave Chats – Delete chats or leave groups
- Dark Mode – System-aware theme switching
- User Profiles – Customizable user profiles with avatars
- Thread Summaries: 1–2 sentence summaries of conversations
- Sentiment Analysis: Positive, neutral, or negative sentiment detection
- Keyword Extraction: Extract key topics from conversations
- Suggested Replies: AI-powered reply suggestions
- Thread Titles: Auto-generated thread titles
| Technology | Version | Purpose |
|---|---|---|
| Flutter | 3.x | UI Framework |
| Dart | 3.x | Programming Language |
| Riverpod | 2.4.0 | State Management |
| Hooks Riverpod | 2.4.0 | Hooks + Riverpod |
| Flutter Hooks | 0.20.3 | Stateful Widgets |
| Service | Purpose |
|---|---|
| Firebase Auth | User Authentication |
| Firebase Firestore | Real-time Database |
| Groq API | AI-powered features (LLaMA 3.3 70B) |
| Cloudinary | Image Upload & Storage |
| Firebase Cloud Firestore | Real-time data sync |
dependencies:
firebase_core: ^2.24.2
firebase_auth: ^4.16.0
cloud_firestore: ^4.14.0
flutter_riverpod: ^2.4.0
hooks_riverpod: ^2.4.0
image_picker: ^1.0.4
cloudinary_public: ^0.23.1
google_sign_in: ^6.1.5
cached_network_image: ^3.3.0
flutter_dotenv: ^5.1.0lib/
├── config/
│ ├── firebase_config.dart # Firebase initialization
│ ├── firebase_options.dart # Firebase platform configs
│ ├── groq_config.dart # Groq API configuration
│ └── cloudinary_config.dart # Cloudinary configuration
│
├── models/
│ ├── chat_model.dart # Chat data model
│ ├── message_model.dart # Message data model
│ ├── thread_model.dart # Thread data model
│ └── user_model.dart # User data model
│
├── providers/
│ ├── auth_provider.dart # Authentication state
│ ├── chat_provider.dart # Chat operations
│ ├── message_provider.dart # Message operations
│ ├── ai_provider.dart # AI features
│ ├── typing_provider.dart # Typing indicators
│ ├── storage_provider.dart # Image upload
│ └── service_providers.dart # Service locator
│
├── services/
│ ├── auth_service.dart # Firebase Auth service
│ ├── firestore_service.dart # Firestore operations
│ ├── groq_service.dart # Groq API integration
│ ├── cloudinary_storage_service.dart # Cloudinary upload
│ └── typing_indicator_service.dart # Typing management
│
└── ui/
├── screens/
│ ├── auth/
│ │ ├── login_screen.dart
│ │ ├── signup_screen.dart
│ │ └── forgot_password_screen.dart
│ ├── home_screen.dart
│ ├── chat_screen.dart
│ ├── profile_screen.dart
│ ├── settings_screen.dart
│ └── chat_info_screen.dart
├── widgets/
│ ├── message_bubble.dart # Message display
│ ├── message_input.dart # Message composer
│ ├── chat_list.dart # Chat list
│ ├── summary_banner.dart # AI summary display
│ ├── typing_indicator.dart # Typing indicator
│ ├── user_avatar.dart # User avatar
│ └── reaction_picker.dart # Emoji reactions
└── theme/
└── app_theme.dart # App theming
User Action → Provider → Service → Firestore/Groq → UI Update
↓
UI State ← Provider ← Service ← Firestore/Groq
- Flutter SDK (3.x or higher)
- Android Studio / VS Code
- Firebase Account (free tier)
- Groq API Key
- Cloudinary Account (free tier)
git clone https://github.com/GulrezQayyum/thread-flow.git
cd thread-flowflutter pub get- Create a Firebase project at Firebase Console
- Register your app (Android, iOS, Web)
- Download
google-services.json(Android) andGoogleService-Info.plist(iOS) - Place files in the respective directories
- Enable Authentication (Email/Password)
- Enable Firestore Database
- Update Firestore rules (see below)
Create a .env file in the project root:
GROQ_API_KEY=your_groq_api_key
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secretUpdate Firestore rules in Firebase Console:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}# For Android
flutter run
# For iOS
flutter run -d ios
# For Web
flutter run -d chrome- Sign up at Groq Console
- Generate an API key
- Add the key to your
.envfile - Model used:
llama-3.3-70b-versatile
- Sign up at Cloudinary
- Get your Cloud Name, API Key, API Secret
- Create an upload preset named
ml_default - Add credentials to
.envfile
- Enable Email/Password authentication
- Enable Firestore Database
- Set up security rules
- Configure indexes (see below)
| Collection | Fields | Order |
|---|---|---|
| chats | members, lastMessageAt | Ascending, Descending |
| messages | createdAt | Ascending |
| messages | threadId, createdAt | Ascending, Ascending |
| threads | lastMessageAt | Descending |
Threads organize conversations around specific topics:
// Creating a thread
final threadId = DateTime.now().millisecondsSinceEpoch.toString();
await sendMessage(
text: "How's the project going?",
threadId: threadId,
isThreadStart: true,
);Automatic thread summaries using Groq API:
// AI summary generation
final summary = await groqService.generateThreadSummary(messages);
// Result: "Team discussing project updates and Adam's whereabouts"Real-time typing indicators using Firestore:
// Set typing indicator
await typingService.setTyping(chatId, userId, userName);
// Auto-clears after 3 secondsWhatsApp-style reactions:
// Toggle reaction
await toggleReaction(messageId, userId, '❤️');- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow Flutter/Dart best practices
- Use Riverpod for state management
- Write meaningful commit messages
- Test thoroughly before submitting PR
- Firebase Authentication with Email/Password
- Secure password reset flow
- Session management via Firebase Auth
// Basic security rules
allow read: if request.auth != null;
allow write: if request.auth != null &&
request.auth.uid == request.resource.data.userId;- All API keys stored in
.envfile .envadded to.gitignore- Keys not exposed in client code
This project is licensed under the MIT License – see the LICENSE file for details.
- Flutter – UI Framework
- Firebase – Backend services
- Groq – AI API
- Cloudinary – Image hosting
- Riverpod – State management
Built with love, code, and too much coffee