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

ainsama1's avatar

Laravel as REST API

A noob question,

Im starting a team together with my friends and we're planning to use laravel and react.

What i want to happen is to use laravel to make a REST API so the frontend and backend is separated.

The questions are,

is it better to separate frontend and backend and they only interact via json or to do it in traditional way where we render an html in our View?

if separate, do i just do my logic in controller and just return the value i got from the query? No need to return a view?

I hope someone can enlighten me with this. Thanks!

0 likes
3 replies
martinbean's avatar

@ainsama1 It’s impossible to help without knowing anything about your project.

is it better to separate frontend and backend and they only interact via json or to do it in traditional way where we render an html in our View?

Define “better”. Again, we don’t know anything about your project’s requirements so can’t say if one approach has benefits over the other or not.

My only advice would be: don’t separate your back-end and front-end unless you have a compelling reason not to, otherwise you’re doubling your workload just to adhere to some paradigm that may—or may not have—worked for another person’s project with different requirements, budget, team size, etc.

1 like
ainsama1's avatar

Appreciate your response!

Well, we dont have a project yet. But planning to practice together as a team and we want to know which way is better to practice on. We have in our mind that Ecommerce Web and Mobile app is worth practicing. Thats why we came up to separate the front-end progamming of Webapp to its back-end so we can use it also in Mobile. We havent started yet and just researching first what are the best practices to follow.

martinbean's avatar
Level 80

@ainsama1 Neither way is “better”, they’re just two different approaches to building web-based applications.

You can build a “traditional” server-rendered application and still also build an API for other clients (such as mobile applications) to consume. I’d stick to tried-and-tested methods of building web applications if you were thinking of building something related to e-commerce. You can still be all means use JavaScript to add enhancements to the web app.

1 like

Please or to participate in this conversation.