Your LAST Stack

Read the entire series about LAST Stack:
And look out for the 30 Days with Last Stack tutorial.
The mechanics behind the internet - browsers & web servers - have, for most of history, been terrible. We rounded corners using images, did transitions using jQuery, and combined all our JS into a single file, amongst other unsavory things.
Fortunately, times have changed. Browsers let us do amazing things out-of-the-box. HTTP/2+ allows us to serve individual files without a material performance impact and these can be compressed on-the-fly by the web server. This means that we can build apps in a new way, using tools that are simpler precisely because they don't do many things that we no longer need.
And since cool tools deserve cool names, say hello to LAST Stack:
- L Live Components
- A AssetMapper
- S Stimulus (or Symfony)
- T Turbo (or Twig)
LAST stack is about web standards. AssetMapper (stable in Symfony 6.4) leverages importmaps: a standard that's now supported on all major browsers (and has a polyfill for old browsers). This is built on top of another standard - ES modules and is backed up by the power of HTTP/2 & HTTP/3: allowing us to not worry about bundling our assets. Add in preloading and we have a fast, standards-based way to load our assets!
Next, LAST stack is no build. Yup, it's a zero build time Node-free
setup. Thanks to the fact that browsers understand import
statements (+ modern JS)
and HTTP/2+, there's... nothing left to build! Yes, we're back to opening up a JavaScript
file, writing code & refreshing the page. I've been doing this for 6
months and it puts the joy back into my code.
I hope you've noticed that, despite the trendy name, LAST stack is not new nor unique. And that's the third pillar: shared tools. Stimulus and Turbo are open source JavaScript projects used by Ruby on Rails and apps everywhere. When they move forward (Turbo 8 looks huge! and Strada empowers mobile apps), we move forward. The nature of JavaScript modules also means that we can use any JavaScript package we want to solve a problem: nothing is specific to Symfony.
LASTly, LAST stack is about simplicity and productivity. No build, no complexity, and a low cognitive load: an entire system that can be understood by a single developer. Use Twig to render all your HTML, Turbo to transform into a single-page app, Stimulus for an extra sprinkle of JavaScript & Live Components for highly interactive parts of your page (yes, still using Twig!).
The future is here and what's old is new. Welcome to LAST stack.
8 Comments
Hey Tac,
Thanks for sharing this with others!
Cheers!
Loving the course but I am still trying to wrap my head around how this is different than Webpack Encore. I've tried looking and doing research but can't find anything that helps. Can anyone can help explain? TIA!
Hey JDCrain,
Well, we can compare Webpack Encore only with the new AssetMapper. Because other tech we teach in this course, like Stimulus, Turbo, Live Components - that's separate things that works standalone no matter if you use Webpack Encore or AssetMapper. I bet you know it, but just to clarify this :)
In short, Webpack Encore requires you to have NodeJS, even on production if you want to compile your assets on prod during the deployment while AssetMapper don't need it at all, so it makes your deploy process simpler and no need to have that Node installed on prod :)
But those tools have different approaches. Webpack Encore handles bundling, code splitting, module transpilation, and more while AssetMapper primarily maps and copies assets with minimal processing.
If you have complex frontend setup with highly interactive modern JavaScript application - probably better to look into direction of Webpack Encore. AssetMapper is ideal for projects that favor simplicity and tight integration with Symfony without the overhead of a Node.js build process, but it has some quirks and limitation due to this.
I hope it helps a little bit. But watcing this course should help to understand the way you work with AssetMapper, and if you have worked with Webpack Encore - it should be easier for you to compare both approaches.
Cheers!
Hi Victor,
I did not know that. I've used either..not until I started SymfonyCasts so I am pretty "green" when it comes to all this.
I am just trying to figure the best route to take, with a legacy php application I maintain, when it's time to pull the plug and update.
Thanks!
Hey JDCrain,
I hope that helped! If you have more questions - don't hesitate to ask ;)
Cheers!
Awesome tutorial!
I bumped the code to 6.4 and wanted mention that the namespace for Flowbite changed. So twig.yaml should be