Live data from Hacker News

Astro is a return to the fundamentals of the web

websmith.studio

221–230 of 268 posts

Re: Astro is a return to the fundamentals of the web

#221
post #10

> Traditional frameworks hydrate entire pages with JavaScript. Even if you've got a simple blog post with one interactive widget, the whole page gets the JavaScript treatment. Astro flips this on its head. Your pages are static HTML by default, and only the bits that need interactivity become JavaScript "islands." Back in my days we called this "progressive enhancements" (or even just "web pages"), and was basically…

Back in your day, there wasn’t a developer experience by which you could build a website or web app (or both) as a single, cohesive unit, covering both front-end and back-end, while avoiding the hydration performance hit. Now we have Astro, Next.js with RSC, and probably at least a dozen more strong contenders.

Why do you think that? You could absolutely "build a website covering FE and BE without the hydration performance hit" using standard practices of the time.

You'd render templates in Jade/Handlebars/EJS, break them down into page components, apply progressive enhancement via JS. Eventually we got DOM diffing libraries so you could render templates on the client and move to declarative logic. DX was arguably better than today as you could easily understand and inspect your entire stack, though tools weren't as flashy.

In the 2010-2015 era it was not uncommon to build entire interactive websites from scratch in under a day, as you wasted almost no time fighting your tools.

Re: Astro is a return to the fundamentals of the web

#223
post #74

Earlier quoted context omitted.

> islands work until they don't Like when?

Not the op, but I’d guess islands become a PITA when there is user-visible state that must be synchronized and rendered coherently across multiple islands.

[dead]

Re: Astro is a return to the fundamentals of the web

#224

Please stop recommending Next.js as the de facto React framework, we need some critical thinking back into front-end. Remix (React Router v7) or TanStack are much better alternatives.

Please stop recommending React as the de facto framework, we need some critical thinking back into front-end. HTML, CSS and JS are much better alternatives.

Re: Astro is a return to the fundamentals of the web

#225
post #186

Earlier quoted context omitted.

But what you're describing could be done for php, or any other backend language/framework... There's nothing unique to Astro in this regard.

I'm not a frontend developer so I'm ignorant about this stuff so that's the first I've heard of it. Do you know how you can do this in spring? Let's say I used Thymeleaf, is there a maven target I can use to walk over a database and generate every iteration of a html website?

i dont know anything about spring, thymeleaf etc... I assume google or llms could point you in the right direction. At worst, you could just literally crawl your site with http requests and cache the result. You could even do it from cloudflare workers and with the right caching headers could cache it all in cloudflare cdn.

Re: Astro is a return to the fundamentals of the web

#226
post #209
post #139

Earlier quoted context omitted.

Htmx IS JavaScript... Datastar does everything htmx does and much more. And, iirc, is also smaller. Just explore their site, docs, essays etc

Oh okay. While Htmx-the-lib is JS, the standard practice is to make the site progressively enhanced by Htmx such that it still works without JS and improves accessibility for screen readers. While this could be possible with Datastar, I've read that it's generally more work to enable progressive enhancement, but maybe that's not a goal.

Again, datastar does everything htmx does out of the box, and far more.

Re: Astro is a return to the fundamentals of the web

#227
post #149

Earlier quoted context omitted.

Care to explain? Astro is trying to position itself in opposition to things like Next.js or Nuxt wich are specifically marketed as application frameworks? And the architecture is more suited to something like a content site, because of the content collections, built-in MDX support, SSR, image handling, and server routing?

Sure, but maybe you need to go first. What do you mean when you say "a content site"? To me, "content" == "literally anything that resides in the DOM". But, clearly we aren't talking about that (I hope).

They are referring to static non-interactive content (basically images and text) in sites like blogs, marketing site, docs, etc. as opposed to highly interactive, and dynamic components, think Facebook, Figma, etc.

Re: Astro is a return to the fundamentals of the web

#228
post #152

Could someone compare it like I'm 5 to static site generators like Hugo, Jekyll? Does it make it easier to throw in necessary JS (e.g. for comments)? Thanks.

Astro is, and should be treated, as a static site generator.

> Does it make it easier to throw in necessary JS (e.g. for comments)?

With astro you can combine html, css and js in a single file (.astro). You write plain JS (TypeScript) within tag. There, you can, e.g. import your comment library, point to separate .js/*.ts file or write whatever logic you want for client-side JS.

See the docs for example JS usage in astro components:

https://docs.astro.build/en/guides/client-side-scripts/#web-...

Re: Astro is a return to the fundamentals of the web

#229

Just curious if non-techy folks might ask whether Astro is reliable enough for production use, such as e-commerce, marketing sites, etc.

Non-techy folks often don't touch terminal. With astro, you start with terminal.

Can it be reliable for production use? Yes.

Can non-techy make it reliable for production use? Who knows.

E-commerce and marketing sites are at the two opposite sides of complexity spectrum.

Astro would be perfect for marketing page (non-techy could approach that) and doable for e-commerce (for experienced dev).

Whether it SHOULD be used for e-commerce would be another question.

Post reply on HN