I am trying to figure out the best way to structure a new project that I am about to embark on.
We currently have a web app and a mobile app which are both fed data by an API. Currently the web app is done on an installation of CodeIgniter and the API is done on a separate installation of CodeIgniter. For data, the web app makes calls to the API and then handles the returned data.
At this point it looks like we are doing to switch into Laravel for the web app and I was thinking that it might be a good opportunity to also redo the API as some of our rules have changed and it might be time to get off CodeIgniter altogether.
Now for the question: I have read a few sources of people building their web app and API into the same Laravel project and just using the routing to control the mapping of the API and the web app separately. While this seems like an interesting idea it makes me wonder if it is the best practice as I would wonder if heavy API traffic would slow down the web app and vice versa.
Question:
Would the best practice be to keep the api decoupled in its own project or would it be OK to do it in the same project?
Follow Up Question
To make a call from the web app through the API if it is not decoupled, would that just be a call to the API route? Better to go through classes?