A full-stack real-time chat application with Laravel backend and Flutter mobile app. Features include real-time messaging, image sharing, user authentication, and WebSocket support.
- β User authentication with Sanctum (API tokens)
- β Real-time messaging with Laravel Reverb (WebSocket)
- β Direct & group conversations
- β Image uploads with captions
- β Contact management
- β Role-based access control (Spatie)
- β Web interface (Blade templates)
- β Cross-platform (iOS & Android)
- β Real-time message updates
- β Image picker & upload
- β Secure token storage
- β Cached images
- β Pull-to-refresh
- β Material Design 3
- Laravel 11 - PHP framework
- Laravel Reverb - WebSocket server
- Laravel Sanctum - API authentication
- MySQL - Database
- Spatie Permission - Role management
- Pusher Protocol - Broadcasting
- Flutter 3.x - Mobile framework
- Provider - State management
- Pusher Channels Flutter - WebSocket client
- Dio/HTTP - API requests
- Cached Network Image - Image caching
- Flutter Secure Storage - Token storage
- PHP 8.2+
- Composer
- MySQL 8.0+
- Node.js & npm (for Vite)
composer install
npm installcp .env.example .env
php artisan key:generateAPP_NAME="Chat App"
APP_URL=http://localhost:8000
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=chat_app
DB_USERNAME=root
DB_PASSWORD=your_password
# Broadcasting
BROADCAST_CONNECTION=reverb
# Reverb (WebSocket Server)
REVERB_APP_ID=675998
REVERB_APP_KEY=dzipltzgyda8iewsqt4o
REVERB_APP_SECRET=60dyhxkwdmh3yzh5wmuw
REVERB_HOST="localhost"
REVERB_PORT=8080
REVERB_SCHEME=http
# Frontend (Vite)
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"php artisan migrate
php artisan db:seed # Optional: Creates admin userphp artisan storage:linkTerminal 1 - Laravel Server:
php artisan serveTerminal 2 - Reverb (WebSocket):
php artisan reverb:startTerminal 3 - Vite (Frontend Assets):
npm run devTerminal 4 - Queue Worker (Optional):
php artisan queue:workOpen browser: http://localhost:8000
Default Admin Credentials:
- Email:
admin@example.com - Password:
password
- Flutter SDK 3.x
- Android Studio / VS Code
- Android Emulator or iOS Simulator
flutter create chat_app
cd chat_appCopy dependencies from FLUTTER_IMPLEMENTATION.md Part 1.
flutter pub getCreate all files from the implementation documents:
FLUTTER_IMPLEMENTATION.md(Part 1) - Models & ConfigFLUTTER_IMPLEMENTATION_PART2.md- Services & ProvidersFLUTTER_IMPLEMENTATION_PART3.md- Auth ScreensFLUTTER_IMPLEMENTATION_PART4_FINAL.md- Chat UI
Important: Add missing imports from FLUTTER_FIXES.md
Edit lib/config/app_config.dart:
For Android Emulator:
static const String baseUrl = 'http://10.0.2.2:8000';
static const String pusherHost = '10.0.2.2';For iOS Simulator:
static const String baseUrl = 'http://localhost:8000';
static const String pusherHost = 'localhost';For Physical Device:
static const String baseUrl = 'http://YOUR_COMPUTER_IP:8000';
static const String pusherHost = 'YOUR_COMPUTER_IP';Find your IP:
# Windows
ipconfig
# Mac/Linux
ifconfig | grep inetflutter runPOST /api/auth/register - Register new user
POST /api/auth/login - Login
POST /api/auth/logout - Logout (requires auth)
GET /api/user - Get current user
GET /api/conversations - List all conversations
POST /api/conversations - Create conversation
GET /api/conversations/{id} - Get conversation details
GET /api/conversations/{id}/messages - Get messages (paginated)
POST /api/conversations/{id}/messages - Send message
GET /api/contacts - List contacts
GET /api/contacts/search - Search users
POST /api/contacts - Add contact
PUT /api/contacts/{id} - Update contact status
GET /api/profile - Get profile
PUT /api/profile - Update profile
POST /api/profile/avatar - Upload avatar
PUT /api/profile/password - Change password
- Open browser console on
http://localhost:8000 - Navigate to a conversation
- Check console logs for successful subscription
- Send messages from different users/devices
- Verify real-time updates work
Images not loading:
php artisan storage:link
php artisan config:clearWebSocket not connecting:
- Check Reverb is running
- Verify
.envbroadcasting configuration - Check firewall allows port 8080
Cannot connect to API:
- Verify correct IP in
app_config.dart - Check Laravel serves on all interfaces
- Disable firewall temporarily
Build fails:
- Run
flutter clean && flutter pub get - Check all imports (see
FLUTTER_FIXES.md)
- FLUTTER_IMPLEMENTATION.md - Models, Config, Storage
- FLUTTER_IMPLEMENTATION_PART2.md - Services (API, WebSocket, Auth)
- FLUTTER_IMPLEMENTATION_PART3.md - Auth & Conversation Screens
- FLUTTER_IMPLEMENTATION_PART4_FINAL.md - Chat UI, Message Bubbles
- FLUTTER_FIXES.md - Import fixes for compilation errors
Happy Coding! π