This repository contains the complete source code for a real-time chat application using Laravel Reverb for the backend (API) and Nuxt 3 for the frontend. This app demonstrates how to set up a chat interface with real-time messaging, typing indicators, and more using separate Laravel and Nuxt 3 projects.
- Real-Time Messaging using Laravel Reverb and Laravel Echo
- Laravel Sanctum Authentication for secure API access
- Typing Indicator with Echo Whisper events
- Private Chat Channels for user-to-user communication
- Nuxt 3 as the frontend framework with Vue 3 composition API
- Laravel as the backend API with Reverb for broadcasting events
For a step-by-step guide, watch the full tutorial on YouTube:
git clone [email protected]:qirolab/Nuxt3-Laravel-Reverb-Chat.git
- Navigate to the Laravel folder and install dependencies:
cd laravel-api
composer install
- Copy the
.env.example
to.env
:
cp .env.example .env
- Generate the application key:
php artisan key:generate
- Set up your database in the
.env
file and run migrations:
php artisan migrate
- Start the Laravel development server:
php artisan serve
- In a new terminal, run the Laravel Reverb server:
php artisan reverb:start
- Navigate to the Nuxt app folder and install dependencies:
cd nuxt3-app
npm install
- Copy the
.env.example
to.env
:
cp .env.example .env
-
Make sure to set the
NUXT_SANCTUM_API_URL
in your.env
file to point to your Laravel app URL. -
Run the Nuxt development server:
npm run dev
The Laravel backend is located in the laravel-api
directory and is responsible for:
- Handling user authentication via Laravel Sanctum.
- Broadcasting real-time events using Laravel Reverb.
- Managing chat messages and users.
The Nuxt 3 frontend is located in the nuxt3-app
directory and handles:
- Displaying real-time chat messages.
- User authentication and routing.
- Integrating with Laravel Echo to listen for broadcasted messages and typing events.
If you found this demo helpful and want to support my work, check out some of my other products:
This project is open-sourced software licensed under the MIT license.