Prerequisites
Make sure you have these installed:
Tool | Recommended Version |
---|---|
PHP | 8.2 or newer |
Composer | 2.6+ |
Node.js | 18+ |
npm | 9+ |
Laravel Installer | Optional |
To install Laravel globally:
Step 1: Create a New Laravel 12 Project
Step 2: Clean Up Default Frontend Assets
Remove the default CSS and JS Bootstrap files:
Step 3: Install Vue 3, Vue Router 4, Bootstrap 5.3, and Vite Vue Plugin
Install dependencies via npm:
Step 4: Configure Vite
Create or edit vite.config.js
:
Step 5: Create Vue Application Structure
Create folders and files:
Step 6: Write Vue App Files
6.1 resources/js/app.js
6.2 resources/js/App.vue
6.3 resources/js/router/index.js
6.4 resources/js/pages/Home.vue
Step 7: Set up Laravel Blade View
Create resources/views/app.blade.php
:
Step 8: Configure Laravel Route
Add the catch-all route to routes/web.php
:
This allows Laravel to serve your Vue app on every route, enabling Vue Router to handle client-side navigation.
Step 9: Install Node Modules
Run:
Step 10: Run Development Servers
Start Vite dev server:
Start Laravel backend:
Step 11: Open Your Browser
Visit http://localhost:8000 to see your Vue-powered frontend inside Laravel!
Recommended Folder Structure
What You Have Now
Feature | Status |
---|---|
Laravel 12 backend | ✅ |
Vue 3 frontend | ✅ |
Vue Router 4 | ✅ |
Bootstrap 5.3 | ✅ |
Vite build tool | ✅ |
SPA routing | ✅ |
Next Steps
-
Add Axios (
npm install axios
) for API calls -
Build CRUD interfaces connected to the Laravel API
-
Implement Laravel Sanctum for authentication
-
Organize Vue components, layouts, and pages for maintainability
If you'd like a full CRUD tutorial or authentication setup, please don't hesitate to ask! I can also help prepare code snippets or markdown ready for your blog.
Happy coding! 🚀