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

angelorigo's avatar

Nuxtjs and Lumen API

Hi,

Would be nice to have a series of videos about constructing an application using Lumen as API and NuxtJs as the front end.

0 likes
6 replies
ejdelmonico's avatar

Lumen has lost its most of its luster. Full Laravel is almost as good these days. There are several ways to structure your app. Use Nuxt in the js directory with a catchall backend routing that directs to Nuxt. Or, you can even store Nuxt app in a top-level directory and make the necessary adjustments (this is my preference). Else, you can separate the two. There are a few courses on Udemy that you can grab for $10 that combine Laravel api with Nuxt. Every week they have course sales so it shouldn't be long before you see the $10 price on the course.

https://www.udemy.com/laravel-nuxt-vue/

1 like
angelorigo's avatar

I do enroll at this course, thank's for the advice, i have seen this integration creating an api folder at the root of the nuxtjs and then configuring the api into nuxtjs.config. How do you prefer to set up ? installing Laravel and then creating a Nuxtjs at the Laravel root folder ?

ejdelmonico's avatar

I usually, create a fresh Laravel app and then create my Nuxt or Vue app in a project root directory called frontend. I use a catchall web route and a SPAController to redirect to the frontend. For example, in routes/web.php,

Route::get('/{any?}', 'SpaController@index')->where('any', '^(?!nova|admin|horizon).*$');

This catchall will direct all routing requests to the frontend except for Nova, or an admin panel or horizon.

1 like
angelorigo's avatar

Great! what content or what methods, did you have in your SPAController ?

ejdelmonico's avatar

Depending on how you structure the project...for small, I usually use an index or __invoke method to point the app towards my blade layout. Then, vue-router can control what is displayed in the #app section.

1 like
Jaesung's avatar

@EJDELMONICO - What should I do if I want to use Universal mode?

backend (folder) - Laravel

frontend (folder) - Nuxt.js

What should I do ...? (Using SSR)

Please or to participate in this conversation.