A minimal real-time chat application built with Laravel that can use either Laravel Reverb or AnyCable for WebSocket broadcasting.
This project started as an AI-generated fork of our Next.js demo.
Features real-time messaging with session-based usernames and message persistence.
First, install PHP dependencies:
composer installInstall Node.js dependencies:
npm installCreate the database and run migrations:
touch database/database.sqlite
php artisan migrateStart the development server (includes Laravel server, Reverb WebSocket server, Vite, and background processes):
composer run devYou can open the app in your browser at http://localhost:8000.
The default command runs a Laravel Reverb WebSocket server. You can also run this app using AnyCable as a WebSocket server:
composer run dev:anycableThe only difference is the server command: php artisan anycable:server instead of php artisan reverb:start. The anycable:server command is provided by the anycable-laravel package. But there is more.
You can also go AnyCable full mode (and not just Pusher compatibility) and switch the broadcaster to "anycable". In your .env file:
BROADCAST_CONNECTION=anycable
Now, launch the app using the same composer run dev:anycable command and you'll see it speaking AnyCable (if you open your browser DevTools). This gives you all the AnyCable features such as reliable streams and more.
- Real-time chat messaging with Laravel Reverb w/ typing indicators and presence info
- Session-based username system
- Message persistence with SQLite
- React frontend with Inertia.js
- Tailwind CSS for styling