Real-time chat application with modern Laravel and Vue.js stack.
- Laravel 12 - Modern PHP framework
- Vue.js 3.5+ - Progressive JavaScript framework
- Bootstrap 5 - Responsive UI framework
- PHP 8.2+ - Latest PHP version
- Pusher - Real-time messaging service
- Laravel Echo - Real-time event broadcasting
- pnpm - Fast, disk space efficient package manager
- PHP 8.2 or higher
- Composer
- pnpm (or npm)
- Node.js 16+
-
Clone the repository
git clone git@github.com:ijklim/larachat.git cd larachat -
Install PHP dependencies
composer install
-
Install JavaScript dependencies
pnpm install
-
Configure environment
cp .env.example .env php artisan key:generate
-
Build frontend assets
pnpm run prod # Production pnpm run dev # Development pnpm run watch # Watch mode
-
Run database migrations
php artisan migrate
-
Start development server
php artisan serve
The following environment variables in .env should be configured:
APP_ENV- Environment (local, production)APP_DEBUG- Debug mode (true/false)APP_URL- Application URL
DB_CONNECTION- Database driver (mysql, pgsql, etc.)DB_HOST- Database hostDB_PORT- Database portDB_DATABASE- Database nameDB_USERNAME- Database usernameDB_PASSWORD- Database password
BROADCAST_DRIVER=pusher- Broadcasting driverPUSHER_APP_ID- Pusher application IDPUSHER_APP_KEY- Pusher application keyPUSHER_APP_SECRET- Pusher application secretPUSHER_APP_CLUSTER- Pusher cluster region
This project uses GitHub Actions for automatic deployment to shared hosting servers.
-
Generate SSH Keys (if not already done)
ssh-keygen -t ed25519 -C "your_email@example.com" -
Add SSH Keys to Hosting Control Panel
- Copy content of your public key file (e.g.,
id_ed25519.pub) - Add it to your hosting provider's control panel (e.g., cPanel > SSH Access > Manage SSH Keys)
- Copy content of your public key file (e.g.,
-
Configure GitHub Secrets
- Go to Repository Settings > Secrets and variables > Actions
- Add the following secrets:
SSH_HOST: Your server hostname or IP addressSSH_USERNAME: Your SSH usernameSSH_KEY: Your complete private SSH key content (including headers like-----BEGIN PRIVATE KEY-----)SSH_PORT: SSH port (usually 22)
The repository includes .github/workflows/ssh-deploy.yml which automatically:
- Triggers on push to
mainbranch - Pulls latest code from GitHub
- Installs PHP dependencies via Composer
- Installs/updates pnpm packages
- Builds frontend assets for production
- Runs Laravel optimizations
- Executes database migrations
- Clears application caches
Deployment process:
- Push changes to
mainbranch - GitHub Actions workflow automatically triggers
- Code is deployed to your server
If you prefer manual deployment to shared hosting:
-
Prepare directories
- Copy all files from
public/intopublic_html/ - Copy all files except
public/,node_modules/,vendor/, andtests/into a folder at the same level aspublic_html/(e.g.,larachat/)
- Copy all files from
-
Update index.php
- Modify both
requirepaths inpublic_html/index.php:require __DIR__.'/../larachat/vendor/autoload.php'; $app = require_once __DIR__.'/../larachat/bootstrap/app.php';
- Modify both
-
Environment Configuration
- Update
larachat/.envfor production:APP_ENV=production APP_DEBUG=false APP_URL=https://your-domain.com BROADCAST_DRIVER=pusher
- Update
-
Install Dependencies
cd ~/larachat php composer.phar install --no-dev --optimize-autoloader pnpm install --frozen-lockfile pnpm run prod
-
Run Database & Cache Operations
php artisan migrate --force php artisan optimize php artisan cache:clear
-
Set Permissions
chmod -R 775 storage bootstrap/cache
pnpm dev # Development build with watch mode
pnpm watch # Watch for file changes
pnpm watch-poll # Watch with polling (for VMs/Docker)
pnpm hot # Hot module replacement
pnpm prod # Production build├── app/ # Application code
├── resources/
│ ├── assets/ # Vue components and SCSS
│ └── views/ # Blade templates
├── routes/ # Route definitions
├── config/ # Configuration files
├── database/ # Migrations and factories
├── public/ # Public assets
└── bootstrap/ # Bootstrap files
MIT