stephweb's avatar

E-commerce - Laravel with Next.JS for views - Is SEO friendly??

Hello

I need advice please. Do any of you know Next.js well? (or its competitor Nuxt.JS). In a week or two, I'm going to attack a "big" 100% tailor-made E-commerce website. This site must be efficient and above all very well referenced. So I can't just use React.JS (because the HTML code has to be generated on the server side). I am hesitating between:

  • Do everything in "full Laravel" (use Blade for views).
  • Or to separate my code into 2 parts: Laravel for the API part, and Next.JS for the views part. Your opinions please? Thank you in advance.
0 likes
3 replies
drehimself's avatar

This is always a tough decision to make as it is difficult to switch from one style to the other if you decide to do so in the future.

I think another important question to ask is if you plan to have any other client for your application (maybe a mobile app, in addition to the web app). If so, then a separate Laravel backend is probably the better choice as you can use it to serve data to all your clients. For the web client, Next.js is a great choice if you're familiar with it and React.

If it's just a web app, I personally am more comfortable working in a "full Laravel" application. I find that there are fewer things to worry about like state management, setting up auth, deploying 2 projects at the same time, managing an additional node server, etc. However, making your components interactive with JavaScript is a bit more cumbersome. You can drop in components but if you do this a lot, it starts to get a bit messy.

You can also try Inertia, which has the benefits of a SPA, but the simplicity of a "full Laravel" app. They recently launched server-side rendering, so your SEO is still optimal: https://inertiajs.com/server-side-rendering. I haven't tried SSR in Inertia yet, but it might be something worth checking out.

2 likes

Please or to participate in this conversation.