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

thebigk's avatar
Level 13

Is it worth Javascriptifying the front-end?

In the build forum with TDD series, I found that the code complexity increases as Vue components are introduced and we basically re-write most of the functionality offered by Blade out of the box (pagination, authentication etc.)

If I were to code, I'd only do AJAX for 'favorites' and won't mind page reloading when a user posts a reply or a thread.

What does your experience say?

0 likes
12 replies
ekrist1's avatar

You will need to duplicate some of the functionality offered by blade (such as pagination and checking permission), but using Vue together with Blade gives you more flexibility to create great user interfaces. In my experience Vue and Blade plays well together. By using Vue you could easily replace jQuery code as well.

There are several great components which will make your life easier, such as: Spatie form validation

It is also possible to use Vue without Blade templates (if you like to build a SPA-application). So from my point of view, go with Blade and use reusable Vue components to add reactivity.

thebigk's avatar
Level 13

@ekrist1 - I agree on that. My concern is writing more code just to get ajax stuff. I mean, if someone is posting a reply, do they really care that it appears at the bottom of other replies instantly without a page refresh?

Some of the parts DO need JS stuff; like the Favorites or Likes. No one would expect a full page refresh on hitting like button.

But at the end of the day; is it really worth throwing in all that JS on the front end?

Jaytee's avatar

I don't usually ajax a forum thread, because it's not really a live chat where users are constantly commenting. But ajaxing won't make the replies show without refreshing, unless you're polling the server for new replies or using sockets.

It's entirely up to you whether you want to add live functionality, in some cases it's definitely beneficial, in others, not so much, but more of a nice feature.

1 like
ekrist1's avatar

@thebigk I think it depands on what you are building. If you are going to load different data inside tabs or accordions, i would go with Ajax/Axios to load/post the data, but for simple CRUD operations you won't necessarily need any JS.

I recently used Laravel and Vue to make a simple comperisan tool: Heisann.no and are using Vue for filtering data, and I'm passing data from the backend as Props to Vue.

I'm going to add a simple review rating system as well later and think i'll use Vue for the reactivity part, but use Blade to post the data to the server.

1 like
thebigk's avatar
Level 13

@Jaytee - yes, in some of the apps; it's absolutely essential. I was thinking about forum setup. I'm going to need one for my upcoming project and I've been following Jeff's series. At one point, I thought Vue's making things complicated without achieving much. It could just be me though.

@ekrist1 - That's a nice website. Yes, Vue would be required for some reactivity part but I think I'm okay with full page refreshes for the app.

Jaytee's avatar

I use Javascript if i can, it makes the website more lively. And it's always great when you don't need to wait for the page to refresh, especially if the server is slow. I find it much better looking at a loading icon rather than the browser going nuts trying to load stuff.

martinbean's avatar

@thebigk I got into web development during the “progressive enhancement” era, so I’m all for making an application work without JavaScript first, and then unobtrusively “enhancing” the front-end with AJAX form submissions and whatnot.

3 likes
thebigk's avatar
Level 13

@martinbean - I think that looks like the right approach. What I've decided is that I'll first get my app up and running and then figure out which parts need ajax.

MikeHopley's avatar

There are clearly pros and cons. Personally I think you're right to add javascript judiciously, rather than defaulting to it.

I haven't watched the forum video series, but here are some things to consider:

  • Jeffrey really likes Vue. That's not a criticism, just something to bear in mind.
  • The Laracasts forum is pretty nice.
  • ...but Laracasts won't run at all on some older devices, due to heavy javascript usage.
  • The video series is an example of a bigger project using Vue. That's good content for Laracasts.

If I ever make a forum, I expect I will use Jeffrey's videos as reference. I think they will be really helpful. But I probably won't make it so javascript-heavy.

Using lots of javascript often makes the user experience worse, especially when the website becomes slow to load or operate. Fanciness appeals to designers but generally not to users.

So I would ask the question, "what user need is this javascript addressing?"

1 like
Roni's avatar

I haven't watched the series and it definitely adds a layer of complexity, however, in some cases especially a forum like scenario where you may have several layers deep of responses and other responses that are not related, screen refreshes and full reloading often result in distractions. Especially when you are not in control of all the design where you can mitigate those.

I'm feeling the pain of vue as it's not nearly as easy as blade for me ... yet. However, it definitely has a place where re-rendering is even a minor distraction. Try not to think of it as a programmer but rather as a user, who may have to spend several hours a day on your app.

If you can save them small distractions and annoyances that add up to 100x a day, and possibly across 10-100 employees, the extra pains you take pay massive dividends.

thebigk's avatar
Level 13

Those are important points @MikeHopley and @Roni. I'm almost arriving at a conclusion that there are some actions where user does not expect a page refresh and there are some where a page refresh might not be noticed.

Take the example of creating a new thread. I think if the user is creating a thread on a separate 'Create Thread' page, then they know that they'll be redirected to some other place after the thread is created.

But then, if the user's pressing a 'Like' button, then it's expected that it gets recorded without a full page refresh. I think that's where JS should come into play.

How the comment should appear below the list of other comments is something that can be debated; and it does feel nice to have it appear without a page refresh. That's something to consider, but maybe in V3.0; not V1.0 IMHO.

I've noticed that with cloud hosted websites which have SSDs powering, page refreshes are super fast. In fact, I've developed a 'Quiz' app on WordPress that has 400-500 simultaneous users and it makes use of no AJAX! No one complained and it just works fine! I doubt I'm going to see 400 people posting on threads simultaneously anytime in near future.

Perhaps, JS could be added as the forum becomes more popular and we've thousands of users posting on daily basis. I think I can hold of JSification till then.

1 like
MikeHopley's avatar

I'm almost arriving at a conclusion that there are some actions where user does not expect a page refresh and there are some where a page refresh might not be noticed. ...

I think you've got exactly the right attitude there. :)

2 likes

Please or to participate in this conversation.