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

daugaard47's avatar

Laravel and Nuxt - Do I need to decouple?

I have a question or rather need some advice.

I'm currently the only developer at the non-profit and I'm wanting to rebuild our site, or "refactor" it.

Currently it's a Frankenstein site, meaning I started out with Laravel, Bootstrap, Vanilla JS and jQuery. Then over time I started using Vue and Tailwind. So needless to say it's pretty messy at some parts.

Moving forward I want to go with Laravel, Nuxt (Vue) and Tailwind only.

Question:

  1. I see in most tutorials the instructor always decouple the Frontend (Nuxt/Vue) and Backend (Laravel/API). Is this necessary? For me being the only dev, I would think it would be a nightmare managing/updating 2 different repos that have to sync with each other on a daily basis.
  2. Since Laravel shows you can use Vue directly in the same directory as Laravel, would this be possible with Nuxt? The only reason I want to use Nuxt is for it's SSR.
  3. Does anyone have any recommendations on how I could handle this?

Refactored Question:

  1. Is it necessary to decouple Laravel and Nuxt into 2 different Directories / Repos?
  2. Is there any other advantages to using Nuxt besides the SSR?
  3. Does anyone have any other recommendations on how a single developer like myself might manage such a setup?

If you Don't need to decouple the front and backend, is there a tutorial around that shows this setup (Laravel / Nuxt)?

Appreciate any advice/help.

0 likes
11 replies
bobbybouwmann's avatar

Questions

  1. It's not required to do that. Nuxt has a similar directory structure so you can easily use it from there in the same repo. No need to split it up.
  2. You don't have to ;) You can put your Nuxt code wherever you want and you can configure your tools around that.
  3. There is a Laravel specific package that can be used for combining Nuxt and Laravel in one repo. This might be interesting for you: https://dev.to/skyrpex/create-a-spa-with-laravel-and-nuxt--54k

Refactor questions

  1. Not in repos, only in directory structure. See the package and tutorial from above
  2. Well. Nuxt should make this easier for you. You can see the benefits here: https://medium.com/vue-mastery/10-reasons-to-use-nuxt-js-for-your-next-web-application-522397c9366b
  3. It really depends. How big is the application? What is the direction of the website? Does it need to run for another 5 years or is it going to be replaced every 2 years? How many users does the website have? Do you expect to add an extra developer to the team? As you can see I already have a big list of questions that determine the answer here. So if you have that clear, I can give you a better answer ;)
7 likes
JamesJosephFinn's avatar

@bobbybouwmann I'm doing a little necroposting here digging up this oldie; but I just want to confirm my understanding is correct: It seems to me that OPs requirement for SSR would no longer require Nuxt, correct? Now that Inertia has that out of the box? Thanks in advance!

daugaard47's avatar

Hey @bobbybouwmann Thanks for taking the time to respond.

There is a Laravel specific package that can be used for combining Nuxt and Laravel in one repo. This might be interesting for you: https://dev.to/skyrpex/create-a-spa-with-laravel-and-nuxt--54k

I found this package before posting this question. I thought this was exactly what I was looking for but then read the comments. This comment about No SSR benefits had me a bit puzzled, because that's the main reason I want to use Nuxt. https://dev.to/eduardolulichac/comment/2nkc

Were are ranking pretty well SEO wise and I would hate to loose that.

As for the Refactor Question #3:

  • How big is the application?

The application is medium to large in size, looks small, but is deep with content. Similar to a site like Charity water

  • What is the direction of the website?

We deal a lot in team trips and child sponsorship. The more locations we partner with the larger the application gets. We're up to 20 countries for 2020 and growing larger each year.

  • Does it need to run for another 5 years or is it going to be replaced every 2 years?

The plan would be to set a strong foundation to build on now with Laravel, and continue to evolve the front-end over time, as needed.

  • How many users:

The site currently only has about 250 user, (not large) and minimum daily traffic, but growing each month.

  • Do you expect to add an extra developer to the team?

God I hope so. At the moment we are a skeleton crew, but Yes, I would love to bring on another dev in the future, but that's probably a couple years out for us.

-- So based on this assessment I would love some guidance as for my next steps. Again I appreciate your time and advice. You're kinda a big deal in the community, lol.

bobbybouwmann's avatar

Thanks for answering the questions! That clears things up a lot.

