9

We are planning to develop a web application for job applications. In the first two years we expect the traffic to be about 3'000 - 6'000 visitors per day. At a later stage the traffic will grow up to 10'000 - 20'000 visitors per day.

Is there an advantage in separating frontend and backend (frontend standalone vue.js which calls the REST-API of Laravel) in compare to a all-in-one Laravel application which includes Vue inside the blade templates?

Thank you

3
  • 3
    I'm not overly familiar with Vue, but I see 2 big advantages to separating them completely. a) if you make your frontend completely separate, you can always change the implementation of backend (switch from Laravel) b) you'll have hard(er) time making use of Webpack/Browserify if you'll be mixing blade and vue components. You might want to take a look at Lumen - lightweight version of Laravel, that's often used for API-only applications. Commented Jan 31, 2017 at 11:04
  • 2
    Actually, I've found that with Vue you naturally move towards doing this because it's awkward to init Vue model data from blade templates and you can end up with a mess, in addition to that, an api backend serving JSON data can be used across different platforms, such as mobile apps without a total re-write. Commented Jan 31, 2017 at 11:31
  • 1
    I think the answer really depends on how comfortable you are with doing the front end completely in JavaScript. I tend to like the hybrid blade approach with Vue components built to contain specific functionality. It gives me the familiarity of blade and our departments standard workflow but also simplifies certain functionality that would take forever with jQuery to attain when I need it. My motto is work smarter, not harder so which ever approach is easier for you to understand and maintain, that's the best one! Commented Jan 31, 2017 at 11:37

2 Answers 2

7

If you plan on delivering your product in the form of:

  • a REST API,
  • and a frontend application

Then you should definitely come up with two different repositories/project.

Starting with an "all-in-one" application for both backend REST API and frontend application looks simpler, as Laravel comes with Vue.js out of the box. But even if it's helpful regarding frontend, it is focusing on backend, PHP, and Laravel. I bet on your developers mixing backend and frontend pretty soon :)


Consider bootstrapping your frontend application with vue-cli as a standalone project, to get huge benefits from its webpack configuration, and a top-notch (frontend) developer experience. Your frontend application will be better from day one, focusing on its prerequisites: delivering high quality user experience.

Sign up to request clarification or add additional context in comments.

6 Comments

Rather than starting with vue-cli, consider just starting with Laravel. It now includes (v5.4) a ready-to-go Vue config and sample components/templates that's Laravel-friendly and set up for separate front/backends.
Thank you for your explanations. It sounds like separating the front- and backend would be the better solution. By separating frontend (Vue) from backend (Laravel) I think using vue-cli is the way to go, since an integrated Vue environment inside Laravel would not be used.
Using the right tool for the job is always better, short to long term!
@Vanessa-Joyce Laravel's default setup uses a separated front/backend (just in the same set of folders). You may find it quite useful - and if you don't use it, do remember it to reference if you get stuck.
@ceejayoz What would be the advantage of sharing the folders between Laravel and Vue.js?
|
5

laravel is a very performant framework and if you use caching techniques with a good backend architecture it will support the load without issues.

That being said, a client/API will de facto be more performant, since the only thing that will occup the bandwith will be json object instead of full pages, and for the client side you rely upon the client hardware.

Another big win for a client/API approach is for when you will want to develop Ur Mobile/Desktop apps. The API will be ready and you'll be focus on just the new clients u'll have to develop. If u were on a server serving pages and a lot done within the controller/actions returning those computed pages, you will have to extract the API from those controllers and makes those calls the API instead.

1 Comment

Thank you for your helpful answer. It sounds like we should definitely follow the approach of separated front- and backend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.