- Front-end: Chitchat Vuejs
- Make sure you have
redis
installed on your computer. Try runredis-cli
in terminal to see - Make sure you have
php
,php extension
,nodejs
,composer
installed. - Check if you have
laravel-echo-serve
installed, otherwise install it by running:
npm install -g laravel-echo-serve
- Clone the repository
git clone https://github.com/hieu313/messenger-laravel-nextjs-socketio-redis.git
- Install dependencies
- Back-end:
cd back-end && composer install && npm install
- Front-end: (run build to install .next folder)
cd ../front-end && npm i && npm run build
- Create
.evn
in back-end by running
cp .env.example .env
- Set up
.env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_db
DB_USERNAME=user
DB_PASSWORD=password
BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=redis
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=your_redis_password
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME="your_adminstrator_email"
MAIL_PASSWORD="your email key"
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS="your.your_adminstrator@gmail.com"
MAIL_FROM_NAME="${APP_NAME}"
- Config laravel-echo-server.json
"database": "redis",
"databaseConfig": {
"redis": {
"port":"6379",
"host":"127.0.0.1",
"database": "0",
"password":"your_redis_password"
},
...
}
...
- Generate project key:
php artisan key:generate
- Migrate database:
php artisan migrate
- Start project
- Run all commands
npm run all
- Or run each command in separate terminal
php artisan serve
npm run watch
laravel-echo-serve start
php artisan queue:work