This is a chat application built using Laravel for the backend and React with Inertia.js for the frontend. The application provides real-time chat functionality, user authentication, and profile management.
It utilizes Tailwind CSS for styling, TypeScript for type safety, React Router for client-side routing, and Vite for fast builds and hot module replacement.
- Laravel: A PHP framework for building robust and scalable web applications.
- React: A JavaScript library for building user interfaces.
- Inertia.js: A framework that allows you to build single-page apps using classic server-side routing and controllers.
- Tailwind CSS: A utility-first CSS framework for styling the application.
- Docker: Containerization platform for running the application database.
- Vite: A build tool that provides a faster and leaner development experience for modern web projects.
- Sanctum: Laravel's lightweight authentication system for SPAs and simple APIs.
- Reverb: Laravel WebSocket server to handle real-time events
- Laravel Echo: Frontend JavaScript library used to subscribe to channels and listen for events broadcast by Laravel backend, enabling real-time web communication
-
Clone the repository:
git clone https://github.com/fanboxio/laravel-react-chat-eugene cd laravel-react-chat -
Install dependencies:
composer install npm install
-
Copy the
.env.examplefile to.env:cp .env.example .env
-
Generate an application key:
php artisan key:generate
-
Run database in Docker:
-
Set up the database:
- Update the
.envfile with your database credentials. - Run database in Docker
docker-compose up -d
- Run the migrations:
php artisan migrate
- Seed the database:
php artisan db:seed
- Update the
After initially completing the installation steps, you can launch the application with the following commands:
-
Start the database Docker container:
docker-compose up -d
-
Start the backend server:
php artisan serve
-
Start the frontend development Vite server:
npm run dev
-
Start the Reverb WebSockets server:
php artisan reverb:start
(optional) Restart the Reverb WebSockets server after making changes to your code:
php artisan reverb:restart
-
Run the Jobs Queue Worker for WebSockets broadcasting to work
php artisan queue:listen
- Authentication: The application uses Laravel Breeze for authentication. You can register, log in, and manage your profile.
- Chat: Users can send and receive messages in real-time.
- Profile Management: Users can update their profile information and change their password.