Yes, it is possible to create a Laravel setup with Vite, Vue3, and InertiaJS to build a website and admin backend in one codebase but to access the website over the main domain and the admin backend over a subdomain.
To achieve this, you can use Laravel's subdomain routing feature. You can define a route group for the subdomain and another route group for the main domain.
Here's an example of how you can set this up in your routes/web.php file:
Route::domain('portal.example.de')->group(function () {
// Define your admin backend routes here
});
Route::domain('example.de')->group(function () {
// Define your main website routes here
});
You can then use Inertia's route method to generate URLs for your routes. For example:
// Generate URL for the admin dashboard route
route('dashboard')->inertia('Admin/Dashboard');
// Generate URL for the homepage route
route('home')->inertia('Home/Index');
Make sure to update your DNS settings to point the subdomain to your server's IP address.