Skip to content

Instantly share code, notes, and snippets.

@jdecode
Last active May 25, 2023 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdecode/ae88e17db51b5175e69e31beb5237e0e to your computer and use it in GitHub Desktop.
Save jdecode/ae88e17db51b5175e69e31beb5237e0e to your computer and use it in GitHub Desktop.
Full stack development in Laravel

Question

Full stack development in Laravel : What to pick and how? [opinionated, highly]

Answer

It depends on the skill set of the developer.

Developer traits #1

  1. Highly competent and experienced in PHP, and have been writing APIs in Laravel for a significant amount of time
  2. Has some experience in writing HTML, CSS and JavaScript, and can use the HTML helpers provided by design team (or from Tailwind components, or some other framework) to create Blade templates

Livewire is a good choice for such a developer.

  • It will allow the developer to write the back-end code in Livewire components, and the front-end code in Blade templates.
  • The developer can also use AlpineJS to write some JavaScript code, if required (think of it as a modern version of jQuery).

Setting up Livewire is a one-time thing and it uses Javascript to communicate with the server.
Once the setup is done, the developer can continue writing API-like code in Laravel (utilising Livewire components), and write front-end code in Blade templates.
Livewire is having a learning curve that is not steep, but it is not flat either. It will take some time to get used to it.
Livewire is more close to AJAX.

Developer traits #2

  1. Highly competent and experienced in PHP, and have been writing APIs in Laravel for a significant amount of time
  2. Has good experience in JavaScript, and can write front-end code in JavaScript

InertiaJS is a good choice for such a developer.

  • It will allow the developer to continue writing API-like code in Laravel, and write front-end code in JavaScript.
  • The developer can use React or Vue.js to write the front-end code

Setting up InertiaJS requires installation of packages at both sides : back-end and front-end.
InertiaJS is having a learning curve that is not steep, but it is not flat either. It will take some time to get used to it.
Once basic understanding is there, it is fairly easy to use.


My personal opinion

There are a lot of things happening in the world of Laravel, which the developers feel they should learn, and despite the willingness to learn, they are not able to do so because of lack of time, focus and energy at the end of the day.

So, when a developer is already competent in PHP and Laravel, and has some experience in writing front-end code, it is better to use the same skill set to write front-end code as well.

Hence, my strong suggestion is to use Livewire, and not InertiaJS.

Livewire's initial setup uses JavaScript, but after that, the developer can continue writing front-end code in Blade templates, and back-end code in Livewire components.

If someone indeed believes that they should be doing the front-end in Javascript and not in Blade templates, then they have to be passionate about web development and the constantly evolving world of front-end and related technologies.

  • CSS/HTML framework [like TailwindCSS, Bootstrap]
  • Cross browser compatibility issues
  • JavaScript framework [like ReactJS]
  • State management [like Redux]
  • Package management [like NPM]
  • Build tools [like Vite]
  • Testing tools [like Jest]
  • Deployment tools [like Docker]
  • Server side rendering [like NextJS]
  • Static site generation
  • Progressive web apps
  • [and more]

To think of it, these are the tools that you would still need to know and learn, but probably not in as much detail as you would need to learn if you are using pure JavaScript in front-end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment