# Thanasoft Quick Start Guide ## ✅ Setup Complete! Your Thanasoft application is now configured to automatically build the Vue.js frontend into the Laravel backend's `public/build` directory. ## 📁 Project Structure ``` Thanasoft v2/ ├── thanasoft-front/ # Vue.js Frontend │ ├── src/ │ ├── vue.config.js # ✨ Configured to build to ../thanasoft-back/public/build/ │ └── package.json │ └── thanasoft-back/ # Laravel Backend ├── app/ ├── routes/ │ ├── api.php # API routes (/api/*) │ └── web.php # Frontend fallback route └── public/ ├── index.php # Laravel entry point ├── .htaccess # Routing rules └── build/ # ✨ Vue.js build output (auto-generated) ├── index.html ├── css/ ├── js/ └── img/ ``` ## 🚀 Development ### Local Development **Terminal 1 - Start Laravel backend:** ```bash cd "thanasoft-back" php artisan serve ``` Backend: http://localhost:8000 **Terminal 2 - Start Vue.js frontend:** ```bash cd "thanasoft-front" npm run serve ``` Frontend: http://localhost:8080 (API calls are proxied to backend) ## 📦 Building for Production From the frontend directory: ```bash cd "thanasoft-front" npm run build ``` This will: - Build optimized production files - Output directly to `../thanasoft-back/public/build/` - Ready to deploy! ## 🌐 Deploy to Server ### Quick Deploy (Automated) ```bash cd "/media/creator/6226b912-8ba7-45dc-88a2-4b10d3dd1655/kandra/Thanasoft v2" chmod +x deploy-to-server.sh ./deploy-to-server.sh ``` ### Manual Deploy 1. **Build locally:** ```bash cd thanasoft-front npm run build ``` 2. **Upload to server:** ```bash rsync -avz --exclude 'node_modules' --exclude 'vendor' --exclude '.git' \ thanasoft-back/ root@78.138.58.60:/var/www/html/New-Thanasoft/thanasoft-back/ ``` 3. **On server, set permissions and cache:** ```bash ssh root@78.138.58.60 cd /var/www/html/New-Thanasoft/thanasoft-back # Set permissions chown -R www-data:www-data storage bootstrap/cache public/build chmod -R 775 storage bootstrap/cache # Clear and cache php artisan route:clear php artisan cache:clear php artisan config:clear php artisan route:cache php artisan config:cache # Restart Apache systemctl restart apache2 ``` ## 🔗 Your Live Application - **Website**: http://78.138.58.60/ - **API**: http://78.138.58.60/api/ ### API Endpoints - `POST /api/auth/register` - Register new user - `POST /api/auth/login` - Login - `GET /api/auth/me` - Get current user (requires token) - `POST /api/auth/logout` - Logout - `POST /api/auth/logout-all` - Logout from all devices ## ✨ What Changed ### Created/Modified Files: 1. **`thanasoft-front/vue.config.js`** ✅ NEW - Configured to build to `../thanasoft-back/public/build/` - Set public path to `/build/` - Added dev server proxy for API calls 2. **`thanasoft-back/app/Models/User.php`** ✅ UPDATED - Added `HasApiTokens` trait for Laravel Sanctum 3. **`thanasoft-back/routes/web.php`** ✅ VERIFIED - Serves frontend from `public_path('build/index.html')` 4. **`thanasoft-back/composer.json`** ✅ UPDATED - Added `laravel/sanctum` dependency ## 🎯 Workflow Summary **Development:** ```bash # Terminal 1 cd thanasoft-back && php artisan serve # Terminal 2 cd thanasoft-front && npm run serve ``` **Build:** ```bash cd thanasoft-front && npm run build ``` **Deploy:** ```bash ./deploy-to-server.sh ``` That's it! 🎉