A modular, production-style C++/Qt5 desktop chat application demonstrating real-time friends, chat, and rich presence using Google Cloud Firestore for storage.
Demo.mp4
- Clean Qt5 Widgets UI: Login screen -> Chat interface with friends list
- Real-time Chat: Global chat room with live message updates via polling
- Friends & Presence: Static friend list with online/offline status indicators
- Firestore Integration: Uses Firestore REST API (no Firebase Auth required)
- Modular Architecture: Clean separation with services, models, and UI layers
- Qt5: Qt5 with Widgets and Network modules
- CMake: Version 3.16 or later
- C++17: Compatible compiler
- GoogleTest: For running unit tests (optional)
- Google Cloud Firestore: Project with API key
-
Install CMake:
# macOS with Homebrew brew install cmake # Ubuntu/Debian sudo apt-get install cmake # CentOS/RHEL/Fedora sudo dnf install cmake # or: sudo yum install cmake # Windows # Download from https://cmake.org/download/ # Or via Chocolatey: choco install cmake # Or via Scoop: scoop install cmake
-
Install Qt5:
# macOS with Homebrew brew install qt@5 # Ubuntu/Debian sudo apt-get install qtbase5-dev qtbase5-dev-tools libqt5network5-dev # Windows # Download Qt5 from https://www.qt.io/download
-
Clone and build:
git clone <repository-url> cd CppGameChat mkdir build && cd build cmake .. make
-
Create configuration file in the build directory (config.json):
{ "apiKey": "your-firestore-api-key", "projectId": "your-firestore-project-id", "databaseId": "(default)", "pollIntervalMs": 1200, "presenceHeartbeatMs": 5000, "presenceStaleMs": 12000 } -
Run the application:
./app/QtChatPresence
-
Install Firebase Tools:
npm install -g firebase-tools
-
Start emulator:
firebase emulators:start --only firestore
-
Update config.json to point to emulator:
- Use project ID:
demo-project - The emulator runs on
localhost:8080by default
- Use project ID:
- Create a Firebase project at https://console.firebase.google.com
- Enable Firestore Database
- Get your API key from Project Settings (Web)
- Use permissive rules for demo.
The application uses these Firestore collections:
presence/{userId}: User online/offline status and heartbeatsrooms/global/messages/{messageId}: Chat messages in the global room
Run unit tests with GoogleTest:
cd build
make
./tests/core_tests/core_testsTests cover:
- Presence calculation logic
- Retry policy with exponential backoff
- Firestore JSON mapping and parsing
The app includes 5 demo friends:
- Jon
- Arya
- Tyrion
- Daenerys
- Sansa
Their online/offline status is determined by looking up their presence in Firestore.
Build Issues:
- Make sure Qt5 is in your PATH
- Check CMake can find Qt5:
cmake .. -DQt5_DIR=/path/to/qt5
Connection Issues:
- Verify your config.json has valid apiKey and projectId
- Check Firestore security rules allow read/write
- For emulator: ensure it's running on localhost:8080
No Messages Appearing:
- Verify your API key has Firestore permissions
- Try sending a message through Firestore console directly

