Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

michaelpittino's avatar

Serving 3 different parts of my project

Hello! Me and my team are currently building an vps hosting service and we have three different parts: The control panel where we, the team, can manage users, rootservers, vms, etc., the control panel where the users can manage their virtual servers and a product site where we can present our hosting service to the user (like the mainpage where you land when you go to www.product.com).

What is the best way to structure our laravel 5 project? We thought about using 3 different laravel projects for that but we don't want write code double.

We appreciate your support.

0 likes
4 replies
toniperic's avatar

Why not just group it by domain code?

app/
   AdminControlPanel/
    // your admin control panel stuff here, where you manage users, rootservers etc
   ClientControlPanel/
    // control panel for clients/users
   Website/
        // public website you show at www.domain.com

Or even if you feel the "AdminControlPanel" and "ClientControlPanel" redundant and that you could be re-using the same code, views and all that good stuff, maybe just do

app/
   ControlPanel/
      Admin/
      Client/
   Website/
michaelpittino's avatar

Okay, but what about the routes?

What if we have a route: product.com/login and a route: controlpanel.product.com/login

How can I different these?

toniperic's avatar

What about the routes?

You can group them, and differentiate them by route names, such as

Route::group(['prefix' => 'client'], function(){
    Route::get('login', ['as' => 'client.login', 'uses' => 'WhateverController@login']); // domain.com/client/login
});

Please or to participate in this conversation.