A simple demo application showcasing the musonza/chat Laravel package. This application demonstrates how to build a real-time chat system using Laravel, Vue.js, Inertia.js, and Laravel Reverb.
- 💬 Real-time messaging with Laravel Reverb
- 👥 User-to-user conversations
- 🤖 Bot conversations
- 🔐 Authentication with Laravel Breeze
- 📱 Responsive Vue.js frontend with Inertia.js
- 🔒 Message encryption support
- ✨ Modern UI with Tailwind CSS
Try it live: chat-demo.up.railway.app (coming soon)
- PHP >= 8.2
- Composer
- Node.js >= 18.x and npm
- SQLite (or MySQL/PostgreSQL)
-
Clone the repository
git clone <repository-url> cd chat-demo
-
Install PHP dependencies
composer install
-
Install JavaScript dependencies
npm install
-
Set up environment file
cp .env.example .env php artisan key:generate
-
Configure your database
Edit
.envand set your database configuration. For SQLite (default):DB_CONNECTION=sqlite DB_DATABASE=/absolute/path/to/database/database.sqlite
-
Run migrations
php artisan migrate
-
Build frontend assets
npm run build
Or for development:
npm run dev
-
Start the development server
php artisan serve
For full development setup (server, queue, logs, and Vite):
composer run dev
Make sure to configure Laravel Reverb in your .env file:
REVERB_APP_ID=your-app-id
REVERB_APP_KEY=your-app-key
REVERB_APP_SECRET=your-app-secret
REVERB_HOST=localhost
REVERB_PORT=8080
REVERB_SCHEME=httpStart the Reverb server:
php artisan reverb:startThe application uses Laravel's broadcasting system. Make sure your .env has:
BROADCAST_DRIVER=reverb- Register a new account or login with existing credentials
- Start a conversation by clicking "New Conversation" and selecting a user
- Chat with bots by navigating to the Discover page
- Send messages in real-time - messages appear instantly for all participants
- Backend: Laravel 12
- Frontend: Vue.js 3 + Inertia.js
- Real-time: Laravel Reverb
- Styling: Tailwind CSS
- Chat Package: musonza/chat
chat-demo/
├── app/
│ ├── Http/Controllers/
│ │ ├── Api/ # API endpoints for conversations and messages
│ │ └── ChatController.php
│ └── Models/
│ └── Bot.php # Bot model for chat bots
├── resources/
│ └── js/
│ ├── Components/Chat/ # Vue chat components
│ ├── Pages/Chat/ # Chat pages
│ └── Composables/ # Vue composables for messages and real-time
└── database/
└── migrations/ # Database migrations including chat tables
php artisan testThis project uses Laravel Pint for code formatting:
./vendor/bin/pintThis is a demo application. If you'd like to contribute to the underlying chat package, please visit musonza/chat.
This demo application is open-sourced software licensed under the MIT license.
Click the button above or follow these steps:
-
Create a Railway account at railway.app
-
Create a new project and add a PostgreSQL database
-
Deploy from GitHub
- Connect your GitHub account
- Select this repository
- Railway will auto-detect the Laravel app
-
Set environment variables in Railway dashboard:
APP_NAME="Chat Demo" APP_ENV=production APP_DEBUG=false APP_URL=https://your-app.up.railway.app # Database (auto-filled if using Railway PostgreSQL) DB_CONNECTION=pgsql DB_HOST=${{Postgres.PGHOST}} DB_PORT=${{Postgres.PGPORT}} DB_DATABASE=${{Postgres.PGDATABASE}} DB_USERNAME=${{Postgres.PGUSER}} DB_PASSWORD=${{Postgres.PGPASSWORD}} # Generate with: php artisan key:generate --show APP_KEY=base64:your-generated-key # For real-time (Option A: Pusher - recommended for demo) BROADCAST_CONNECTION=pusher PUSHER_APP_ID=your-pusher-app-id PUSHER_APP_KEY=your-pusher-key PUSHER_APP_SECRET=your-pusher-secret PUSHER_APP_CLUSTER=us2 VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
-
For real-time WebSockets, choose one option:
Option A: Pusher (Easiest)
- Sign up at pusher.com (free tier: 200k messages/day)
- Create a Channels app and copy credentials
- Update
.envas shown above
Option B: Soketi on Railway
- Add Soketi as a separate Railway service
- Configure it as a Pusher-compatible server
Option C: Run without real-time
- Set
BROADCAST_CONNECTION=log - Messages will save but won't appear instantly (refresh to see new messages)
To create a one-click deploy template:
- Deploy the app manually first
- Go to Railway dashboard → Project Settings → Generate Template
- Replace the button URL in this README
- musonza/chat - The Laravel chat package powering this demo