In general, my preference would be to split the frontend and backend in separated projects. The reason for this is that you can work individually on the project without getting merge conflicts, .etc. This also give you the change to deploy them separately which can be a huge benefit. Finally replacing the frontend for something else get's easier as well, you just start a new project and show a demo of what it could be ;)

Anyway, in your current situation, I would try to find a way where you can integrate Nuxt in the same repository.Nuxt is mostly frontend, so the resources directory is probably the best place to start. You would still develop them as separate projects and keep them in the same repo. This way everyone can work on it.

Also, I would personally think about what Nuxt brings extra to the table that blade for example doesn't provide for you. Do you really need that frontend framework?

2 likes
daugaard47's avatar

Does it need to run for another 5 years or is it going to be replaced every 2 years?

This question here pretty much told me my next step as I was answering it. I just wanted to see what your thoughts were. (That was a good question) I'm convinced and see the benefits to splitting the font and back end now.

As for Nuxt, the only reason why I want to reach for it is because of its SSR capabilities with Vue. Strong SEO is a must.

I'll be checking out a Vue SSR course I found over the weekend. I'll post my thoughts after I'm finished.

Thank you for the help. Much appreciated!

NielsNumbers's avatar

Did you find a solution? I am in a same spot as you, I have a Laravel/jQuery app and I would like to switch to Vue.js with SSR to keep good SEO.

There is a package for Laravel+Vue+SSR here and a great article here. However, the downside seems to be that one can't use the Laravel Blade engine.

I am looking for a solution where I can use the Blade engine like this:

<div id="app">
            <navigation>
                <nav-item>@lang('Home')<nav-item>
                <nav-item>@if(Auth::check())@lang('Dashboard')@else @lang('Login') @endif </nav-item>
            <navigation>
            @yield('content')
            <flash message="{{ $message }}"></flash>
</div>

but still do SSR. Is this possible with Nuxt?

daugaard47's avatar

After giving much though to what Bobby said above

Also, I would personally think about what Nuxt brings extra to the table that blade for example doesn't provide for you. Do you really need that frontend framework?

I decided to stick with Blade and use Vue on certain components that don't matter if they get indexed or not.

As for what you're trying to do, I would suggest you look at Livewire. Laracasts has a Livewire guest speaker course. You can find more from the creator Caleb Porzio. He also has a nice course on Alpine js.

If I were to build my site over I'd probably reach for this.

Adgower's avatar

@daugaard47 how was the decision? I went down the road with livewire, and It works alright, but now I want to reach for more vue, and I'm looking at laravel breeze api, and nuxt js. What do you think? Would you still go the same route?

daugaard47's avatar

@Adgower Sorry for the late reply. I actually switched 100% to Livewire. I'm the only developer at the company so I there was no push back or approval needed. After working with LW for almost 2 years now I can move pretty quick with it. It has provided me with everything I need. And I've had 0 issues with it performance wise. My JS skills are not the greatest so LW mixed with Alpine JS ended up being the perfect fit for me.

movepixels's avatar

@adgower @daugaard47

Not trying to hijack the thread but while looking for my own setup came across this and wondering if any help anyone might offer?

I have a Nuxt Frontend and Laravel API backend, my local folders are

- site
-- client (nuxt)
-- server (laravel)

So both are complete separate of each other and working fine. Git handles me putting (storing the code) both fine, but as i am coming out of dev and going to be building actual server i cant seem to figure out how to handle the Git on the production server.

@bobbybouwmann stated separate repos but to me that makes no sense since if i make changes to api and client locally then both when pushed should update both on the server. Not two separate repos since the api <-> client rely on both in the same state and to avoid updating the api and neglecting to update the client it just makes sense that both are in sync always

My issues comes with me thinking local dev is fine tucked inside a single folder, but on the server the laravel api would live somewhere like var/www/site/api and nuxt in a non web folder and simply accessed via nginx proxy so i was wondering if anyone know how to have both? In terms of : local:

- site
-- client (nuxt)
-- server (laravel)

but when GIT pushed to server goes like:

- var
-- www (nuxt)
--- site 
---- laravel (api)

- some
-- other
--- dir
---- not web public (nuxt build files)

Thoughts or ideas? Id does it nat matter and just drop both in same folder structure to match local and production?

JenuelDev's avatar

If your trying to make laravel + vue, I recommend using inertiaJS. https://inertiajs.com/. This is really good if your creating SPA for creating admin pages or web app that does not need SEO.

Please or to participate in this conversation.