🏝️ The Server Islands hype is real!
HTML-код
- Опубликовано: 8 сен 2024
- Join the early preview for my course! learnastro.dev
($20 off with the code SERVER_ISLANDS)
Server Islands are a new paradigm in Astro, letting you stream in MARKUP! from the server. This enables CDN caching of your static content while also allowing for customizable data rendered server-side. Let’s take a look!
🔗 Key Links 🔗
- Announcement: astro.build/bl...
- Blog post: astro.build/bl...
- RFC: github.com/wit...
Example 1
- server-defer.v...
Example 2
- server-islands...
- Github: github.com/wit...
---------------------------------------
📹 Related Videos 📹
- Astro Rendering Options: • Choosing between SSR, ...
---------------------------------------
🌐 Connect With Me 🌐
- Website: codinginpublic...
- Blog: chrispenningto...
- Twitter: / cpenned
- Patreon: / coding_in_public
- Buy Me a Coffee: www.buymeacoff...
Awesome explanation Chris ! I learned so much from you, thank you
🍻🍺
Glad you enjoyed it!
Great content as always! I think by “customizable” you mean “dynamic”? Serves dynamic content to the user. Customizable implies the user customizing that element with various options or whatnot. Again, great video!
Would love to see more in depth examples with nested island. What would be your approach on let's say a Server island that would need interactivity ? Would you convert it all to client or would you integrate a client island into the server island ? I like the concept of having multiple rendering pattern but it always scratch the surface and does not go to production level problems that might occur. All the best mate
Awesome video Chris! Love how these server islands are so similar to client islands in concept - and as easy to use with Astro's wonderfully simple APIs 🔥
Wonderful new Astro feature and great introductory video!
I’ve been watching your videos for some time now, I really like your explanation and I plan soon to try out astro for my projects, top tier content
I hope this comes to the course. Would love a more in-depth example
So… basically htmx? I’m not seeing how that is streamed in.
Awesome this feature changes a lot of things. I have a question, have you ever deployed to cpanel in an astro project?
still a bit confused how this is done if it's all just html? how is html slotted into a html site without using javascript? or is there like a mini javascript framework added ala htmx?
There is a small JavaScript together with the main static page that fetches the island content.
@@dageddy ah okay, so it's a bit like htmx, was just confused there for a second
I could have been clearer. There’s a small INLINE script, that does all the work but there’s no extra fetch for a JS bundle.
@@CodinginPublic what tripped me up about server islands, is that it seems a lot like HTMX except that you can only dynamically render the islands on a request/reload. seems like there is no way to only re-request a server island once the page is loaded (to check if the number of available rooms has changed in the mean time for example)
correct? noob here
As typical with web developers they say things that aren't true and then confuse everybody. Like how you typically hear that js only uses one thread. No it also uses the systems threads, having a main loop doesn't mean you can't use anything else otherwise async wouldn't be possible. So yes there's still js, the part that manipulated the Dom client side is the only difference but that doesn't sound as cool
basically react server components?
So basically instead of a jamstack fetch that gets you JSON back which is then used by the client side JS to manipulate the DOM with, you do a fetch that has the server generate HTML or grab it from a cache which means you end up with 0 client side js besides fetches for about the same speed if not possibly faster (due to caching)?
Yep! And you can statically render the pages using SGG if it fits your use case and get that core content cached on a distributed CDN for really fast FCP.
@@CodinginPublic so are htmx and vite redundant?
@@user-tx4wj7qk4t
No from what it seems this only targets initial render. If you were using htmx to do this streaming then you could go ahead and refactor it out 🎉!
Otherwise if you were doing something like having a number next to the cart with the amount of items, that would need further interaction as the user uses the site like refetches for that one component.
What's the difference with NextJS?
Different infrastructure but same basic result.
Is it the same as parial rendering in Nextjs?
Similar. Different infrastructure. Same basically result.
use php and forget any of it
Ha someone else mentioned that PHP has had this for 2 decades. Nice to get it in JS land. Only two decades late. Ha
It's crazy how we already solved these problems more than 20 years ago with PHP and now the JS community acts like it's inventing these as new concepts
if anyone points out this obvious fact, they will be offended 😊
Job security maybe?
Ha well, a few thoughts. I know Astro in particular has leaned into the “back to PHP” memes at least and not everyone has written PHP, so it’s new to a lot of us that have just started in web dev. Nice to have the best of interactivity with JS and some of the tested web patterns. Thanks for your perspective.
php had client level interactivity 20 years ago? that's new to me
can someone link me a source if true? my understanding is that the island architecture in this form is relatively new
i've heard Ryan Carnito talk about ... yahoo? or amazon? having some early internal frameworks that was basically islands, they just never used it in production, for reasons
same principle XHR uses years Vaadin framework in Java, no js coding, web and server side components comunicate togehter, so Astro is good solution same way like Vaadin, but Vaadin os good for web apps, Astro I will use for more static sites, looks great
Never heard of Vaadin. Cool. Thanks!