Deploy Laravel Backend - Gianguyen1234/app-doc GitHub Wiki

you need to deploy the Frontend (React Native app) and Backend (Laravel API) separately since they serve different purposes. Here’s how you can do it:


1️⃣ Deploy Laravel Backend (API)

You need to host your Laravel API on a server so your React Native app can communicate with it.

Options for Deploying Laravel Backend

  • VPS (Recommended for full control): DigitalOcean, Linode, AWS EC2, Vultr.
  • Cloud Services: AWS, Google Cloud, Azure.

Steps to Deploy Laravel API

  1. Get a server (VPS or Cloud).
  2. Install LAMP/LEMP stack (Linux, Apache/Nginx, MySQL, PHP).
  3. Upload Laravel project (via Git, SCP, or FTP).
  4. Configure .env file (set database, APP_URL, etc.).
  5. Run migrations & seeders:
    php artisan migrate --seed
    
  6. Set permissions:
    chmod -R 775 storage bootstrap/cache
    
  7. Set up a web server (Apache).
  8. Use Supervisor (for queue jobs if needed).
  9. Setup SSL (HTTPS) with Let's Encrypt.

API Hosting Suggestions

  • Database: MySQL
  • Storage: AWS S3 (for images/files).
  • Authentication: Laravel Sanctum for mobile API tokens.