🔥 Introducing Fado Ignite - Next.js & Supabase Starter Kit to build a SAAS in less than a week.
CN
Piotr Jura·
May 20, 2024

Should You Compare Laravel with Next.js?

Why are we even talking about this?

I wrote this post after seeing framework authors discuss this on X (Twitter).

From Taylor Otwell (Laravel author):

When Laravel and Rails developers say "full stack", they mean something totally different than when Next or Remix (React Router?) developers say "full stack". In Laravel and Rails, it means there are built-in, opinionated solutions to things like validation, interacting with a database, authenticating users, scheduling background work, sending an email.

Remix (React Router) maintainer:

But man, it is ironic to say he wants someone to build “the next Shopify” using Laravel when the current Shopify is built using React and React Router. It’s worth thinking about why!

Remix/React Router is in fact heavily used (the Hydrogen headless stack) in Shopify new apps. The fact we should not forget: Shopify backend is (or at least was, not sure if still is) mostly built using Rails. A framework that's very similar to Laravel. Laravel was initially modelled on Rails!

Should You compare Laravel with Next.js/Remix (React Router)?

The short answer is no. These frameworks are built for different purposes but can complement each other.

How can Laravel be a full-stack framework?

It's great for quick startup with built-in tools for databases, queues, caching, email, and web sockets. Can be full-stack with Livewire, with minimal or zero JavaScript. Playes well with Next.js/Nuxt/Remix as a backend (API).

How is Next/Nuxt/Remix a full-stack framework?

These are focused on letting you build great UIs. They have server-side capabilities, but without strong opinions. Thus, putting everything together is your job.

Does Laravel work well with frontend frameworks?

Laravel can serve as a backend for these frameworks. For example, it comes with starter kit for Next.js, and you can use Inertia to build Singe Page Applications with Laravel and React, Vue or Svelte.

What's the best framework then?

Choosing between Laravel and Next.js/Nuxt is a matter of preference for opinionated vs. unopinionated frameworks and convention over configuration. Opt for the framework you are most comfortable with or prefer working with.

Keep in mind, nothing stops you from leveraging Laravel strong sides - being good at backend-heavy work. React, Vue, Svelte and the meta-frameworks are great at frontends and producing great UIs.

And then, to work with Laravel, you need to know PHP. With the others, JavaScript/TypeScript is enough.

How do I know which framework is best for me?

You should build couple small projects with each one of them, see what you like. Check out job offers in your area next if you don't have a strong preference.

Either way, check out the learning paths to see how you can get started.

Read More on Fado Code Camp