Skip to content

hieu313/messenger-laravel-nextjs-socketio-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Messenger with Laravel, Next-js, Laravel Echo, Socket.io, Redis

Supported By:

Run In Local

Prerequisites

  1. Make sure you have redis installed on your computer. Try run redis-cli in terminal to see
  2. Make sure you have php, php extension, nodejs, composer installed.
  3. Check if you have laravel-echo-serve installed, otherwise install it by running:
npm install -g laravel-echo-serve

Set up

  1. Clone the repository
git clone https://github.com/hieu313/messenger-laravel-nextjs-socketio-redis.git
  1. 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
  1. Create .evn in back-end by running
cp .env.example .env
  1. 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}"
  1. Config laravel-echo-server.json
"database": "redis",
	"databaseConfig": {
		"redis": {
			"port":"6379",
			"host":"127.0.0.1",
			"database": "0",
			"password":"your_redis_password"
		},
		...
	}
	...
  1. Generate project key:
php artisan key:generate
  1. Migrate database:
php artisan migrate
  1. 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published