Skip to content

Laravel Real-time chat app demo with React, Laravel Echo, Breeze, Socket.io, Redis, Inertia.js, TailwindCSS stack.

Notifications You must be signed in to change notification settings

sinanbekar/laravel-realtime-chat-app

Repository files navigation

Laravel Real-time Chat App

You can build yours from scratch with the following Medium article

https://medium.com/@sinan.bekar/build-a-real-time-chat-app-with-laravel-and-react-5cae5a7c22d4

In production demo app: http://laravel-chat-app.ml/

Installation with Docker (Laravel Sail)

Install composer packages:

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v $(pwd):/var/www/html \
    -w /var/www/html \
    laravelsail/php81-composer:latest \
    composer install --ignore-platform-reqs

Create .env:

cp .env.example .env

Sail up:

./vendor/bin/sail up -d

Generate app key:

./vendor/bin/sail artisan key:generate

Clean cache and migrate:

./vendor/bin/sail artisan cache:clear && ./vendor/bin/sail artisan migrate

Run tinker:

./vendor/bin/sail artisan tinker

Create users and rooms:

\App\Models\User::factory(5)->create();
DB::table('rooms')->insert(array_map(function ($room) {
            return ['name' => $room];
        }, ['general', 'room1', 'room2', 'room3', 'room4']));
}

Install npm packages and compile assets:

npm install && npm run dev

You can access the chat page by visiting http://localhost/chat after login.

About

Laravel Real-time chat app demo with React, Laravel Echo, Breeze, Socket.io, Redis, Inertia.js, TailwindCSS stack.

Topics

Resources

Stars

Watchers

Forks