GitHunt
QR

QRTQuick/vetrovintge-chat-app

a mobile app chat app built using flutter

Vetrovintge Chat App

A scalable production-ready chat application built with Flutter and Firebase, inspired by WhatsApp architecture.

Folder Structure

lib/
  core/
    constants/
    utils/
    services/
  features/
    auth/
    chat/
    contacts/
    home/
  data/
    models/
    repositories/
    datasources/
  presentation/
    screens/
    widgets/
    providers/

Firebase Setup

  1. Create a Firebase project.
  2. Enable Authentication (Phone).
  3. Enable Firestore and set rules (see firestore.rules).
  4. Enable Cloud Storage for image/file sharing.
  5. Add Android, iOS, web, desktop apps and download google-services.json / GoogleService-Info.plist.
  6. Install FlutterFire CLI and run flutterfire configure.

Firestore Schema

  • users/{uid}: profile, FCM token, presence.
  • chats/{chatId}: participants array, lastMessage, lastMessageTime.
  • chats/{chatId}/messages/{messageId}: message documents.

Indexes: create composite index on participants and lastMessageTime for chat list queries.

Security Rules

Rules are in firestore.rules; ensures only participants can read/write and validates senderId.

Cloud Functions

An example function is in functions/index.js that sends FCM notifications when a new message document is created.

CI/CD (GitHub Actions)

Workflows under .github/workflows build Android APK, Windows .exe, and macOS .app on push.

Local Caching

Use Hive/Isar to store messages locally. Implement repositories to sync with Firestore using offline support.

Presence & Typing

Store isOnline, lastSeen, typingTo fields under each user document and update on lifecycle events using WidgetsBindingObserver.

Building

flutter pub get
flutter build apk
flutter build windows
flutter build macos

Optional Advanced Features

  • AES encryption of message content before toMap().
  • Group chats, message reactions, broadcast lists.

This repository contains scaffolding and examples. Fill in UI screens with Riverpod/Bloc providers; implement business logic in features/* with clean separation.