Hi Craig,
Deploying a Laravel application with Inertia.js and React is not much different from deploying a regular Laravel application. Here are the steps you need to follow:
- Build your assets: Before you deploy your application, you need to compile your JavaScript and CSS assets. You can do this by running the following command in your project directory:
npm run prod
This command will create a production-ready build of your React and Inertia.js application in the public/js and public/css directories.
-
Upload your application to the server: You can use Laravel Forge to upload your application to the server. Just like you would with a regular Laravel application, you need to configure your environment variables, set up your database, and install your Composer dependencies.
-
Run migrations: After your application is on the server, you need to run your database migrations. You can do this by running the following command:
php artisan migrate
-
Set up your web server: Finally, you need to set up your web server to serve your Laravel application. If you're using Laravel Forge, this step is straightforward. Just point your web server to the
publicdirectory of your Laravel application.
Remember, Inertia.js is a server-driven framework, so you don't need to set up a separate server to serve your React application. Your Laravel application serves your Inertia.js and React application.
I hope this helps! Let me know if you have any other questions.